From nobody Thu Oct 15 18:10:32 2026 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 4j5GMY1kKrz6vFbf for ; Thu, 15 Oct 2026 18:10:33 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4j5GMY17NZz4gdt for ; Thu, 15 Oct 2026 18:10:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1792087833; 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=3534GK/Fevuxy0Yd6QOFp+SaxtTsVS0Xw05WwA19+Hw=; b=OxQRtAV8Klypm1hj6cYIJka+yQpZEsiHmungRqBA2bIApiSMvxtf9HWTRlpBoLcSgEOFje 9/+fN5/0nTNy93c+2yu7nx7RVbv/2s7n1yH+9o0VXKoXvYCsycOy81qDNEx5rEl0kpitK0 6lIhWTfygscGxmtRh9q1fYDI5SsxwQv+Ft3K0ON0jSJr+sAbaq1VwM/Y6dWn5iP4b+RXnI 4uXOhJapUjhY0ZZ2tcUfXgSx616qz2GNHX2Ddy4EWmnOQbxm36EgayDfjxvc4q31pFg8gF VWXEamdQus9II0lTEp78+dYSpIm8Jf5ZrmADoGTOwASUB7uQ/2ri6cNF1XDltg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1792087833; b=Ca52MTb2LxdN1/mJmjwT/TrQoZfRcW5LTPnDyw6ouYq5LLc84a9Lso/rQl/FCCUiV+HSs/ GaEyaa909L7wwYR4/csFBq8DY0veTv456mm3ELoMTOjdQQqxW3Cd6bF4wzcDdCh0sF/99o aJyEi7JzsSKeaQngcW3hrqmUc45YdGQJTdfj6e5E1euNF1Y9zS5ey33Bd63W2nVyDWNU1S 1upvKKF1nIHNiwE4nU9n1qjfoj2glYdi2rOzSFPeXvPTScvotsR2LeKTAPpVdOWO7EuVOP V9l90zVL7besrYlkkfQffgLmYk7kSHg4gUS+IEbtDSIcJ8nGivhu+yK/xuevXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1792087833; 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=3534GK/Fevuxy0Yd6QOFp+SaxtTsVS0Xw05WwA19+Hw=; b=rxrk6UXmHHmnLeRcqvm1xzvZGPDkH8FP05l/KKtXrrWZG4hb/uVwrSeeYmZA1n36270SR4 yonVbYehhI2LYlweoSvcVe4pd72KICLxe5bUm3l/ALXQpb8/bjXwHelQ5OYAOBPZI2mz67 VznO17Dq47yhEAaOjMV94F0i1bDeokRzRr0jFa4nrBDaNhFytFdEnt16MYYd1p5DD2lbMe /qTcCHj1DnkaTLIkKs9k+qey/irW4xf7DH+hLw2M/SHZb5YcuFo7boxCj/S07HXm2djJbg 8FUTZZFgOczUTvInfs+HXR5hJKwRZXpNBt9WgHwtjShk72hIO7lW5Up2ChdZuA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4j5GMX72VMzkYC for ; Thu, 15 Oct 2026 18:10:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1844a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 15 Oct 2026 18:10:32 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: R. Christian McDonald Subject: git: f4fe4c3d17f9 - main - pf: Remove a table entry regardless of its mark List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: Commit messages for the main branch of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rcm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f4fe4c3d17f9bb523981b88a01d7c0f0c0f00c36 Auto-Submitted: auto-generated Date: Thu, 15 Oct 2026 18:10:32 +0000 Message-Id: <6ad11718.1844a.1bb53ee0@gitrepo.freebsd.org> The branch main has been updated by rcm: URL: https://cgit.FreeBSD.org/src/commit/?id=f4fe4c3d17f9bb523981b88a01d7c0f0c0f00c36 commit f4fe4c3d17f9bb523981b88a01d7c0f0c0f00c36 Author: R. Christian McDonald AuthorDate: 2026-10-15 18:10:11 +0000 Commit: R. Christian McDonald CommitDate: 2026-10-15 18:10:11 +0000 pf: Remove a table entry regardless of its mark pfr_remove_kentry() returns without removing an entry whose mark is set. The mark is scratch space for the operations that handle a list of addresses: each resets it before use and leaves it set on the entries it kept, so after "pfctl -T replace" or "pfctl -T zero" of an address the entry stays marked. An address a source limiter put in its table is then never taken out again when the source falls below the low-water mark. Remove the entry whether it is marked or not; nothing else is in the work queue. Add a regression test. Reviewed by: kp Fixes: 461648121230 ("pf: introduce source and state limiters") Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D60530 --- sys/netpfil/pf/pf_table.c | 4 --- tests/sys/netpfil/pf/limiters.sh | 56 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 4 deletions(-) diff --git a/sys/netpfil/pf/pf_table.c b/sys/netpfil/pf/pf_table.c index 2450feddaded..b1bb68935ab5 100644 --- a/sys/netpfil/pf/pf_table.c +++ b/sys/netpfil/pf/pf_table.c @@ -902,10 +902,6 @@ pfr_remove_kentry(struct pfr_ktable *kt, struct pfr_addr *ad) if (p == NULL || p->pfrke_not) return (ESRCH); - if (p->pfrke_mark) - return (0); - - p->pfrke_mark = 1; SLIST_INSERT_HEAD(&workq, p, pfrke_workq); pfr_remove_kentries(kt, &workq); diff --git a/tests/sys/netpfil/pf/limiters.sh b/tests/sys/netpfil/pf/limiters.sh index d109fa424d22..a593adac10c0 100644 --- a/tests/sys/netpfil/pf/limiters.sh +++ b/tests/sys/netpfil/pf/limiters.sh @@ -365,6 +365,61 @@ source_table_cleanup() pft_cleanup } +atf_test_case "source_table_marked" "cleanup" +source_table_marked_head() +{ + atf_set descr 'Test the removal of a source from a table after a replace' + atf_set require.user root +} + +source_table_marked_body() +{ + pft_init + + epair=$(vnet_mkepair) + + ifconfig ${epair}a 192.0.2.2/24 up + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b 192.0.2.1/24 up + + # Sanity check + atf_check -s exit:0 -o ignore \ + ping -c 1 192.0.2.1 + + jexec alcatraz pfctl -e + + pft_set_rules alcatraz \ + "set timeout icmp.error 120" \ + "table persist" \ + "source limiter \"server\" id 1 entries 128 limit 100 table above 2 below 2" \ + "pass in proto icmp source limiter \"server\"" + + # Three states put the source in the table. + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.1 + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.1 + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.1 + sleep 1 + atf_check -s exit:0 -o "match:192.0.2.2" \ + jexec alcatraz pfctl -t many -T show + + # A replace that keeps the address leaves its entry marked. + atf_check -s exit:0 -e ignore \ + jexec alcatraz pfctl -t many -T replace 192.0.2.2 192.0.2.99 + + # The marked entry used to be skipped when the source was removed. + atf_check -s exit:0 -e ignore \ + jexec alcatraz pfctl -F states + sleep 1 + atf_check -s exit:0 -o "not-match:192.0.2.2" -o "match:192.0.2.99" \ + jexec alcatraz pfctl -t many -T show +} + +source_table_marked_cleanup() +{ + pft_cleanup +} + atf_test_case "out" "cleanup" out_head() { @@ -418,5 +473,6 @@ atf_init_test_cases() atf_add_test_case "state_multiple" atf_add_test_case "source_basic" atf_add_test_case "source_table" + atf_add_test_case "source_table_marked" atf_add_test_case "out" }