version 1.7, 1997/01/17 07:13:00 |
version 1.8, 1997/01/25 23:26:42 |
|
|
in = ntohl(in); |
in = ntohl(in); |
mask = ntohl(mask); |
mask = ntohl(mask); |
if (!nflag && in != INADDR_ANY) { |
if (!nflag && in != INADDR_ANY) { |
if (mask == INADDR_ANY) { |
np = getnetbyaddr(in, AF_INET); |
if (IN_CLASSA(in)) { |
if (np == NULL) { |
mask = IN_CLASSA_NET; |
if (mask == INADDR_ANY) { |
subnetshift = 8; |
if (IN_CLASSA(in)) { |
} else if (IN_CLASSB(in)) { |
mask = IN_CLASSA_NET; |
mask = IN_CLASSB_NET; |
subnetshift = 8; |
subnetshift = 8; |
} else if (IN_CLASSB(in)) { |
} else { |
mask = IN_CLASSB_NET; |
mask = IN_CLASSC_NET; |
subnetshift = 8; |
subnetshift = 4; |
} else { |
|
mask = IN_CLASSC_NET; |
|
subnetshift = 4; |
|
} |
|
/* |
|
* If there are more bits than the standard mask |
|
* would suggest, subnets must be in use. |
|
* Guess at the subnet mask, assuming reasonable |
|
* width subnet fields. |
|
*/ |
|
while (in &~ mask) |
|
mask = (long)mask >> subnetshift; |
} |
} |
/* |
net = in & mask; |
* If there are more bits than the standard mask |
while ((mask & 1) == 0) |
* would suggest, subnets must be in use. |
mask >>= 1, net >>= 1; |
* Guess at the subnet mask, assuming reasonable |
np = getnetbyaddr(net, AF_INET); |
* width subnet fields. |
|
*/ |
|
while (in &~ mask) |
|
mask = (long)mask >> subnetshift; |
|
} |
} |
net = in & mask; |
|
while ((mask & 1) == 0) |
|
mask >>= 1, net >>= 1; |
|
np = getnetbyaddr(net, AF_INET); |
|
if (np) |
if (np) |
cp = np->n_name; |
cp = np->n_name; |
} |
} |