aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/netstat/route.c
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>1997-05-25 08:36:20 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>1997-05-25 08:36:20 +0000
commitef1f3a4fd47cdbb2a5ad5a3ebb426def8839e05b (patch)
tree1847f03ad7e82846c3bf8390b01f233ad31225ae /usr.bin/netstat/route.c
parent2321ce34c14afba7547b3770b4c2660989f01d58 (diff)
downloadsrc-ef1f3a4fd47cdbb2a5ad5a3ebb426def8839e05b.tar.gz
src-ef1f3a4fd47cdbb2a5ad5a3ebb426def8839e05b.zip
Remove some quite bogus code that tried to find subnet names but instead
spammed named with bogus queries.
Notes
Notes: svn path=/head/; revision=26116
Diffstat (limited to 'usr.bin/netstat/route.c')
-rw-r--r--usr.bin/netstat/route.c34
1 files changed, 5 insertions, 29 deletions
diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c
index b6487fe23b4f..e920aaaf9457 100644
--- a/usr.bin/netstat/route.c
+++ b/usr.bin/netstat/route.c
@@ -36,7 +36,7 @@
static char sccsid[] = "From: @(#)route.c 8.6 (Berkeley) 4/28/95";
#endif
static const char rcsid[] =
- "$Id: route.c,v 1.25 1997/02/22 19:56:23 peter Exp $";
+ "$Id: route.c,v 1.26 1997/05/10 10:03:43 jhay Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -634,40 +634,16 @@ netname(in, mask)
char *cp = 0;
static char line[MAXHOSTNAMELEN + 1];
struct netent *np = 0;
- u_long net, omask;
+ u_long net, omask, dmask;
register u_long i;
int subnetshift;
i = ntohl(in);
omask = mask;
if (!nflag && i) {
- if (mask == 0) {
- switch (mask = forgemask(i)) {
- case IN_CLASSA_NET:
- subnetshift = 8;
- break;
- case IN_CLASSB_NET:
- subnetshift = 8;
- break;
- case IN_CLASSC_NET:
- subnetshift = 4;
- break;
- default:
- abort();
- }
- /*
- * 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 (i &~ mask)
- mask = (long)mask >> subnetshift;
- }
- net = i & mask;
- while ((mask & 1) == 0)
- mask >>= 1, net >>= 1;
- if (!(np = getnetbyaddr(i, AF_INET)))
+ dmask = forgemask(i);
+ net = i & dmask;
+ if (!(np = getnetbyaddr(i, AF_INET)) && net != i)
np = getnetbyaddr(net, AF_INET);
if (np) {
cp = np->n_name;