diff options
author | Michael Tuexen <tuexen@FreeBSD.org> | 2024-08-22 20:17:05 +0000 |
---|---|---|
committer | Michael Tuexen <tuexen@FreeBSD.org> | 2024-08-22 20:17:05 +0000 |
commit | e41364711ca3f7e214f9607ebedf62e03e51633d (patch) | |
tree | 90b4af591130b67d6258b870f669f247c11c1011 | |
parent | 8afae0caf4c4816eb56b732fcd1a4b185e86098a (diff) | |
download | src-e41364711ca3f7e214f9607ebedf62e03e51633d.tar.gz src-e41364711ca3f7e214f9607ebedf62e03e51633d.zip |
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
-rw-r--r-- | sys/netinet/tcp_syncache.c | 4 |
1 files changed, 1 insertions, 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); |