diff options
| author | 2017-11-02 14:01:18 +0000 | |
|---|---|---|
| committer | 2017-11-02 14:01:18 +0000 | |
| commit | 2c5f89aa3af53cc28e3d36f3b88d081fdaa44cd6 (patch) | |
| tree | c0892e6bfb20622cb3cc7c002ada827897782f83 /sys/netinet/udp_usrreq.c | |
| parent | Check if the arguments are NULL instead of dereferencing them blindly. (diff) | |
| download | wireguard-openbsd-2c5f89aa3af53cc28e3d36f3b88d081fdaa44cd6.tar.xz wireguard-openbsd-2c5f89aa3af53cc28e3d36f3b88d081fdaa44cd6.zip | |
Move PRU_DETACH out of pr_usrreq into per proto pr_detach
functions to pave way for more fine grained locking.
Suggested by, comments & OK mpi
Diffstat (limited to 'sys/netinet/udp_usrreq.c')
| -rw-r--r-- | sys/netinet/udp_usrreq.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 95b093bee58..f49f800fca8 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udp_usrreq.c,v 1.241 2017/10/09 08:35:38 mpi Exp $ */ +/* $OpenBSD: udp_usrreq.c,v 1.242 2017/11/02 14:01:18 florian Exp $ */ /* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */ /* @@ -1085,10 +1085,6 @@ udp_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *addr, */ switch (req) { - case PRU_DETACH: - in_pcbdetach(inp); - break; - case PRU_BIND: error = in_pcbbind(inp, addr, p); break; @@ -1270,6 +1266,21 @@ udp_attach(struct socket *so, int proto) return 0; } +int +udp_detach(struct socket *so) +{ + struct inpcb *inp; + + soassertlocked(so); + + inp = sotoinpcb(so); + if (inp == NULL) + return (EINVAL); + + in_pcbdetach(inp); + return (0); +} + /* * Sysctl for udp variables. */ |
