From nobody Mon Jul 7 15:08:04 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 4bbSKd53Gmz61wDN; Mon, 07 Jul 2025 15:08:05 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bbSKc6tP0z3wZH; Mon, 07 Jul 2025 15:08:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751900885; 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=+I1aIeqzcm/FXrUPLA94Hows0SVCTPWLETpIfmNZS68=; b=YJBrffHmIN0CFRQOVAwBW38mhcRj/shEsFC6pOfmM0/CovKsC0ZnbQJJyOpHflu8pFyhpt KNybg+6Ue65hYB+44WhGzOMBJ6ZYBZrxzctVFzzac28OXpnt4G7bkwlJV9fPuNqkYMfptG FC67pFvpu34B/ZXOqZzZ18Ob9EUFsjDS4NBihpun7VLlNZc0W5kxI0FOhLCy4e4iOcPf3e pI0bJda/t/5byGENWP/idzAMji48u2iZubR/D9FzLbLRkTCl8rp6igjWtnm9foNlSGbgwn HuBq5aB+5KXkou5WDSwmgSaIamCrqnu+Obmlf89nJvUo/g+9/XLa3lCAPC7yPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751900885; 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=+I1aIeqzcm/FXrUPLA94Hows0SVCTPWLETpIfmNZS68=; b=ph6mY6utSCma8wU0Q7Sc53KUYYKgzIXCMHIBHfHXxWJ6RU6m2AiYau7xo2MzpifIClftEL M45U+5sGh7kmIkPC8pB3yXSG4GFBDl4YuL1oE0ZEe7LCF6wKVuZ+YgnuBBuQqBK0zbFYfo HZmkiFOQcaMe2FJclGwWjG+nX+7UaxmiyH5HpCiN04Pj5Bl0UNwqjYf9mTYOkl8nkOWoUF AtGr+RJHb1h2ZHRFxzkyTxEpn0bVUeC3xV9n/GddGereqqvqyFdj0SeehxitkFEZ0P7anO MamhNs+EAQ/6OtTf9KvsYVRnbREzqCErUaImsQ1Rg1L0Cvyhza/utwd6x1o+IA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751900885; a=rsa-sha256; cv=none; b=y3IlyqhYGRdnmDZrKo3jF2EY/nb96Eoof4qcZxvzvH5PpFTZsbhve/WPGe4iqrUd5OPHaA eke35/rmmNK+YeegPqKWs3N2bMHqj1NoSedFBDJ/6Q9RJ59hsXqJTRbwqK3e2RfQXjmCGr pMLaV2+dLjG0BYuz2SpfgTmijY3ao/NjAFacWOHLH2xxUYqIZiBl8tLXWR1ArUVkJBIBoF FC1/MjneRbWV8Tff4mNALAQ4OU9RzjeBbs+oEwW2Lu1jVa3LrPlRQ0a3iIxeDRTfwHoKYd 4vX7YdBQVzWfFgsWYK+NR/8XEWmXllL+SiyZmDsgsCL6Ih80IX/Wk6Wettwshw== 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 4bbSKc6Tx1zwH1; Mon, 07 Jul 2025 15:08:04 +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 567F84DF016930; Mon, 7 Jul 2025 15:08:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 567F84OP016926; Mon, 7 Jul 2025 15:08:04 GMT (envelope-from git) Date: Mon, 7 Jul 2025 15:08:04 GMT Message-Id: <202507071508.567F84OP016926@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 0ccf78da3bd4 - main - pfctl: Always check for namespace collisions on table commands 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: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0ccf78da3bd4f273f203deb4c237d1a3c046fac0 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=0ccf78da3bd4f273f203deb4c237d1a3c046fac0 commit 0ccf78da3bd4f273f203deb4c237d1a3c046fac0 Author: Kristof Provost AuthorDate: 2025-07-02 15:08:33 +0000 Commit: Kristof Provost CommitDate: 2025-07-07 15:06:51 +0000 pfctl: Always check for namespace collisions on table commands `-t table -T add|replace ...' would only check for duplicate tables in case addresses where actually to the table. Instead of using a positive number of added addresses as prove for successful table operations, rely on the fact that CREATE_TABLE() is guaranteed to be called only if pf(4) can be accessed, that is warn_duplicate_tables() will return. This improves duplicate detection rate as warnings are now also emitted even when table commands eventually leave tables unchanged. OK benno sashan Obtained from: OpenBSD, kn , 898866c293 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl_table.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbin/pfctl/pfctl_table.c b/sbin/pfctl/pfctl_table.c index d1f20761a4f4..0842b042df41 100644 --- a/sbin/pfctl/pfctl_table.c +++ b/sbin/pfctl/pfctl_table.c @@ -85,6 +85,8 @@ static const char *istats_text[2][2][2] = { } while (0) #define CREATE_TABLE do { \ + warn_duplicate_tables(table.pfrt_name, \ + table.pfrt_anchor); \ table.pfrt_flags |= PFR_TFLAG_PERSIST; \ if ((!(opts & PF_OPT_NOACTION) || \ (opts & PF_OPT_DUMMYACTION)) && \ @@ -94,8 +96,6 @@ static const char *istats_text[2][2][2] = { goto _error; \ } \ if (nadd) { \ - warn_duplicate_tables(table.pfrt_name, \ - table.pfrt_anchor); \ xprintf(opts, "%d table created", nadd); \ if (opts & PF_OPT_NOACTION) \ return (0); \