=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/netstat/route.c,v retrieving revision 1.7 retrieving revision 1.8 diff -c -r1.7 -r1.8 *** src/usr.bin/netstat/route.c 1997/01/17 07:13:00 1.7 --- src/usr.bin/netstat/route.c 1997/01/25 23:26:42 1.8 *************** *** 1,4 **** ! /* $OpenBSD: route.c,v 1.7 1997/01/17 07:13:00 millert Exp $ */ /* $NetBSD: route.c,v 1.15 1996/05/07 02:55:06 thorpej Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: route.c,v 1.8 1997/01/25 23:26:42 tholo Exp $ */ /* $NetBSD: route.c,v 1.15 1996/05/07 02:55:06 thorpej Exp $ */ /* *************** *** 38,44 **** #if 0 static char sccsid[] = "from: @(#)route.c 8.3 (Berkeley) 3/9/94"; #else ! static char *rcsid = "$OpenBSD: route.c,v 1.7 1997/01/17 07:13:00 millert Exp $"; #endif #endif /* not lint */ --- 38,44 ---- #if 0 static char sccsid[] = "from: @(#)route.c 8.3 (Berkeley) 3/9/94"; #else ! static char *rcsid = "$OpenBSD: route.c,v 1.8 1997/01/25 23:26:42 tholo Exp $"; #endif #endif /* not lint */ *************** *** 541,570 **** in = ntohl(in); mask = ntohl(mask); if (!nflag && in != INADDR_ANY) { ! if (mask == INADDR_ANY) { ! if (IN_CLASSA(in)) { ! mask = IN_CLASSA_NET; ! subnetshift = 8; ! } else if (IN_CLASSB(in)) { ! mask = IN_CLASSB_NET; ! subnetshift = 8; ! } 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; - while ((mask & 1) == 0) - mask >>= 1, net >>= 1; - np = getnetbyaddr(net, AF_INET); if (np) cp = np->n_name; } --- 541,573 ---- in = ntohl(in); mask = ntohl(mask); if (!nflag && in != INADDR_ANY) { ! np = getnetbyaddr(in, AF_INET); ! if (np == NULL) { ! if (mask == INADDR_ANY) { ! if (IN_CLASSA(in)) { ! mask = IN_CLASSA_NET; ! subnetshift = 8; ! } else if (IN_CLASSB(in)) { ! mask = IN_CLASSB_NET; ! subnetshift = 8; ! } 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; ! while ((mask & 1) == 0) ! mask >>= 1, net >>= 1; ! np = getnetbyaddr(net, AF_INET); } if (np) cp = np->n_name; }