diff options
author | Vitaliy Makkoveev <mvs@cvs.openbsd.org> | 2022-08-27 20:28:02 +0000 |
---|---|---|
committer | Vitaliy Makkoveev <mvs@cvs.openbsd.org> | 2022-08-27 20:28:02 +0000 |
commit | cc56cf1e37947acee4384e248999b963238d3c9a (patch) | |
tree | e91fa35fe93da5b30a9a13f96a1394ea94973e64 /sys/netinet/tcp_usrreq.c | |
parent | 85540f4cb5ed157c05c8a2d1e66aa31940d3b0d0 (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/tcp_usrreq.c')
-rw-r--r-- | sys/netinet/tcp_usrreq.c | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 7c473d51146..af327f2bd56 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_usrreq.c,v 1.195 2022/08/26 16:17:39 mvs Exp $ */ +/* $OpenBSD: tcp_usrreq.c,v 1.196 2022/08/27 20:28:01 mvs Exp $ */ /* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */ /* @@ -122,6 +122,7 @@ const struct pr_usrreqs tcp_usrreqs = { .pru_disconnect = tcp_disconnect, .pru_shutdown = tcp_shutdown, .pru_rcvd = tcp_rcvd, + .pru_send = tcp_send, }; static int pr_slowhz = PR_SLOWHZ; @@ -226,15 +227,6 @@ tcp_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, break; /* - * Do a send by putting data in output queue and updating urgent - * marker if URG set. Possibly send more data. - */ - case PRU_SEND: - sbappendstream(so, &so->so_snd, m); - error = tcp_output(tp); - break; - - /* * Abort the TCP. */ case PRU_ABORT: @@ -935,6 +927,42 @@ tcp_rcvd(struct socket *so) } /* + * Do a send by putting data in output queue and updating urgent + * marker if URG set. Possibly send more data. + */ +int +tcp_send(struct socket *so, struct mbuf *m, struct mbuf *nam, + struct mbuf *control) +{ + struct inpcb *inp; + struct tcpcb *tp; + int error; + short ostate; + + soassertlocked(so); + + if ((error = tcp_sogetpcb(so, &inp, &tp))) + goto out; + + if (so->so_options & SO_DEBUG) + ostate = tp->t_state; + + sbappendstream(so, &so->so_snd, m); + m = NULL; + + error = tcp_output(tp); + + if (so->so_options & SO_DEBUG) + tcp_trace(TA_USER, ostate, tp, tp, NULL, PRU_SEND, 0); + +out: + m_freem(control); + m_freem(m); + + return (error); +} + +/* * Initiate (or continue) disconnect. * If embryonic state, just send reset (once). * If in ``let data drain'' option and linger null, just drop. |