summaryrefslogtreecommitdiffstats
path: root/usr.bin/netstat/sctp.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/netstat/sctp.c')
-rw-r--r--usr.bin/netstat/sctp.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/usr.bin/netstat/sctp.c b/usr.bin/netstat/sctp.c
index a2ef7d568..687d039 100644
--- a/usr.bin/netstat/sctp.c
+++ b/usr.bin/netstat/sctp.c
@@ -607,20 +607,11 @@ sctp_statesprint(uint32_t state)
void
sctp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
{
- struct sctpstat sctpstat, zerostat;
- size_t len = sizeof(sctpstat);
-
- if (live) {
- if (zflag)
- memset(&zerostat, 0, len);
- if (sysctlbyname("net.inet.sctp.stats", &sctpstat, &len,
- zflag ? &zerostat : NULL, zflag ? len : 0) < 0) {
- if (errno != ENOENT)
- warn("sysctl: net.inet.sctp.stats");
- return;
- }
- } else
- kread(off, &sctpstat, len);
+ struct sctpstat sctpstat;
+
+ if (fetch_stats("net.inet.sctp.stats", off, &sctpstat,
+ sizeof(sctpstat), kread) != 0)
+ return;
printf ("%s:\n", name);
OpenPOWER on IntegriCloud