aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Scheffenegger <rscheff@FreeBSD.org>2022-07-14 00:49:10 +0000
committerRichard Scheffenegger <rscheff@FreeBSD.org>2024-01-11 00:38:36 +0000
commitd730ffcd6ad3da47d9a1af00a534a78861280f54 (patch)
tree9eaa789ebd7742d3e25a2d4ac858e2fa0d23a7bb
parent1165116ada353364e1d1570d1d23bb3d18d28394 (diff)
downloadsrc-d730ffcd6ad3da47d9a1af00a534a78861280f54.tar.gz
src-d730ffcd6ad3da47d9a1af00a534a78861280f54.zip
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)
-rw-r--r--sys/netinet/tcp_output.c7
1 files changed, 6 insertions, 1 deletions
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) {