git: 2f923a0cedb8 - main - tcp rack: improve handling of front states

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Sat, 11 May 2024 14:34:24 UTC
The branch main has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=2f923a0cedb8db9b8bd042c5b457dee6333604fe

commit 2f923a0cedb8db9b8bd042c5b457dee6333604fe
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2024-05-11 14:28:45 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2024-05-11 14:28:45 +0000

    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 49758072c6a1..b0d0f94b8f0e 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