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/ip6_divert.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/ip6_divert.c')
-rw-r--r-- | sys/netinet6/ip6_divert.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/sys/netinet6/ip6_divert.c b/sys/netinet6/ip6_divert.c index 1f20dc64d83..e41e734733c 100644 --- a/sys/netinet6/ip6_divert.c +++ b/sys/netinet6/ip6_divert.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_divert.c,v 1.54 2017/10/09 08:35:38 mpi Exp $ */ +/* $OpenBSD: ip6_divert.c,v 1.55 2017/11/02 14:01:18 florian Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -257,10 +257,6 @@ divert6_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; @@ -338,6 +334,21 @@ divert6_attach(struct socket *so, int proto) } int +divert6_detach(struct socket *so) +{ + struct inpcb *inp = sotoinpcb(so); + + soassertlocked(so); + + if (inp == NULL) + return (EINVAL); + + in_pcbdetach(inp); + + return (0); +} + +int divert6_sysctl_div6stat(void *oldp, size_t *oldlenp, void *newp) { uint64_t counters[div6s_ncounters]; |