git: 26c373aa367c - main - pf tests: declare a table inside an anchor
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 17 Sep 2025 14:15:40 UTC
The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=26c373aa367c71394f0734af368974cafcf878d0 commit 26c373aa367c71394f0734af368974cafcf878d0 Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2025-08-22 15:34:29 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2025-09-17 14:15:14 +0000 pf tests: declare a table inside an anchor Sponsored by: Rubicon Communications, LLC ("Netgate") --- tests/sys/netpfil/pf/table.sh | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/sys/netpfil/pf/table.sh b/tests/sys/netpfil/pf/table.sh index 26fc5bf6cda2..69fe12fc9804 100644 --- a/tests/sys/netpfil/pf/table.sh +++ b/tests/sys/netpfil/pf/table.sh @@ -710,6 +710,43 @@ show_recursive_cleanup() pft_cleanup } +atf_test_case "in_anchor" "cleanup" +in_anchor_head() +{ + atf_set descr 'Test declaring tables in anchors' + atf_set require.user root +} + +in_anchor_body() +{ + pft_init + + epair_send=$(vnet_mkepair) + ifconfig ${epair_send}a 192.0.2.1/24 up + + vnet_mkjail alcatraz ${epair_send}b + jexec alcatraz ifconfig ${epair_send}b 192.0.2.2/24 up + + jexec alcatraz pfctl -e + + pft_set_rules alcatraz \ + "block all" \ + "anchor \"foo\" {\n + table <bar> counters { 192.0.2.1 }\n + pass in from <bar>\n + }\n" + + atf_check -s exit:0 -o ignore ping -c 3 192.0.2.2 + + jexec alcatraz pfctl -sr -a "*" -vv + jexec alcatraz pfctl -sT -a "*" -vv +} + +in_anchor_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "v4_counters" @@ -727,4 +764,5 @@ atf_init_test_cases() atf_add_test_case "flush" atf_add_test_case "large" atf_add_test_case "show_recursive" + atf_add_test_case "in_anchor" }