summaryrefslogtreecommitdiff
path: root/sys/netinet/udp_usrreq.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/udp_usrreq.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/udp_usrreq.c')
-rw-r--r--sys/netinet/udp_usrreq.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 0f7dcac974a..06a1252ae72 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udp_usrreq.c,v 1.282 2022/08/15 09:11:39 mvs Exp $ */
+/* $OpenBSD: udp_usrreq.c,v 1.283 2022/08/20 23:48:58 mvs Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */
/*
@@ -126,6 +126,7 @@ const struct pr_usrreqs udp_usrreqs = {
.pru_usrreq = udp_usrreq,
.pru_attach = udp_attach,
.pru_detach = udp_detach,
+ .pru_bind = udp_bind,
};
const struct sysctl_bounded_args udpctl_vars[] = {
@@ -1074,10 +1075,6 @@ udp_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_LISTEN:
error = EOPNOTSUPP;
break;
@@ -1275,6 +1272,15 @@ udp_detach(struct socket *so)
return (0);
}
+int
+udp_bind(struct socket *so, struct mbuf *addr, struct proc *p)
+{
+ struct inpcb *inp = sotoinpcb(so);
+
+ soassertlocked(so);
+ return in_pcbbind(inp, addr, p);
+}
+
/*
* Sysctl for udp variables.
*/