summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2003-09-04 20:05:19 +0000
committertedu <tedu@openbsd.org>2003-09-04 20:05:19 +0000
commit885f8a542bc8671c19d90ed009da0feadf2190a6 (patch)
treec8c503995498255d6241f2c11707005342a636b9
parentFix W^X mistake. If the dynamic linker is workin in non-lazy mode, it (diff)
downloadwireguard-openbsd-885f8a542bc8671c19d90ed009da0feadf2190a6.tar.xz
wireguard-openbsd-885f8a542bc8671c19d90ed009da0feadf2190a6.zip
fix crash and add new icmpnames. based on pr3439. some input fgsch@.
ok deraadt@ fgsch@
-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