git: e41364711ca3 - main - tcp: improve consistency of SYN-cache handling
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 22 Aug 2024 20:21:05 UTC
The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=e41364711ca3f7e214f9607ebedf62e03e51633d commit e41364711ca3f7e214f9607ebedf62e03e51633d Author: Michael Tuexen <tuexen@FreeBSD.org> AuthorDate: 2024-08-22 20:17:05 +0000 Commit: Michael Tuexen <tuexen@FreeBSD.org> CommitDate: 2024-08-22 20:17:05 +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 MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D46410 --- 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 025b071eb1ca..33a6a66b7138 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -1720,9 +1720,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);