summaryrefslogtreecommitdiffstats
path: root/sys/netinet6/ip6_input.c
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2016-12-19 08:36:49 +0000
committermpi <mpi@openbsd.org>2016-12-19 08:36:49 +0000
commit2b4720fc1ab1c786a246ad8a4a02064649d7c635 (patch)
treeaf02cdfe86f481705c092e14a90d4f5c242979a6 /sys/netinet6/ip6_input.c
parentfix uninitialised variable warnings from clang (diff)
downloadwireguard-openbsd-2b4720fc1ab1c786a246ad8a4a02064649d7c635.tar.xz
wireguard-openbsd-2b4720fc1ab1c786a246ad8a4a02064649d7c635.zip
Introduce the NET_LOCK() a rwlock used to serialize accesses to the parts
of the network stack that are not yet ready to be executed in parallel or where new sleeping points are not possible. This first pass replace all the entry points leading to ip_output(). This is done to not introduce new sleeping points when trying to acquire ART's write lock, needed when a new L2 entry is created via the RT_RESOLVE. Inputs from and ok bluhm@, ok dlg@
Diffstat (limited to 'sys/netinet6/ip6_input.c')
-rw-r--r--sys/netinet6/ip6_input.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c
index 6523fe0803f..3643cedd8ea 100644
--- a/sys/netinet6/ip6_input.c
+++ b/sys/netinet6/ip6_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_input.c,v 1.170 2016/11/28 10:10:53 mpi Exp $ */
+/* $OpenBSD: ip6_input.c,v 1.171 2016/12/19 08:36:50 mpi Exp $ */
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
/*
@@ -1437,12 +1437,15 @@ ip6_send_dispatch(void *xmq)
int s;
mq_delist(mq, &ml);
+ if (ml_empty(&ml))
+ return;
+
KERNEL_LOCK();
- s = splsoftnet();
+ NET_LOCK(s);
while ((m = ml_dequeue(&ml)) != NULL) {
ip6_output(m, NULL, NULL, IPV6_MINMTU, NULL, NULL);
}
- splx(s);
+ NET_UNLOCK(s);
KERNEL_UNLOCK();
}