diff options
| author | John Baldwin <jhb@FreeBSD.org> | 2007-07-16 17:15:55 +0000 |
|---|---|---|
| committer | John Baldwin <jhb@FreeBSD.org> | 2007-07-16 17:15:55 +0000 |
| commit | feda1a4372d5e340da97042375dfb783dea52eda (patch) | |
| tree | 165174828db97bceab2299030940226f1b6620cf /usr.bin/netstat/if.c | |
| parent | 72d73315396520151f86f8c6cb42b09d5a1073e5 (diff) | |
Notes
Diffstat (limited to 'usr.bin/netstat/if.c')
| -rw-r--r-- | usr.bin/netstat/if.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c index dc280eb97aae..9acd37ca2db1 100644 --- a/usr.bin/netstat/if.c +++ b/usr.bin/netstat/if.c @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include <sys/types.h> #include <sys/protosw.h> #include <sys/socket.h> +#include <sys/socketvar.h> #include <sys/sysctl.h> #include <sys/time.h> @@ -85,19 +86,22 @@ static char ntop_buf[INET6_ADDRSTRLEN]; /* for inet_ntop() */ * Dump pfsync statistics structure. */ void -pfsync_stats(u_long off __unused, const char *name, int af1 __unused) +pfsync_stats(u_long off, const char *name, int af1 __unused, int proto __unused) { struct pfsyncstats pfsyncstat, zerostat; size_t len = sizeof(struct pfsyncstats); - if (zflag) - memset(&zerostat, 0, len); - if (sysctlbyname("net.inet.pfsync.stats", &pfsyncstat, &len, - zflag ? &zerostat : NULL, zflag ? len : 0) < 0) { - if (errno != ENOENT) - warn("sysctl: net.inet.pfsync.stats"); - return; - } + if (live) { + if (zflag) + memset(&zerostat, 0, len); + if (sysctlbyname("net.inet.pfsync.stats", &pfsyncstat, &len, + zflag ? &zerostat : NULL, zflag ? len : 0) < 0) { + if (errno != ENOENT) + warn("sysctl: net.inet.pfsync.stats"); + return; + } + } else + kread(off, &pfsyncstat, len); printf("%s:\n", name); |
