diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2009-07-17 14:21:38 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2009-07-17 14:21:38 +0000 |
commit | 1f6bbb790b00f2d31c281d739ce0ae4985fc9304 (patch) | |
tree | 84a4d1e4f461b4f476c3e4a9b1901d767694091b /usr.bin/netstat | |
parent | 16da506830c417c806ce3e7e87a271672f502eb7 (diff) |
revert 1.38: naddy looked closer at the output and some of the sections don't make sense without the headers anymore
Diffstat (limited to 'usr.bin/netstat')
-rw-r--r-- | usr.bin/netstat/inet6.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/usr.bin/netstat/inet6.c b/usr.bin/netstat/inet6.c index bbc9ff4596a..4889b138670 100644 --- a/usr.bin/netstat/inet6.c +++ b/usr.bin/netstat/inet6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inet6.c,v 1.38 2009/07/16 23:14:10 tedu Exp $ */ +/* $OpenBSD: inet6.c,v 1.39 2009/07/17 14:21:37 tedu Exp $ */ /* BSDI inet.c,v 2.3 1995/10/24 02:19:29 prb Exp */ /* * Copyright (c) 1983, 1988, 1993 @@ -380,19 +380,23 @@ ip6_stats(char *name) p(ip6s_cantfrag, "\t%llu datagram%s that can't be fragmented\n"); p(ip6s_badscope, "\t%llu packet%s that violated scope rules\n"); p(ip6s_notmember, "\t%llu multicast packet%s which we don't join\n"); - for (i = 0; i < 256; i++) + for (first = 1, i = 0; i < 256; i++) if (ip6stat.ip6s_nxthist[i] != 0) { + if (first) { + printf("\tInput packet histogram:\n"); + first = 0; + } n = NULL; if (ip6nh[i]) n = ip6nh[i]; else if ((ep = getprotobynumber(i)) != NULL) n = ep->p_name; if (n) - printf("\t%llu %s packets\n", - (unsigned long long)ip6stat.ip6s_nxthist[i], n); + printf("\t\t%s: %llu\n", n, + (unsigned long long)ip6stat.ip6s_nxthist[i]); else - printf("\t%llu proto %d packets\n", - (unsigned long long)ip6stat.ip6s_nxthist[i], i); + printf("\t\t#%d: %llu\n", i, + (unsigned long long)ip6stat.ip6s_nxthist[i]); } printf("\tMbuf statistics:\n"); p(ip6s_m1, "\t\t%llu one mbuf%s\n"); @@ -400,7 +404,7 @@ ip6_stats(char *name) char ifbuf[IFNAMSIZ]; if (ip6stat.ip6s_m2m[i] != 0) { if (first) { - printf("\t\ttwo or more mbufs:\n"); + printf("\t\ttwo or more mbuf:\n"); first = 0; } printf("\t\t\t%s = %llu\n", @@ -815,7 +819,7 @@ void icmp6_stats(char *name) { struct icmp6stat icmp6stat; - int i; + int i, first; int mib[] = { CTL_NET, AF_INET6, IPPROTO_ICMPV6, ICMPV6CTL_STATS }; size_t len = sizeof(icmp6stat); @@ -837,8 +841,12 @@ icmp6_stats(char *name) "\t%llu error%s not generated because old message was icmp6 or so\n"); p(icp6s_toofreq, "\t%llu error%s not generated because of rate limitation\n"); - for (i = 0; i < 256; i++) + for (first = 1, i = 0; i < 256; i++) if (icmp6stat.icp6s_outhist[i] != 0) { + if (first) { + printf("\tOutput packet histogram:\n"); + first = 0; + } printf("\t\t%s: %llu\n", icmp6names[i], (unsigned long long)icmp6stat.icp6s_outhist[i]); } @@ -846,11 +854,16 @@ icmp6_stats(char *name) p(icp6s_tooshort, "\t%llu message%s < minimum length\n"); p(icp6s_checksum, "\t%llu bad checksum%s\n"); p(icp6s_badlen, "\t%llu message%s with bad length\n"); - for (i = 0; i < ICMP6_MAXTYPE; i++) + for (first = 1, i = 0; i < ICMP6_MAXTYPE; i++) if (icmp6stat.icp6s_inhist[i] != 0) { + if (first) { + printf("\tInput packet histogram:\n"); + first = 0; + } printf("\t\t%s: %llu\n", icmp6names[i], (unsigned long long)icmp6stat.icp6s_inhist[i]); } + printf("\tHistogram of error messages to be generated:\n"); p_5(icp6s_odst_unreach_noroute, "\t\t%llu no route\n"); p_5(icp6s_odst_unreach_admin, "\t\t%llu administratively prohibited\n"); p_5(icp6s_odst_unreach_beyondscope, "\t\t%llu beyond scope\n"); |