From 2f923a0cedb8db9b8bd042c5b457dee6333604fe Mon Sep 17 00:00:00 2001 From: Michael Tuexen Date: Sat, 11 May 2024 16:28:45 +0200 Subject: [PATCH] tcp rack: improve handling of front states When the RACK stack wants to send a FIN, but still has outstanding or unsent data, it sends a challenge ack. Don't do this when the TCP endpoint is still in the front states, since it does not make sense. Reviewed by: rrs MFC after: 3 days Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D45122 --- sys/netinet/tcp_stacks/rack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 49758072c6a..b0d0f94b8f0 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -22776,7 +22776,8 @@ send: * is acked first. */ flags &= ~TH_FIN; - if ((sbused(sb) == (tp->snd_max - tp->snd_una)) && + if (TCPS_HAVEESTABLISHED(tp->t_state) && + (sbused(sb) == (tp->snd_max - tp->snd_una)) && ((tp->snd_max - tp->snd_una) <= segsiz)) { /* * Ok less than or right at a MSS is