summaryrefslogtreecommitdiff
path: root/usr.bin/netstat/route.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1999-03-15 15:59:09 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1999-03-15 15:59:09 +0000
commit8f47d4ed71d336a97dc200eea998754eaeecdf93 (patch)
tree21c348fa1acfe03fa745205e60ddf090a4e5d4ad /usr.bin/netstat/route.c
parent51e0dc257a04a4a2289e9336d545ba5488fd9c29 (diff)
print subnets containing 0 octets correctly; peter
Diffstat (limited to 'usr.bin/netstat/route.c')
-rw-r--r--usr.bin/netstat/route.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c
index 12fc9619b1a..847706826a8 100644
--- a/usr.bin/netstat/route.c
+++ b/usr.bin/netstat/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.26 1999/02/24 22:57:35 angelos Exp $ */
+/* $OpenBSD: route.c,v 1.27 1999/03/15 15:59:08 deraadt Exp $ */
/* $NetBSD: route.c,v 1.15 1996/05/07 02:55:06 thorpej Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "from: @(#)route.c 8.3 (Berkeley) 3/9/94";
#else
-static char *rcsid = "$OpenBSD: route.c,v 1.26 1999/02/24 22:57:35 angelos Exp $";
+static char *rcsid = "$OpenBSD: route.c,v 1.27 1999/03/15 15:59:08 deraadt Exp $";
#endif
#endif /* not lint */
@@ -627,12 +627,12 @@ netname(in, mask)
if (cp) {
strncpy(line, cp, sizeof(line) - 1);
line[sizeof(line) - 1] = '\0';
- } else if ((in & 0xffffff) == 0)
+ } else if (mbits < 9)
snprintf(line, sizeof line, "%u/%d", C(in >> 24), mbits);
- else if ((in & 0xffff) == 0)
+ else if (mbits < 17)
snprintf(line, sizeof line, "%u.%u/%d",
C(in >> 24) , C(in >> 16), mbits);
- else if ((in & 0xff) == 0)
+ else if (mbits < 25)
snprintf(line, sizeof line, "%u.%u.%u/%d",
C(in >> 24), C(in >> 16), C(in >> 8), mbits);
else