From nobody Tue Sep 9 18:05:51 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4cLsFD1TxPz67FDm; Tue, 09 Sep 2025 18:05:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cLsFD0lFwz3g3v; Tue, 09 Sep 2025 18:05:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757441152; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HW837D41tlmhCFin685/CKGqn41QVb9JJl9u8g7sPS8=; b=hRLV/8twDRct13REmnuLuPPs9Q5MS56Q2KGUmVYHu0f+8Azjgjchz0umQr84JatZP7eY07 QumbqtH1krQmlpO6XvzpbOK3wiWr5bL9xw8O960KaOicESMNsElMqEOyVTZXwBHg9mV5Ej hmnhEqvChQevw3Ch4oUky+fzaKuFSJgpkZXm/BzdXQ4+FWaXo4pJJqHpNV5fZINTKjY270 9CU8iJsexmdqPKS6+z6JJyyYq3RuhyRcSFeqMtKjR9hKPpqvCd5VDcMewlYCxliDvG3tHc XuN0ViOWHq2dHwuUexyzuJHSGzCZBGZkZ8XDbCHVM5dLRwseFYaofuMei8ay/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757441152; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HW837D41tlmhCFin685/CKGqn41QVb9JJl9u8g7sPS8=; b=QeayVQGxGnY7oB+KxK79NOZZdF452eEtkhL9cIJNRyIHpkVgp1W5aPXzDPqWrZ4Qq8jagW IHG+LjTa71Iw+WXb8Vpf1ymtFKSvJykHMpagB/6pXpBHQWzTu7IKvxMj6d4WHOV+dq/mki +xZ5vYNcvplcZqTALN3iZ+cww2M4fd8Yob9+3L8NQU5IiodWPfCUpOXd6E6dxokitcLVY7 GIMIRAhe2/PiryrA6bfAwYhQuBG9fw3NPsCe82lXheDFlZWqNVkU0FvhNLvZ07SeJKjZCD txvw80Aptm05LTKlkhZCsWVEDnRVZKuGHXLsT54HDOr9QwwqlpFueFrGx1G2UQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1757441152; a=rsa-sha256; cv=none; b=GKLQUebhVQU7hyjxNo4x1zdARb9z0zKQAsqPZONRElJARZz6KNEY2MXWA89Za8ItrEPU+w 4RXsuAExesMPy9/DMD9jUs5rMvnuhYD8rSoNN9QwtqeCP/lLVjZQU93X0CfELEMew3lTv6 eh5ZFT3y+lwzINm+TxavnddWWHmYyaWyBwdmcpZ+TEY32i8Ygx/u2/HEQS/CGgUP9tTkhD hc1Z5YQGXesQXzzxQljQFV3O7KgNL7yZxw+R8Tgr0QdInzFkdk6lnZ5MJu/Ny2vwnyt39x cJk36tHcfhxzD93pTUnUEMa/N4ui6o05Q3b7oOojPg8+KDIlHpyEi9BeRZyWPg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cLsFD05nKzn73; Tue, 09 Sep 2025 18:05:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 589I5pNs085159; Tue, 9 Sep 2025 18:05:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 589I5pMI085156; Tue, 9 Sep 2025 18:05:51 GMT (envelope-from git) Date: Tue, 9 Sep 2025 18:05:51 GMT Message-Id: <202509091805.589I5pMI085156@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: f5d8084a8d5c - stable/14 - tcp: refactor debug function syncookie_cmp() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: f5d8084a8d5cb01de66f8e3c49597c05d79edca4 Auto-Submitted: auto-generated The branch stable/14 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=f5d8084a8d5cb01de66f8e3c49597c05d79edca4 commit f5d8084a8d5cb01de66f8e3c49597c05d79edca4 Author: Gleb Smirnoff AuthorDate: 2025-06-17 15:50:08 +0000 Commit: Michael Tuexen CommitDate: 2025-09-09 18:05:24 +0000 tcp: refactor debug function syncookie_cmp() - Don't bzero() the test structure. All fields checked are set by syncache_expand(). - Don't allocate TCP address logging string if there is nothing to report. - Mark hash bucket argument as pointer to const. - Make it void. Differential Revision: https://reviews.freebsd.org/D50896 (cherry picked from commit e9e6a025b4523c9aa2885e892495601964e03056) --- sys/netinet/tcp_syncache.c | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c index 89d3f95601c9..c7da8a41242e 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -147,9 +147,10 @@ static void syncache_pause(struct in_conninfo *); static void syncache_unpause(void *); static void syncookie_reseed(void *); #ifdef INVARIANTS -static int syncookie_cmp(struct in_conninfo *inc, struct syncache_head *sch, - struct syncache *sc, struct tcphdr *th, struct tcpopt *to, - struct socket *lso, uint16_t port); +static void syncookie_cmp(struct in_conninfo *, + const struct syncache_head *, struct syncache *, + struct tcphdr *, struct tcpopt *, struct socket *, + uint16_t); #endif /* @@ -2359,43 +2360,43 @@ syncookie_expand(struct in_conninfo *inc, const struct syncache_head *sch, } #ifdef INVARIANTS -static int -syncookie_cmp(struct in_conninfo *inc, struct syncache_head *sch, +static void +syncookie_cmp(struct in_conninfo *inc, const struct syncache_head *sch, struct syncache *sc, struct tcphdr *th, struct tcpopt *to, struct socket *lso, uint16_t port) { - struct syncache scs, *scx = NULL; + struct syncache scs; char *s; bzero(&scs, sizeof(scs)); - if (syncookie_expand(inc, sch, &scs, th, to, lso, port)) - scx = &scs; + if (syncookie_expand(inc, sch, &scs, th, to, lso, port) && + (sc->sc_peer_mss != scs.sc_peer_mss || + sc->sc_requested_r_scale != scs.sc_requested_r_scale || + sc->sc_requested_s_scale != scs.sc_requested_s_scale || + (sc->sc_flags & SCF_SACK) != (scs.sc_flags & SCF_SACK))) { - if ((s = tcp_log_addrs(inc, th, NULL, NULL)) == NULL) - return (0); + if ((s = tcp_log_addrs(inc, th, NULL, NULL)) == NULL) + return; - if (scx != NULL) { - if (sc->sc_peer_mss != scx->sc_peer_mss) + if (sc->sc_peer_mss != scs.sc_peer_mss) log(LOG_DEBUG, "%s; %s: mss different %i vs %i\n", - s, __func__, sc->sc_peer_mss, scx->sc_peer_mss); + s, __func__, sc->sc_peer_mss, scs.sc_peer_mss); - if (sc->sc_requested_r_scale != scx->sc_requested_r_scale) + if (sc->sc_requested_r_scale != scs.sc_requested_r_scale) log(LOG_DEBUG, "%s; %s: rwscale different %i vs %i\n", s, __func__, sc->sc_requested_r_scale, - scx->sc_requested_r_scale); + scs.sc_requested_r_scale); - if (sc->sc_requested_s_scale != scx->sc_requested_s_scale) + if (sc->sc_requested_s_scale != scs.sc_requested_s_scale) log(LOG_DEBUG, "%s; %s: swscale different %i vs %i\n", s, __func__, sc->sc_requested_s_scale, - scx->sc_requested_s_scale); + scs.sc_requested_s_scale); - if ((sc->sc_flags & SCF_SACK) != (scx->sc_flags & SCF_SACK)) + if ((sc->sc_flags & SCF_SACK) != (scs.sc_flags & SCF_SACK)) log(LOG_DEBUG, "%s; %s: SACK different\n", s, __func__); - } - if (s != NULL) free(s, M_TCPLOG); - return (0); + } } #endif /* INVARIANTS */