diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2017-11-02 14:01:19 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2017-11-02 14:01:19 +0000 |
commit | 263c04e1bde3d1faacc0c2054395ce503cb8aaba (patch) | |
tree | 5b7c1d09c54db9a030990e551146b261d49c426f /sys/netinet/raw_ip.c | |
parent | ccad25ba8977c4d9f2c8d78763d09e00ab0068e5 (diff) |
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/raw_ip.c')
-rw-r--r-- | sys/netinet/raw_ip.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index 3e4af999eea..775b8a32ed4 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raw_ip.c,v 1.104 2017/10/06 21:14:55 bluhm Exp $ */ +/* $OpenBSD: raw_ip.c,v 1.105 2017/11/02 14:01:18 florian Exp $ */ /* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */ /* @@ -382,10 +382,8 @@ rip_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, /* FALLTHROUGH */ case PRU_ABORT: soisdisconnected(so); - /* FALLTHROUGH */ - case PRU_DETACH: if (inp == NULL) - panic("rip_detach"); + panic("rip_abort"); #ifdef MROUTING if (so == ip_mrouter[inp->inp_rtableid]) ip_mrouter_done(so); @@ -522,3 +520,22 @@ rip_attach(struct socket *so, int proto) inp->inp_ip.ip_p = proto; return 0; } + +int +rip_detach(struct socket *so) +{ + struct inpcb *inp = sotoinpcb(so); + + soassertlocked(so); + + if (inp == NULL) + return (EINVAL); + +#ifdef MROUTING + if (so == ip_mrouter[inp->inp_rtableid]) + ip_mrouter_done(so); +#endif + in_pcbdetach(inp); + + return (0); +} |