From nobody Tue Jun 17 15:50:43 2025 X-Original-To: dev-commits-src-main@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 4bMBD401RGz5yTgb; Tue, 17 Jun 2025 15:50:44 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bMBD35QbJz3pbK; Tue, 17 Jun 2025 15:50:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750175443; 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=QDPqAoiBMz9tzeAjjHh6brdQbM28CZ6Nw6fWhcmu98c=; b=A3v+z8WepoC0n2Qyk8YBreImrnPidpRQ36PUPmLIcZMNGxS89EdCO9t2Sq2VAfXwF88hQC Kpq2rR0RSQDljsgBEDJvrf5vAuPIiGJtYh3DWdJKJNErSpZKw5PKu28BnDhQqgiWuZxADK JkZs4wPzJAKenguzxaW/ImEfr+kvn4buNGByBYl9jKkyCZ1mTdwZISXDX8NA7LDkd5gSFI 139ZlzgKOXn4CmahTkBN1N2c6T6mpKskHPD/x++Tdrf/lKXGTBVUUMmcRts5uQjnFE/O9y X0b3BzqSFpkTnsAWYpHDT6mdmBKXrOysNL3MyVOEPE2QjzyN/FL3qtUq4vj2Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750175443; 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=QDPqAoiBMz9tzeAjjHh6brdQbM28CZ6Nw6fWhcmu98c=; b=GKMCorNYxXIo6mOSEn7PCwcIfYPizYH/wzBvXvoGJ0M0fe7FJJhEVj2BJRRkrmpdHzoc50 YEpVhgY7Pi7gHPKeoGscUtPqqxpqYwek8CssYANfsL+LcoCvV/PdXgJsJmZjvnoiWyCYyT KgPSmzphO2r34aZqjKEu8hHKpQ6daMYiZ296fQ3bC20RrGO42NHYVRBk4Z1AccI/cpedkE wkYXC5V3hvtTMIzZcW4aTfqEBJGFWryQ+EdFIpQ36az6sZra9HmP/EEdt0gYucDxpK0Jjs pEG7953GV0l1gks2HQqZSLUtVj0MBLMHuUfEPCXUyK4Mdd+uu5Al/RboBC9Tdg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750175443; a=rsa-sha256; cv=none; b=SSPzs+Zjl16Pvtmd2y76hu4HRsofLzF3SIqINcLUcopOLzEIoYBkYn2Crx4qQ9Dh+4CzPQ z84nBr0Ityq5E9wieyMYf7BpEOsff1yRweakR/y4h2YtYnE6oxyrYBcqL6GS1h8IdzKyMe YRfQjUdfx5IKkyXxa+AcoR04QrMioRfEm55Pv4yypcQVIoX6k2yKSIA6UvS9rYkQJe1+U7 7TGMra2RL7bh/xbsBM+tpghykG0Oyx1Wj0EqewYomm2rQgqUD9nA0xwOCU7WWK4PO1p7Up kG/Lj4+EF4MiMRetoKCUtfWHWc3+3EceX3yH34jPM0/QGVDS9GgGiH5+dBQEaQ== 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 4bMBD351RLzqJc; Tue, 17 Jun 2025 15:50:43 +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 55HFohcg029486; Tue, 17 Jun 2025 15:50:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55HFohfV029483; Tue, 17 Jun 2025 15:50:43 GMT (envelope-from git) Date: Tue, 17 Jun 2025 15:50:43 GMT Message-Id: <202506171550.55HFohfV029483@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: e9e6a025b452 - main - tcp: refactor debug function syncookie_cmp() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e9e6a025b4523c9aa2885e892495601964e03056 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=e9e6a025b4523c9aa2885e892495601964e03056 commit e9e6a025b4523c9aa2885e892495601964e03056 Author: Gleb Smirnoff AuthorDate: 2025-06-17 15:50:08 +0000 Commit: Gleb Smirnoff CommitDate: 2025-06-17 15:50:08 +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 --- 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 bcbc028cfbdc..2832825f0c40 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -139,9 +139,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 /* @@ -2348,43 +2349,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 */