summaryrefslogtreecommitdiffstats
path: root/usr.bin/netstat
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2015-12-18 15:21:03 -0200
committerRenato Botelho <renato@netgate.com>2015-12-18 15:21:03 -0200
commitcfe34c66a5ecf4b4d0db428dcaa83bc1959944e9 (patch)
treef2dd3e19d51cd578d33f2c231100e5248a937ad2 /usr.bin/netstat
parent8726d2cf8c28e4b7b6e546472648865abef98201 (diff)
downloadFreeBSD-src-cfe34c66a5ecf4b4d0db428dcaa83bc1959944e9.zip
FreeBSD-src-cfe34c66a5ecf4b4d0db428dcaa83bc1959944e9.tar.gz
Revert "Backport r292394 while it's not on stable/10"
This reverts commit 8726d2cf8c28e4b7b6e546472648865abef98201.
Diffstat (limited to 'usr.bin/netstat')
-rw-r--r--usr.bin/netstat/ipsec.c28
-rw-r--r--usr.bin/netstat/main.c10
2 files changed, 14 insertions, 24 deletions
diff --git a/usr.bin/netstat/ipsec.c b/usr.bin/netstat/ipsec.c
index 9140359..af1b234 100644
--- a/usr.bin/netstat/ipsec.c
+++ b/usr.bin/netstat/ipsec.c
@@ -202,17 +202,10 @@ ipsec_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
{
struct ipsecstat ipsecstat;
- 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;
- }
-
+ if (off == 0)
+ return;
printf ("%s:\n", name);
+ kread_counters(off, (char *)&ipsecstat, sizeof(ipsecstat));
print_ipsecstats(&ipsecstat);
}
@@ -295,11 +288,10 @@ ah_stats(u_long off, const char *name, int family __unused, int proto __unused)
{
struct ahstat ahstat;
- if (fetch_stats("net.inet.ah.stats", off, &ahstat,
- sizeof(ahstat), kread_counters) != 0)
+ if (off == 0)
return;
-
printf ("%s:\n", name);
+ kread_counters(off, (char *)&ahstat, sizeof(ahstat));
print_ahstats(&ahstat);
}
@@ -343,11 +335,10 @@ esp_stats(u_long off, const char *name, int family __unused, int proto __unused)
{
struct espstat espstat;
- if (fetch_stats("net.inet.esp.stats", off, &espstat,
- sizeof(espstat), kread_counters) != 0)
+ if (off == 0)
return;
-
printf ("%s:\n", name);
+ kread_counters(off, (char *)&espstat, sizeof(espstat));
print_espstats(&espstat);
}
@@ -389,11 +380,10 @@ ipcomp_stats(u_long off, const char *name, int family __unused,
{
struct ipcompstat ipcompstat;
- if (fetch_stats("net.inet.ipcomp.stats", off, &ipcompstat,
- sizeof(ipcompstat), kread_counters) != 0)
+ if (off == 0)
return;
-
printf ("%s:\n", name);
+ kread_counters(off, (char *)&ipcompstat, sizeof(ipcompstat));
print_ipcompstats(&ipcompstat);
}
diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c
index 407ecc8..6a1ab18 100644
--- a/usr.bin/netstat/main.c
+++ b/usr.bin/netstat/main.c
@@ -202,13 +202,13 @@ struct protox {
igmp_stats, NULL, "igmp", 1, IPPROTO_IGMP },
#ifdef IPSEC
{ -1, N_IPSECSTAT, 1, NULL, /* keep as compat */
- ipsec_stats, NULL, "ipsec", 1, 0},
+ ipsec_stats, NULL, "ipsec", 0, 0},
{ -1, N_AHSTAT, 1, NULL,
- ah_stats, NULL, "ah", 1, 0},
+ ah_stats, NULL, "ah", 0, 0},
{ -1, N_ESPSTAT, 1, NULL,
- esp_stats, NULL, "esp", 1, 0},
+ esp_stats, NULL, "esp", 0, 0},
{ -1, N_IPCOMPSTAT, 1, NULL,
- ipcomp_stats, NULL, "ipcomp", 1, 0},
+ ipcomp_stats, NULL, "ipcomp", 0, 0},
#endif
{ N_RIPCBINFO, N_PIMSTAT, 1, protopr,
pim_stats, NULL, "pim", 1, IPPROTO_PIM },
@@ -240,7 +240,7 @@ struct protox ip6protox[] = {
#endif
#ifdef IPSEC
{ -1, N_IPSEC6STAT, 1, NULL,
- ipsec_stats, NULL, "ipsec6", 1, 0 },
+ ipsec_stats, NULL, "ipsec6", 0, 0 },
#endif
#ifdef notyet
{ -1, N_PIM6STAT, 1, NULL,
OpenPOWER on IntegriCloud