The branch main has been updated by rscheff:

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

commit 66605ff791b12a2c3bb4570379db0e14d29fca4c
Author:     Richard Scheffenegger <[email protected]>
AuthorDate: 2022-07-14 00:49:10 +0000
Commit:     Richard Scheffenegger <[email protected]>
CommitDate: 2022-07-14 01:18:19 +0000

    tcp: Undo the increase in sequence number by 1 due to the FIN flag 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
---
 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 cd6238f10401..d2f946034c60 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -1681,8 +1681,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) {

Reply via email to