summaryrefslogtreecommitdiffstats
path: root/sys/net/if.c
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2020-04-12 07:04:03 +0000
committerdlg <dlg@openbsd.org>2020-04-12 07:04:03 +0000
commit20cac0547f11bffd6037d73783b085934db2ae4d (patch)
tree886e06e5e93c4030a6da68d88ebee9511aa165a7 /sys/net/if.c
parentsay if_pcount needs NET_LOCK instead of the kernel lock. (diff)
downloadwireguard-openbsd-20cac0547f11bffd6037d73783b085934db2ae4d.tar.xz
wireguard-openbsd-20cac0547f11bffd6037d73783b085934db2ae4d.zip
make ifpromisc assert that the caller is holding the NET_LOCK.
it needs NET_LOCK because it modifies if_flags and if_pcount. ok visa@
Diffstat (limited to 'sys/net/if.c')
-rw-r--r--sys/net/if.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 7b62c1c21d9..176fcf849fd 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.602 2020/04/11 10:49:27 mpi Exp $ */
+/* $OpenBSD: if.c,v 1.603 2020/04/12 07:04:03 dlg Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -3031,6 +3031,8 @@ ifpromisc(struct ifnet *ifp, int pswitch)
unsigned short oif_flags;
int oif_pcount, error;
+ NET_ASSERT_LOCKED(); /* modifying if_flags and if_pcount */
+
oif_flags = ifp->if_flags;
oif_pcount = ifp->if_pcount;
if (pswitch) {