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/netinet6/raw_ip6.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/netinet6/raw_ip6.c')
-rw-r--r-- | sys/netinet6/raw_ip6.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index c201852c69e..70461915c2e 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raw_ip6.c,v 1.121 2017/10/08 14:53:25 deraadt Exp $ */ +/* $OpenBSD: raw_ip6.c,v 1.122 2017/11/02 14:01:18 florian Exp $ */ /* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */ /* @@ -558,8 +558,6 @@ rip6_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, case PRU_ABORT: soisdisconnected(so); - /* FALLTHROUGH */ - case PRU_DETACH: if (in6p == NULL) panic("rip6_detach"); #ifdef MROUTING @@ -716,6 +714,27 @@ rip6_attach(struct socket *so, int proto) } int +rip6_detach(struct socket *so) +{ + struct inpcb *in6p = sotoinpcb(so); + + soassertlocked(so); + + if (in6p == NULL) + panic("rip6_detach"); +#ifdef MROUTING + if (so == ip6_mrouter[in6p->inp_rtableid]) + ip6_mrouter_done(so); +#endif + free(in6p->inp_icmp6filt, M_PCB, sizeof(struct icmp6_filter)); + in6p->inp_icmp6filt = NULL; + + in_pcbdetach(in6p); + + return (0); +} + +int rip6_sysctl_rip6stat(void *oldp, size_t *oldplen, void *newp) { struct rip6stat rip6stat; |