git: 8c5425c07fd8 - stable/12 - pf tests: test wildcard anchors
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 15 Sep 2022 09:29:21 UTC
The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=8c5425c07fd880d878782d15430893e6d6b95b44 commit 8c5425c07fd880d878782d15430893e6d6b95b44 Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2022-08-31 13:40:33 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2022-09-15 09:28:59 +0000 pf tests: test wildcard anchors Ensure that a wildcard anchor actually includes any nested anchors (i.e. foo/* will call into foo/bar). MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D36414 (cherry picked from commit d5a0bf4517c053803b266742d16be456c5393ae7) --- tests/sys/netpfil/pf/anchor.sh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/tests/sys/netpfil/pf/anchor.sh b/tests/sys/netpfil/pf/anchor.sh index 4fd3697155d9..27903d469507 100755 --- a/tests/sys/netpfil/pf/anchor.sh +++ b/tests/sys/netpfil/pf/anchor.sh @@ -93,8 +93,47 @@ nested_anchor_cleanup() pft_cleanup } +atf_test_case "wildcard" "cleanup" +wildcard_head() +{ + atf_set descr 'Test wildcard anchors for functionality' + atf_set require.user root +} + +wildcard_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/*\"" + + atf_check -s exit:2 -o ignore ping -c 1 192.0.2.1 + + echo "pass" | jexec alcatraz pfctl -g -f - -a "foo/bar" + + jexec alcatraz pfctl -sr -a "*" + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.1 +} + +wildcard_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "pr183198" atf_add_test_case "nested_anchor" + atf_add_test_case "wildcard" }