From nobody Thu Sep 25 12:41:46 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 4cXYHv2rBHz68SjP; Thu, 25 Sep 2025 12:41:47 +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 4cXYHt5gwvz42q5; Thu, 25 Sep 2025 12:41:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1758804106; 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=wE/1q12brrBm+d6BAtqs2NuRI02sj9D6cZgF59gzpV0=; b=MzyhfnGE+gHxtJgSuVBGtTFtAzdAXXQNEw3j0A+l8yWq/eLciOeNTJb0K+tG4n9SjMnCTa MKjHrOrnRt34NCCk6ezMUor5FoIXBh+XzjyQ3UAA+jlJG9PVfcwPPExlxkLNhBmirbVB5E qN4aKi6+piXqk0oHvvHVtz/rltGYnX4kF72adeaExDdigPMINLSxoKyY6qzvwX8Rc0ny85 45GaGAcjerTDytigC/rG+pWlMS0gIV4FFUyhOGDlsMGdDAzvhEAt6hNTYp78EdTrgbKLCX 3mhKbuev819lROKKgcMGaBXC0FDoo8k9iVXa0YuFrUlajyFVMKezQO6wed9jfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1758804106; 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=wE/1q12brrBm+d6BAtqs2NuRI02sj9D6cZgF59gzpV0=; b=DI6vhn0JRnfamnhsy2JLkfK7R0JGcgu5kZz0e+P8Y7BcrGNGIx2BtpSN+OuOULSimc9tcC bJY9/201Pk/PTT23eAYknjdNO1CupMNCog7gc27qkQ77wTV9Kz/EfZJUNB3r0DJ2d+d0dG 3SkTClrlQEScb/Qyjpr4dZOpdv917k39gOrkKXKM8vPkSIM5+KI+CmmsxUhIlN1fkXQJwX x3qTR29v+iBmfAkcVODE3FedIpdTMsnfxf1Ax+z36lHTsjpDg+x8DwjTiFcR2QdG5/9LRN La1xcDqXBWqBuYN7K5RkhmRrUwFybtvv15bgp8qFLhPqmLaZ+sh34j2Bv2bs/A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1758804106; a=rsa-sha256; cv=none; b=UYousQpM+0aDCYT8wRLHwDP2SYRgvxRlbc9+/Cs5LeJr4i5kBTh//uEuXdQ/UoY1HsEHhE GZuhXgfDhWIk4cawUOYI5Ow2QO4qwXY9kgfh6KlNiQQgJh3ukXLjuZwg7pZbOSw1XO2DKl G/ZwlPJquRs9Ck5HoE3ZT0EKQje5eDmV5mfCuflElgozJNz9EH2nGJbeCXKoeyc1Tt/Mxl lcf6I/R5d5z50FGRJ845j+pEzht4y6WGx00CsH7YWpKqfWEmquyuWGu3WOCRNQtiHp1dj9 TQRCxFWGJCpEFlqLSmEjaGVmJwagXh5CsVzUmXZ1xQLZiB7FBfg6tpR9xL3nng== 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 4cXYHt5G0xz1Gvk; Thu, 25 Sep 2025 12:41:46 +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 58PCfkFv004819; Thu, 25 Sep 2025 12:41:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58PCfkZI004816; Thu, 25 Sep 2025 12:41:46 GMT (envelope-from git) Date: Thu, 25 Sep 2025 12:41:46 GMT Message-Id: <202509251241.58PCfkZI004816@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: 2c53e251601c - main - pf tests: test once rule inside an anchor 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: 2c53e251601c1fcd558f42a16f6030ba75b7e8df Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=2c53e251601c1fcd558f42a16f6030ba75b7e8df commit 2c53e251601c1fcd558f42a16f6030ba75b7e8df Author: Kristof Provost AuthorDate: 2025-08-28 15:36:03 +0000 Commit: Kristof Provost CommitDate: 2025-09-25 12:41:10 +0000 pf tests: test once rule inside an anchor Sponsored by: Rubicon Communications, LLC ("Netgate") --- tests/sys/netpfil/pf/once.sh | 49 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/tests/sys/netpfil/pf/once.sh b/tests/sys/netpfil/pf/once.sh index 50ccb17e16c6..54dbb030dbe6 100644 --- a/tests/sys/netpfil/pf/once.sh +++ b/tests/sys/netpfil/pf/once.sh @@ -77,7 +77,56 @@ basic_cleanup() pft_cleanup } +atf_test_case "anchor" "cleanup" +anchor_head() +{ + atf_set descr 'Test one shot rule in anchors' + atf_set require.user root +} + +anchor_body() +{ + pft_init + epair=$(vnet_mkepair) + + vnet_mkjail alcatraz ${epair}a + jexec alcatraz ifconfig ${epair}a 192.0.2.1/24 up + + ifconfig ${epair}b 192.0.2.2/24 up + + # Sanity checks + atf_check -s exit:0 -o ignore \ + ping -c 1 192.0.2.1 + + jexec alcatraz pfctl -e + pft_set_rules alcatraz \ + "block" \ + "anchor \"once\" {\n + pass in from 192.0.2.2 once\n + }" + + # First once succeeds + atf_check -s exit:0 -o ignore \ + ping -c 3 192.0.2.1 + + # Check for '# expired' + jexec alcatraz pfctl -sr -vv -a "*" + atf_check -s exit:0 -e ignore \ + -o match:'pass in inet from 192.0.2.2 to any flags S/SA keep state once # expired' \ + jexec alcatraz pfctl -sr -vv -a "*" + + # The second one does not + atf_check -s exit:2 -o ignore \ + ping -c 3 192.0.2.1 +} + +anchor_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "basic" + atf_add_test_case "anchor" }