git: a8e817cf5c9c - main - tcp: stop doing superfluous work after sending RST
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 10 Feb 2024 09:34:00 UTC
The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=a8e817cf5c9c6e34357e0c078a256e2526b9da53 commit a8e817cf5c9c6e34357e0c078a256e2526b9da53 Author: Richard Scheffenegger <rscheff@FreeBSD.org> AuthorDate: 2024-02-10 09:24:10 +0000 Commit: Richard Scheffenegger <rscheff@FreeBSD.org> CommitDate: 2024-02-10 09:25:02 +0000 tcp: stop doing superfluous work after sending RST When sending a RST control segment in tcp_output() it means we are in TCPS_CLOSED state, called from tcp_drop(). Once the RST is sent, don't call tcp_timer_activate() or update anything in tcpcb, since that will go away shortly. PR: 276761 Provided by: glebius Reviewed By: glebius, tuexen, #transport Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D43808 --- sys/netinet/tcp_output.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index 50dc05e9c55a..26a8ed70ceff 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -1516,9 +1516,13 @@ out: tcp_account_for_send(tp, len, (tp->snd_nxt != tp->snd_max), 0, hw_tls); /* * In transmit state, time the transmission and arrange for - * the retransmit. In persist state, just set snd_max. + * the retransmit. In persist state, just set snd_max. In a closed + * state just return. */ - if ((tp->t_flags & TF_FORCEDATA) == 0 || + if (flags & TH_RST) { + TCPSTAT_INC(tcps_sndtotal); + return (0); + } else if ((tp->t_flags & TF_FORCEDATA) == 0 || !tcp_timer_active(tp, TT_PERSIST)) { tcp_seq startseq = tp->snd_nxt;