summaryrefslogtreecommitdiff
path: root/sys/netinet/ip_divert.c
diff options
context:
space:
mode:
authorVitaliy Makkoveev <mvs@cvs.openbsd.org>2022-08-20 23:48:59 +0000
committerVitaliy Makkoveev <mvs@cvs.openbsd.org>2022-08-20 23:48:59 +0000
commit76161c54839f8357fa21570c80b34c0e4c85e734 (patch)
treebee47fc97862ea9cae0230e1b2e22d20b1f80ba2 /sys/netinet/ip_divert.c
parent645a3a4b5060642d99ad9e7574c8014c6f1dfc27 (diff)
Move PRU_BIND request to (*pru_bind)() handler.
For the protocols which don't support request, leave handler NULL. Do the NULL check within corresponding pru_() wrapper and return EOPNOTSUPP in such case. This will be done for all upcoming user request handlers. ok bluhm@ guenther@
Diffstat (limited to 'sys/netinet/ip_divert.c')
-rw-r--r--sys/netinet/ip_divert.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c
index f5825f554c3..b843fc96bf4 100644
--- a/sys/netinet/ip_divert.c
+++ b/sys/netinet/ip_divert.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_divert.c,v 1.69 2022/08/15 09:11:39 mvs Exp $ */
+/* $OpenBSD: ip_divert.c,v 1.70 2022/08/20 23:48:58 mvs Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -66,6 +66,7 @@ const struct pr_usrreqs divert_usrreqs = {
.pru_usrreq = divert_usrreq,
.pru_attach = divert_attach,
.pru_detach = divert_detach,
+ .pru_bind = divert_bind,
};
int divbhashsize = DIVERTHASHSIZE;
@@ -274,10 +275,6 @@ divert_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *addr,
}
switch (req) {
- case PRU_BIND:
- error = in_pcbbind(inp, addr, p);
- break;
-
case PRU_SHUTDOWN:
socantsendmore(so);
break;
@@ -365,6 +362,15 @@ divert_detach(struct socket *so)
}
int
+divert_bind(struct socket *so, struct mbuf *addr, struct proc *p)
+{
+ struct inpcb *inp = sotoinpcb(so);
+
+ soassertlocked(so);
+ return in_pcbbind(inp, addr, p);
+}
+
+int
divert_sysctl_divstat(void *oldp, size_t *oldlenp, void *newp)
{
uint64_t counters[divs_ncounters];