git: ea5560f2293b - stable/14 - tcp: increase tcps_sc_recvcookie only in the syncache_expand()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 09 Sep 2025 18:06:41 UTC
The branch stable/14 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=ea5560f2293b9f2c69f62cba6b122c91b0b8eb3b commit ea5560f2293b9f2c69f62cba6b122c91b0b8eb3b Author: Gleb Smirnoff <glebius@FreeBSD.org> AuthorDate: 2025-06-17 15:50:17 +0000 Commit: Michael Tuexen <tuexen@FreeBSD.org> CommitDate: 2025-09-09 18:06:19 +0000 tcp: increase tcps_sc_recvcookie only in the syncache_expand() The syncookie_expand() is called from syncookie_cmp() in INVARIANTS mode to confirm that values calculated via syncookies mechanism match those stored in the syncache entry. This creates a counting bug, that with INVARIANTS every successful use of syncache also counts as use of a syncookie. Reviewed by: tuexen Differential Revision: https://reviews.freebsd.org/D50897 (cherry picked from commit 3ed8d5645dd42a7c080ba800cf6d25cb7e147d7e) --- sys/netinet/tcp_syncache.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c index c7da8a41242e..b50d6e9ea84e 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -1123,8 +1123,10 @@ syncache_expand(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th, goto failed; } bzero(&scs, sizeof(scs)); - if (syncookie_expand(inc, sch, &scs, th, to, *lsop, port)) + if (syncookie_expand(inc, sch, &scs, th, to, *lsop, port)) { sc = &scs; + TCPSTAT_INC(tcps_sc_recvcookie); + } if (locked) SCH_UNLOCK(sch); if (sc == NULL) { @@ -2355,7 +2357,6 @@ syncookie_expand(struct in_conninfo *inc, const struct syncache_head *sch, sc->sc_port = port; - TCPSTAT_INC(tcps_sc_recvcookie); return (true); }