Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jan 2024 00:41:27 GMT
From:      Richard Scheffenegger <rscheff@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: d730ffcd6ad3 - stable/13 - tcp: Undo the consumption of sequence space by FIN in case of a transient error.
Message-ID:  <202401110041.40B0fRTx013170@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by rscheff:

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

commit d730ffcd6ad3da47d9a1af00a534a78861280f54
Author:     Richard Scheffenegger <rscheff@FreeBSD.org>
AuthorDate: 2022-07-14 00:49:10 +0000
Commit:     Richard Scheffenegger <rscheff@FreeBSD.org>
CommitDate: 2024-01-11 00:38:36 +0000

    tcp: Undo the consumption of sequence space by FIN in case of a transient error.
    
    If an error occurs while processing a TCP segment with some data and the FIN
    flag, the back out of the sequence number advance does not take into account the
    increase by 1 due to the FIN flag.
    
    Reviewed By: jch, gnn, #transport, tuexen
    Sponsored by: NetApp, Inc.
    Differential Revision: https://reviews.freebsd.org/D2970
    
    (cherry picked from commit 66605ff791b12a2c3bb4570379db0e14d29fca4c)
---
 sys/netinet/tcp_output.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c
index 3ed4d34fd061..3e1a2320f331 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -1684,8 +1684,13 @@ timer:
 				tp->sackhint.sack_bytes_rexmit -= len;
 				KASSERT(tp->sackhint.sack_bytes_rexmit >= 0,
 				    ("sackhint bytes rtx >= 0"));
-			} else
+				KASSERT((flags & TH_FIN) == 0,
+				    ("error while FIN with SACK rxmit"));
+			} else {
 				tp->snd_nxt -= len;
+				if (flags & TH_FIN)
+					tp->snd_nxt--;
+			}
 		}
 		SOCKBUF_UNLOCK_ASSERT(&so->so_snd);	/* Check gotos. */
 		switch (error) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401110041.40B0fRTx013170>