summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_socket.c
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2017-03-13 20:18:21 +0000
committerclaudio <claudio@openbsd.org>2017-03-13 20:18:21 +0000
commit3d7f610ca455928a1a6266ec779dbfc0c033fe19 (patch)
tree38477a0682053bcaa34bd606f2a7d94c05b5153d /sys/kern/uipc_socket.c
parentPrint title="..." in addition to id="..." attributes for macro keys (diff)
downloadwireguard-openbsd-3d7f610ca455928a1a6266ec779dbfc0c033fe19.tar.xz
wireguard-openbsd-3d7f610ca455928a1a6266ec779dbfc0c033fe19.zip
Move PRU_ATTACH out of the pr_usrreq functions into pr_attach.
Attach is quite a different thing to the other PRU functions and this should make locking a bit simpler. This also removes the ugly hack on how proto was passed to the attach function. OK bluhm@ and mpi@ on a previous version
Diffstat (limited to 'sys/kern/uipc_socket.c')
-rw-r--r--sys/kern/uipc_socket.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 93162a4e256..1bb5874d1fa 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket.c,v 1.179 2017/03/07 09:23:27 mpi Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.180 2017/03/13 20:18:21 claudio Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@@ -119,7 +119,7 @@ socreate(int dom, struct socket **aso, int type, int proto)
prp = pffindproto(dom, proto, type);
else
prp = pffindtype(dom, type);
- if (prp == NULL || prp->pr_usrreq == 0)
+ if (prp == NULL || prp->pr_attach == NULL)
return (EPROTONOSUPPORT);
if (prp->pr_type != type)
return (EPROTOTYPE);
@@ -135,9 +135,9 @@ socreate(int dom, struct socket **aso, int type, int proto)
so->so_egid = p->p_ucred->cr_gid;
so->so_cpid = p->p_p->ps_pid;
so->so_proto = prp;
+
s = solock(so);
- error = (*prp->pr_usrreq)(so, PRU_ATTACH, NULL,
- (struct mbuf *)(long)proto, NULL, p);
+ error = (*prp->pr_attach)(so, proto);
if (error) {
so->so_state |= SS_NOFDREF;
sofree(so);