Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Feb 2023 23:48:39 GMT
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: cd4974672ad3 - stable/13 - tcp: improve handling of SYN-ACK segments in TIMEWAIT state
Message-ID:  <202302012348.311NmdPL090949@gitrepo.freebsd.org>

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

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

commit cd4974672ad3204ebb27efb623f3aabfcc2b82ef
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2022-10-03 12:46:47 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2023-02-01 23:47:53 +0000

    tcp: improve handling of SYN-ACK segments in TIMEWAIT state
    
    Only consider segments with the SYN bit set and the ACK bit cleared
    as "new connection attempts", which result in re-using a connection
    being in TIMEWAIT state. This results in consistent handling of
    SYN-ACK segments.
    
    Reviewed by:            rscheff@
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D36864
    
    (cherry picked from commit 2515552e6216095c3fa61d93ee024bb8861e07c2)
---
 sys/netinet/tcp_timewait.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c
index f15cf6dae762..86c5e62fc9b6 100644
--- a/sys/netinet/tcp_timewait.c
+++ b/sys/netinet/tcp_timewait.c
@@ -456,7 +456,8 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct tcphdr *th,
 	 * are above the previous ones.
 	 * Allow UDP port number changes in this case.
 	 */
-	if ((thflags & TH_SYN) && SEQ_GT(th->th_seq, tw->rcv_nxt)) {
+	if (((thflags & (TH_SYN | TH_ACK)) == TH_SYN) &&
+	    SEQ_GT(th->th_seq, tw->rcv_nxt)) {
 		tcp_twclose(tw, 0);
 		TCPSTAT_INC(tcps_tw_recycles);
 		return (1);



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