Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Aug 2024 06:31:19 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: 6c0fb6c5ac7b - stable/14 - tcp: improve consistency of SYN-cache handling
Message-ID:  <202408300631.47U6VJir051620@gitrepo.freebsd.org>

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

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

commit 6c0fb6c5ac7b3319ac823ef279b12a21604cf84a
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2024-08-22 20:17:05 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2024-08-30 06:30:54 +0000

    tcp: improve consistency of SYN-cache handling
    
    Originally, a SYN-cache entry was always allocated and later freed,
    when not needed anymore. Then the allocation was avoided, when no
    SYN-cache entry was needed, and a copy on the stack was used.
    But the logic regarding freeing was not updated.
    This patch doesn't re-check conditions (which may have changed) when
    deciding to insert or free the entry, but uses the result of
    the earlier check.
    This simplifies the code and improves also consistency.
    
    Reviewed by:            glebius
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D46410
    
    (cherry picked from commit e41364711ca3f7e214f9607ebedf62e03e51633d)
---
 sys/netinet/tcp_syncache.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
index 052e257a3cb5..287728fe9162 100644
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -1730,9 +1730,7 @@ skip_alloc:
 	 * Do a standard 3-way handshake.
 	 */
 	if (syncache_respond(sc, m, TH_SYN|TH_ACK) == 0) {
-		if (V_tcp_syncookies && V_tcp_syncookiesonly && sc != &scs)
-			syncache_free(sc);
-		else if (sc != &scs)
+		if (sc != &scs)
 			syncache_insert(sc, sch);   /* locks and unlocks sch */
 		TCPSTAT_INC(tcps_sndacks);
 		TCPSTAT_INC(tcps_sndtotal);



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