summaryrefslogtreecommitdiff
path: root/sys/netinet/ip_divert.c
diff options
context:
space:
mode:
authorVitaliy Makkoveev <mvs@cvs.openbsd.org>2022-08-27 20:28:02 +0000
committerVitaliy Makkoveev <mvs@cvs.openbsd.org>2022-08-27 20:28:02 +0000
commitcc56cf1e37947acee4384e248999b963238d3c9a (patch)
treee91fa35fe93da5b30a9a13f96a1394ea94973e64 /sys/netinet/ip_divert.c
parent85540f4cb5ed157c05c8a2d1e66aa31940d3b0d0 (diff)
Move PRU_SEND request to (*pru_send)().
The former PRU_SEND error path of gre_usrreq() had `control' mbuf(9) leak. It was fixed in new gre_send(). The former pfkeyv2_send() was renamed to pfkeyv2_dosend(). ok bluhm@
Diffstat (limited to 'sys/netinet/ip_divert.c')
-rw-r--r--sys/netinet/ip_divert.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c
index bb2b637fe83..11583387f61 100644
--- a/sys/netinet/ip_divert.c
+++ b/sys/netinet/ip_divert.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_divert.c,v 1.77 2022/08/26 16:17:39 mvs Exp $ */
+/* $OpenBSD: ip_divert.c,v 1.78 2022/08/27 20:28:01 mvs Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -68,6 +68,7 @@ const struct pr_usrreqs divert_usrreqs = {
.pru_detach = divert_detach,
.pru_bind = divert_bind,
.pru_shutdown = divert_shutdown,
+ .pru_send = divert_send,
};
int divbhashsize = DIVERTHASHSIZE;
@@ -269,9 +270,6 @@ divert_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *addr,
}
switch (req) {
- case PRU_SEND:
- return (divert_output(inp, m, addr, control));
-
case PRU_ABORT:
soisdisconnected(so);
in_pcbdetach(inp);
@@ -364,6 +362,16 @@ divert_shutdown(struct socket *so)
}
int
+divert_send(struct socket *so, struct mbuf *m, struct mbuf *addr,
+ struct mbuf *control)
+{
+ struct inpcb *inp = sotoinpcb(so);
+
+ soassertlocked(so);
+ return (divert_output(inp, m, addr, control));
+}
+
+int
divert_sysctl_divstat(void *oldp, size_t *oldlenp, void *newp)
{
uint64_t counters[divs_ncounters];