From nobody Wed Jul 9 08:59:13 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 4bcX361vkWz61N2f; Wed, 09 Jul 2025 08:59:14 +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 4bcX3533gyz3cZh; Wed, 09 Jul 2025 08:59:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1752051553; 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=zAhjHUlnM4o5+7W8Qq1Ozskp1AlBTWWRcj1L3mBmios=; b=ArrByezgcPpcAQHikwGb38sIIc0fb4FOhjBgMz4WbyTDZhlrksHmQoVLtQVL1RznYKMXWJ OVZNhHF6u4PS3UOYHXfm3JH42hKAWuTPjfXoz5GU9/0YY6Vq48mOv5JL0iLrGgCnubrbd9 HyJGVpBg3mNTvXg0Nk5mY7hKxYpQu5HqX5ocjYUUkgRYUsVW7zU3N4r0plFLmbo+QaRUEJ K83V7lmDU6uLGxPM9QN2yiZdnG8McuatPhHtKuBRWaLGhtQf8wsqhFS9DIE453sFcpgllS 7Oa6l8vvUl+oKMBePQUIMS2mX66i9YytKs/vJ1di3EEWsd4UbrIR9YU7jiw5QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1752051553; 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=zAhjHUlnM4o5+7W8Qq1Ozskp1AlBTWWRcj1L3mBmios=; b=KyfVjTyYHtfkttIxPJKXlmiSsGflN8cKuEpHYYRDz0KzldYIsUT06Ic89BDMTn4IeIamuo FvHoilhGgIF1zoZFY7uSsm4gTBdREeGXdqhraXozNTTRMXRUMP1W7/42SL+CrNWPQhQtxG bUnYklzHphjD5kxTivDOG97ZEFG+2o9xUMzTo5JTTPcTvA3zxmO/zKZqHLKtagxcXmiOJv IyQyykaC6TQ6qzV+jZaoF2IYdZnewjCQj1NUXeQKGw5pr2Q/IwV/22fwMOujycDNup9toj 5xEwRDXyh8roE8QDxy9CC3JhVAF1my2BvTk3h0wAV1v25P0zSxtR9Ae/ZWZvJA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1752051553; a=rsa-sha256; cv=none; b=btVFHQZXopaGjw3wBaaxJltUP/VeF7xEqf2MsBMZTx+vfP2HNtOb+INzTfxockr03PRoNG nvNMrvp3NlvK2f6YgDty5wFZDL0giC+6a+zPqWplM+8ElZ9sm6kT7fw9YrCMnR4vfMJxE8 LPJfzl8mqNiEGZ3URUyW8vcLHpZQrgP6ZnFP7hGBAq+FPltyfz6G54Q/uGnAVCdP0NoyZD qc1JaZmhWV7EXNkBuadFx+l3ptavDB2GhU19gxT57xsgqEB16iI2d4x86TXDTnJ8CA2p+B fu9CVpOfMdFKu+yNkYcvgXmHh0yF2MjE6npGaSVzZlXc+4Luuho1jIuLlSUsvg== 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 4bcX352YRyz1D4; Wed, 09 Jul 2025 08:59:13 +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 5698xDhI045161; Wed, 9 Jul 2025 08:59:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5698xDwx045159; Wed, 9 Jul 2025 08:59:13 GMT (envelope-from git) Date: Wed, 9 Jul 2025 08:59:13 GMT Message-Id: <202507090859.5698xDwx045159@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: 05c33e5acb67 - main - pfctl tests: recursive flush test case 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: 05c33e5acb67f1f36feae77b7e400d9a066db441 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=05c33e5acb67f1f36feae77b7e400d9a066db441 commit 05c33e5acb67f1f36feae77b7e400d9a066db441 Author: Kristof Provost AuthorDate: 2025-07-04 21:36:33 +0000 Commit: Kristof Provost CommitDate: 2025-07-09 08:57:50 +0000 pfctl tests: recursive flush test case Sponsored by: Rubicon Communications, LLC ("Netgate") --- tests/sys/netpfil/pf/anchor.sh | 57 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/tests/sys/netpfil/pf/anchor.sh b/tests/sys/netpfil/pf/anchor.sh index b4b52d7a24d6..4692c06142df 100644 --- a/tests/sys/netpfil/pf/anchor.sh +++ b/tests/sys/netpfil/pf/anchor.sh @@ -437,6 +437,62 @@ quick_cleanup() pft_cleanup } +atf_test_case "recursive_flush" "cleanup" +recursive_flush_head() +{ + atf_set descr 'Test recursive flushing of rules' + atf_set require.user root +} + +recursive_flush_body() +{ + pft_init + + epair=$(vnet_mkepair) + vnet_mkjail alcatraz ${epair}a + + ifconfig ${epair}b 192.0.2.2/24 up + jexec alcatraz ifconfig ${epair}a 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 \ + "block" \ + "anchor \"foo\" {\n\ + pass\n\ + }" + + # We can ping thanks to the pass rule in foo + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.1 + + # Only reset the main rules. I.e. not a recursive flush + pft_set_rules alcatraz \ + "block" \ + "anchor \"foo\"" + + # "foo" still has the pass rule, so this works + jexec alcatraz pfctl -a "*" -sr + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.1 + + # Now do a recursive flush + atf_check -s exit:0 -e ignore -o ignore \ + jexec alcatraz pfctl -a "*" -Fr + pft_set_rules alcatraz \ + "block" \ + "anchor \"foo\"" + + # So this fails + jexec alcatraz pfctl -a "*" -sr + atf_check -s exit:2 -o ignore ping -c 1 192.0.2.1 +} + +recursive_flush_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "pr183198" @@ -450,4 +506,5 @@ atf_init_test_cases() atf_add_test_case "nat" atf_add_test_case "include" atf_add_test_case "quick" + atf_add_test_case "recursive_flush" }