Date: Fri, 30 Aug 2024 06:46:50 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: c467031b6143 - stable/13 - tcp: improve consistency of SYN-cache handling Message-ID: <202408300646.47U6kog3075129@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=c467031b6143cffae3260812eed4951352567297 commit c467031b6143cffae3260812eed4951352567297 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:45:44 +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 ea5ee033f6e0..54f7f4784490 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -1761,9 +1761,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?202408300646.47U6kog3075129>