summaryrefslogtreecommitdiffstats
path: root/usr.bin/netstat/ipsec.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/netstat/ipsec.c')
-rw-r--r--usr.bin/netstat/ipsec.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/usr.bin/netstat/ipsec.c b/usr.bin/netstat/ipsec.c
index af1b234..801008f 100644
--- a/usr.bin/netstat/ipsec.c
+++ b/usr.bin/netstat/ipsec.c
@@ -202,10 +202,17 @@ ipsec_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
{
struct ipsecstat ipsecstat;
- if (off == 0)
- return;
+ if (strcmp(name, "ipsec6") == 0) {
+ if (fetch_stats("net.inet6.ipsec6.ipsecstats", off,&ipsecstat,
+ sizeof(ipsecstat), kread_counters) != 0)
+ return;
+ } else {
+ if (fetch_stats("net.inet.ipsec.ipsecstats", off, &ipsecstat,
+ sizeof(ipsecstat), kread_counters) != 0)
+ return;
+ }
+
printf ("%s:\n", name);
- kread_counters(off, (char *)&ipsecstat, sizeof(ipsecstat));
print_ipsecstats(&ipsecstat);
}
@@ -288,10 +295,10 @@ ah_stats(u_long off, const char *name, int family __unused, int proto __unused)
{
struct ahstat ahstat;
- if (off == 0)
+ if (fetch_stats("net.inet.ah.stats", off, &ahstat,
+ sizeof(ahstat), kread_counters) != 0)
return;
printf ("%s:\n", name);
- kread_counters(off, (char *)&ahstat, sizeof(ahstat));
print_ahstats(&ahstat);
}
@@ -335,10 +342,10 @@ esp_stats(u_long off, const char *name, int family __unused, int proto __unused)
{
struct espstat espstat;
- if (off == 0)
+ if (fetch_stats("net.inet.esp.stats", off, &espstat,
+ sizeof(espstat), kread_counters) != 0)
return;
printf ("%s:\n", name);
- kread_counters(off, (char *)&espstat, sizeof(espstat));
print_espstats(&espstat);
}
@@ -380,10 +387,10 @@ ipcomp_stats(u_long off, const char *name, int family __unused,
{
struct ipcompstat ipcompstat;
- if (off == 0)
+ if (fetch_stats("net.inet.ipcomp.stats", off, &ipcompstat,
+ sizeof(ipcompstat), kread_counters) != 0)
return;
printf ("%s:\n", name);
- kread_counters(off, (char *)&ipcompstat, sizeof(ipcompstat));
print_ipcompstats(&ipcompstat);
}
OpenPOWER on IntegriCloud