diff options
Diffstat (limited to 'usr.bin/netstat/flowtable.c')
-rw-r--r-- | usr.bin/netstat/flowtable.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/usr.bin/netstat/flowtable.c b/usr.bin/netstat/flowtable.c index a3d5dd5..392cc0b 100644 --- a/usr.bin/netstat/flowtable.c +++ b/usr.bin/netstat/flowtable.c @@ -28,12 +28,14 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); + #include <sys/param.h> -#include <sys/sysctl.h> + #include <net/flowtable.h> -#include <err.h> + #include <stdint.h> #include <stdio.h> + #include "netstat.h" /* @@ -67,17 +69,18 @@ void flowtable_stats(void) { struct flowtable_stat stat; - size_t len = sizeof(stat); if (!live) return; - if (sysctlbyname("net.flowtable.ip4.stat", &stat, &len, NULL, 0) == 0) { + if (fetch_stats("net.flowtable.ip4.stat", 0, &stat, + sizeof(stat), NULL) == 0) { printf("flowtable for IPv4:\n"); print_stats(&stat); } - if (sysctlbyname("net.flowtable.ip6.stat", &stat, &len, NULL, 0) == 0) { + if (fetch_stats("net.flowtable.ip6.stat", 0, &stat, + sizeof(stat), NULL) == 0) { printf("flowtable for IPv6:\n"); print_stats(&stat); } |