summaryrefslogtreecommitdiffstats
path: root/usr.bin/netstat/inet6.c
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2001-06-28 18:06:15 +0000
committerume <ume@FreeBSD.org>2001-06-28 18:06:15 +0000
commit111d2769845191e9d37e0f7cd5d9c83f08d4bdaa (patch)
treee4427bc9fd8657ab5622480fef27f4213a27b430 /usr.bin/netstat/inet6.c
parent1fff29b6c647fb361baa45220550c832fe5dd963 (diff)
downloadFreeBSD-src-111d2769845191e9d37e0f7cd5d9c83f08d4bdaa.zip
FreeBSD-src-111d2769845191e9d37e0f7cd5d9c83f08d4bdaa.tar.gz
- create an entry of IPV6CTL_STATS sysctl.
- fix the problem that netstat doesn't show raw6 and icmp6 pcblist. - make netstat use sysctl to retreive stats of ipv6 and icmpv6 instead of kread. Obtained from: KAME MFC after: 1 week
Diffstat (limited to 'usr.bin/netstat/inet6.c')
-rw-r--r--usr.bin/netstat/inet6.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/usr.bin/netstat/inet6.c b/usr.bin/netstat/inet6.c
index 7d432d5..44a9b51 100644
--- a/usr.bin/netstat/inet6.c
+++ b/usr.bin/netstat/inet6.c
@@ -344,11 +344,17 @@ ip6_stats(u_long off __unused, char *name, int af __unused)
{
struct ip6stat ip6stat;
int first, i;
+ int mib[4];
+ size_t len;
- if (off == 0)
- return;
+ mib[0] = CTL_NET;
+ mib[1] = PF_INET6;
+ mib[2] = IPPROTO_IPV6;
+ mib[3] = IPV6CTL_STATS;
- if (kread(off, (char *)&ip6stat, sizeof (ip6stat)))
+ len = sizeof ip6stat;
+ memset(&ip6stat, 0, len);
+ if (sysctl(mib, 4, &ip6stat, &len, (void *)0, 0) < 0)
return;
printf("%s:\n", name);
@@ -811,10 +817,18 @@ icmp6_stats(u_long off __unused, char *name, int af __unused)
{
struct icmp6stat icmp6stat;
register int i, first;
+ int mib[4];
+ size_t len;
- if (off == 0)
+ mib[0] = CTL_NET;
+ mib[1] = PF_INET6;
+ mib[2] = IPPROTO_ICMPV6;
+ mib[3] = ICMPV6CTL_STATS;
+
+ len = sizeof icmp6stat;
+ memset(&icmp6stat, 0, len);
+ if (sysctl(mib, 4, &icmp6stat, &len, (void *)0, 0) < 0)
return;
- kread(off, (char *)&icmp6stat, sizeof (icmp6stat));
printf("%s:\n", name);
#define p(f, m) if (icmp6stat.f || sflag <= 1) \
OpenPOWER on IntegriCloud