From: bluhm Date: Wed, 6 Sep 2023 11:09:43 +0000 (+0000) Subject: Use shared net lock for ip_send() and ip6_send(). X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=fe6e30d17e0a55eb5c1352822f1b6513b6adb59e;p=openbsd Use shared net lock for ip_send() and ip6_send(). When called with NULL options, ip_output() and ip6_output() are MP safe. Convert exclusive to shared net lock in send dispatch. OK mpi@ --- diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 31c8a8eaf54..5db74552c14 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_input.c,v 1.385 2023/05/18 09:59:43 mvs Exp $ */ +/* $OpenBSD: ip_input.c,v 1.386 2023/09/06 11:09:43 bluhm Exp $ */ /* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */ /* @@ -1851,7 +1851,7 @@ ip_send_do_dispatch(void *xmq, int flags) if (ml_empty(&ml)) return; - NET_LOCK(); + NET_LOCK_SHARED(); while ((m = ml_dequeue(&ml)) != NULL) { u_int32_t ipsecflowinfo = 0; @@ -1862,7 +1862,7 @@ ip_send_do_dispatch(void *xmq, int flags) } ip_output(m, NULL, NULL, flags, NULL, NULL, ipsecflowinfo); } - NET_UNLOCK(); + NET_UNLOCK_SHARED(); } void diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 2238a6cb6cd..be7e0010fa1 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_input.c,v 1.254 2022/08/21 14:15:55 bluhm Exp $ */ +/* $OpenBSD: ip6_input.c,v 1.255 2023/09/06 11:09:43 bluhm Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -1572,11 +1572,11 @@ ip6_send_dispatch(void *xmq) if (ml_empty(&ml)) return; - NET_LOCK(); + NET_LOCK_SHARED(); while ((m = ml_dequeue(&ml)) != NULL) { ip6_output(m, NULL, NULL, 0, NULL, NULL); } - NET_UNLOCK(); + NET_UNLOCK_SHARED(); } void