diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2017-05-27 18:50:54 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2017-05-27 18:50:54 +0000 |
commit | 34d9c708a48dc0063042b79688c796d7319ac8d1 (patch) | |
tree | 826104955ed236967f1f197cf810e29ffbf779cc /sys/kern | |
parent | 0fd2ceb34880ceebcf665b361f68b2cba04f090f (diff) |
Push the NET_LOCK down into PF_KEY so that it can be treated like PF_ROUTE.
Only pfkeyv2_send() needs the NET_LOCK() so grab it at the start and release
at the end. This should allow to push the locks down in other places.
OK mpi@, bluhm@
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/uipc_socket.c | 5 | ||||
-rw-r--r-- | sys/kern/uipc_socket2.c | 11 |
2 files changed, 10 insertions, 6 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 29323e8a41f..6003a4661c1 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket.c,v 1.184 2017/05/15 13:00:10 mpi Exp $ */ +/* $OpenBSD: uipc_socket.c,v 1.185 2017/05/27 18:50:53 claudio Exp $ */ /* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */ /* @@ -1043,7 +1043,8 @@ sorflush(struct socket *so) sb->sb_flags |= SB_NOINTR; sblock(sb, M_WAITOK, - (af != PF_LOCAL && af != PF_ROUTE) ? &netlock : NULL); + (af != PF_LOCAL && af != PF_ROUTE && af != PF_KEY) ? + &netlock : NULL); socantrcvmore(so); sbunlock(sb); asb = *sb; diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c index 4ef71d5c6ca..235a20059a9 100644 --- a/sys/kern/uipc_socket2.c +++ b/sys/kern/uipc_socket2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket2.c,v 1.76 2017/05/15 12:26:00 mpi Exp $ */ +/* $OpenBSD: uipc_socket2.c,v 1.77 2017/05/27 18:50:53 claudio Exp $ */ /* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */ /* @@ -273,7 +273,8 @@ solock(struct socket *so) int s; if ((so->so_proto->pr_domain->dom_family != PF_LOCAL) && - (so->so_proto->pr_domain->dom_family != PF_ROUTE)) + (so->so_proto->pr_domain->dom_family != PF_ROUTE) && + (so->so_proto->pr_domain->dom_family != PF_KEY)) NET_LOCK(s); else s = -42; @@ -292,7 +293,8 @@ void soassertlocked(struct socket *so) { if ((so->so_proto->pr_domain->dom_family != PF_LOCAL) && - (so->so_proto->pr_domain->dom_family != PF_ROUTE)) + (so->so_proto->pr_domain->dom_family != PF_ROUTE) && + (so->so_proto->pr_domain->dom_family != PF_KEY)) NET_ASSERT_LOCKED(); } @@ -300,7 +302,8 @@ int sosleep(struct socket *so, void *ident, int prio, const char *wmesg, int timo) { if ((so->so_proto->pr_domain->dom_family != PF_LOCAL) && - (so->so_proto->pr_domain->dom_family != PF_ROUTE)) { + (so->so_proto->pr_domain->dom_family != PF_ROUTE) && + (so->so_proto->pr_domain->dom_family != PF_KEY)) { return rwsleep(ident, &netlock, prio, wmesg, timo); } else return tsleep(ident, prio, wmesg, timo); |