summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2009-06-25 15:53:12 +0000
committerclaudio <claudio@openbsd.org>2009-06-25 15:53:12 +0000
commit77e759e92832553f3ab312c401c703fc3608103f (patch)
tree9d1405b67b6c3bd0ba285b995341aa39d9cb2437
parentbackout the buf_acquire() does the bremfree() since all callers (diff)
downloadwireguard-openbsd-77e759e92832553f3ab312c401c703fc3608103f.tar.xz
wireguard-openbsd-77e759e92832553f3ab312c401c703fc3608103f.zip
Check RTM_VERSION even on sysctl data.
Tested and OK sthen@, OK henning@
-rw-r--r--usr.bin/systat/if.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/systat/if.c b/usr.bin/systat/if.c
index 4a855671113..90d6cd12468 100644
--- a/usr.bin/systat/if.c
+++ b/usr.bin/systat/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.13 2009/04/03 20:29:21 deraadt Exp $ */
+/* $OpenBSD: if.c,v 1.14 2009/06/25 15:53:12 claudio Exp $ */
/*
* Copyright (c) 2004 Markus Friedl <markus@openbsd.org>
*
@@ -221,8 +221,9 @@ fetchifstat(void)
lim = buf + need;
for (next = buf; next < lim; next += ifm.ifm_msglen) {
bcopy(next, &ifm, sizeof ifm);
- if (ifm.ifm_type != RTM_IFINFO ||
- !(ifm.ifm_addrs & RTA_IFP))
+ if (ifm.ifm_version != RTM_VERSION ||
+ ifm.ifm_type != RTM_IFINFO ||
+ !(ifm.ifm_addrs & RTA_IFP))
continue;
if (ifm.ifm_index >= nifs) {
if ((newstats = realloc(ifstats, (ifm.ifm_index + 4)