summaryrefslogtreecommitdiffstats
path: root/sys/net/if.c
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2020-05-27 11:19:28 +0000
committermpi <mpi@openbsd.org>2020-05-27 11:19:28 +0000
commit4d5cbc65b3f249a15784c3b64c2933d8466f7caa (patch)
tree3c8cef075a218806de25bcd64f3d244f2ba45dc3 /sys/net/if.c
parentRemove unneeded <stddef.h> (diff)
downloadwireguard-openbsd-4d5cbc65b3f249a15784c3b64c2933d8466f7caa.tar.xz
wireguard-openbsd-4d5cbc65b3f249a15784c3b64c2933d8466f7caa.zip
Document the various flavors of NET_LOCK() and rename the reader version.
Since our last concurrency mistake only ioctl(2) ans sysctl(2) code path take the reader lock. This is mostly for documentation purpose as long as the softnet thread is converted back to use a read lock. dlg@ said that comments should be good enough. ok sashan@
Diffstat (limited to 'sys/net/if.c')
-rw-r--r--sys/net/if.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index b3a4e857598..aaf7e032a0c 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.604 2020/05/26 14:58:55 visa Exp $ */
+/* $OpenBSD: if.c,v 1.605 2020/05/27 11:19:28 mpi Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -937,7 +937,7 @@ if_input_process(struct ifnet *ifp, struct mbuf_list *ml)
*
* Since we have a NET_LOCK() we also use it to serialize access
* to PF globals, pipex globals, unicast and multicast addresses
- * lists.
+ * lists and the socket layer.
*/
NET_LOCK();
while ((m = ml_dequeue(ml)) != NULL)
@@ -2339,27 +2339,27 @@ ifioctl_get(u_long cmd, caddr_t data)
switch(cmd) {
case SIOCGIFCONF:
- NET_RLOCK();
+ NET_RLOCK_IN_IOCTL();
error = ifconf(data);
- NET_RUNLOCK();
+ NET_RUNLOCK_IN_IOCTL();
return (error);
case SIOCIFGCLONERS:
error = if_clone_list((struct if_clonereq *)data);
return (error);
case SIOCGIFGMEMB:
- NET_RLOCK();
+ NET_RLOCK_IN_IOCTL();
error = if_getgroupmembers(data);
- NET_RUNLOCK();
+ NET_RUNLOCK_IN_IOCTL();
return (error);
case SIOCGIFGATTR:
- NET_RLOCK();
+ NET_RLOCK_IN_IOCTL();
error = if_getgroupattribs(data);
- NET_RUNLOCK();
+ NET_RUNLOCK_IN_IOCTL();
return (error);
case SIOCGIFGLIST:
- NET_RLOCK();
+ NET_RLOCK_IN_IOCTL();
error = if_getgrouplist(data);
- NET_RUNLOCK();
+ NET_RUNLOCK_IN_IOCTL();
return (error);
}
@@ -2367,7 +2367,7 @@ ifioctl_get(u_long cmd, caddr_t data)
if (ifp == NULL)
return (ENXIO);
- NET_RLOCK();
+ NET_RLOCK_IN_IOCTL();
switch(cmd) {
case SIOCGIFFLAGS:
@@ -2435,7 +2435,7 @@ ifioctl_get(u_long cmd, caddr_t data)
panic("invalid ioctl %lu", cmd);
}
- NET_RUNLOCK();
+ NET_RUNLOCK_IN_IOCTL();
return (error);
}