summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2003-09-04 20:05:20 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2003-09-04 20:05:20 +0000
commitec89c94ab6b8c835cd30e3ab84035b9ce7eb18ea (patch)
tree5d64b435ea6daa6e0abdc700c1b984d9d90fe0ca /usr.bin
parent728366afbd8a31bc70424bf0b64579cdfef0a2a1 (diff)
fix crash and add new icmpnames. based on pr3439. some input fgsch@.
ok deraadt@ fgsch@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/netstat/inet.c42
1 files changed, 35 insertions, 7 deletions
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c
index 776af88d0e9..ff36afb315d 100644
--- a/usr.bin/netstat/inet.c
+++ b/usr.bin/netstat/inet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inet.c,v 1.67 2003/09/04 03:20:17 deraadt Exp $ */
+/* $OpenBSD: inet.c,v 1.68 2003/09/04 20:05:19 tedu Exp $ */
/* $NetBSD: inet.c,v 1.14 1995/10/03 21:42:37 thorpej Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "from: @(#)inet.c 8.4 (Berkeley) 4/20/94";
#else
-static char *rcsid = "$OpenBSD: inet.c,v 1.67 2003/09/04 03:20:17 deraadt Exp $";
+static char *rcsid = "$OpenBSD: inet.c,v 1.68 2003/09/04 20:05:19 tedu Exp $";
#endif
#endif /* not lint */
@@ -415,7 +415,7 @@ ip_stats(u_long off, char *name)
#undef p1
}
-static char *icmpnames[] = {
+static char *icmpnames[ICMP_MAXTYPE + 1] = {
"echo reply",
"#1",
"#2",
@@ -435,6 +435,28 @@ static char *icmpnames[] = {
"information request reply",
"address mask request",
"address mask reply",
+ "#19",
+ "#20",
+ "#21",
+ "#22",
+ "#23",
+ "#24",
+ "#25",
+ "#26",
+ "#27",
+ "#28",
+ "#29",
+ "traceroute",
+ "data conversion error",
+ "mobile host redirect",
+ "IPv6 where-are-you",
+ "IPv6 i-am-here",
+ "mobile registration request",
+ "mobile registration reply",
+ "#37",
+ "#38",
+ "SKIP",
+ "Photuris",
};
/*
@@ -463,8 +485,11 @@ icmp_stats(u_long off, char *name)
printf("\tOutput packet histogram:\n");
first = 0;
}
- printf("\t\t%s: %lu\n", icmpnames[i],
- icmpstat.icps_outhist[i]);
+ if (icmpnames[i])
+ printf("\t\t%s:", icmpnames[i]);
+ else
+ printf("\t\t#%d:", i);
+ printf(" %lu\n", icmpstat.icps_outhist[i]);
}
p(icps_badcode, "\t%lu message%s with bad code fields\n");
p(icps_tooshort, "\t%lu message%s < minimum length\n");
@@ -476,8 +501,11 @@ icmp_stats(u_long off, char *name)
printf("\tInput packet histogram:\n");
first = 0;
}
- printf("\t\t%s: %lu\n", icmpnames[i],
- icmpstat.icps_inhist[i]);
+ if (icmpnames[i])
+ printf("\t\t%s:", icmpnames[i]);
+ else
+ printf("\t\t#%d:", i);
+ printf(" %lu\n", icmpstat.icps_inhist[i]);
}
p(icps_reflect, "\t%lu message response%s generated\n");
#undef p