- 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
This commit is contained in:
parent
1fff29b6c6
commit
111d276984
@ -402,6 +402,8 @@ SYSCTL_INT(_net_inet6_ip6, IPV6CTL_SENDREDIRECTS,
|
||||
redirect, CTLFLAG_RW, &ip6_sendredirects, 0, "");
|
||||
SYSCTL_INT(_net_inet6_ip6, IPV6CTL_DEFHLIM,
|
||||
hlim, CTLFLAG_RW, &ip6_defhlim, 0, "");
|
||||
SYSCTL_STRUCT(_net_inet6_ip6, IPV6CTL_STATS, stats, CTLFLAG_RD,
|
||||
&ip6stat, ip6stat, "");
|
||||
SYSCTL_INT(_net_inet6_ip6, IPV6CTL_MAXFRAGPACKETS,
|
||||
maxfragpackets, CTLFLAG_RW, &ip6_maxfragpackets, 0, "");
|
||||
SYSCTL_INT(_net_inet6_ip6, IPV6CTL_ACCEPT_RTADV,
|
||||
|
@ -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) \
|
||||
|
@ -206,10 +206,10 @@ struct protox ip6protox[] = {
|
||||
tcp_stats, NULL, "tcp", IPPROTO_TCP },
|
||||
{ -1, -1, 1, protopr,
|
||||
udp_stats, NULL, "udp", IPPROTO_UDP },
|
||||
{ -1, N_IP6STAT, 1, 0,
|
||||
ip6_stats, ip6_ifstats, "ip6", 0 },
|
||||
{ -1, N_ICMP6STAT, 1, 0,
|
||||
icmp6_stats, icmp6_ifstats, "icmp6",0 },
|
||||
{ -1, N_IP6STAT, 1, protopr,
|
||||
ip6_stats, ip6_ifstats, "ip6", IPPROTO_RAW },
|
||||
{ -1, N_ICMP6STAT, 1, protopr,
|
||||
icmp6_stats, icmp6_ifstats, "icmp6",IPPROTO_ICMPV6 },
|
||||
#ifdef IPSEC
|
||||
{ -1, N_IPSEC6STAT, 1, 0,
|
||||
ipsec_stats, NULL, "ipsec6",0 },
|
||||
|
Loading…
x
Reference in New Issue
Block a user