git: 5eee34fa0351 - main - pf tests: check counters on anchors
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 18 Nov 2024 17:58:23 UTC
The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5eee34fa0351f1fdb240f7d085145c05e9ed95d5 commit 5eee34fa0351f1fdb240f7d085145c05e9ed95d5 Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2024-11-18 13:40:01 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2024-11-18 17:57:53 +0000 pf tests: check counters on anchors Sponsored by: Rubicon Communications, LLC ("Netgate") --- 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 25d9d5b6df03..847f8d4f6dab 100644 --- a/tests/sys/netpfil/pf/anchor.sh +++ b/tests/sys/netpfil/pf/anchor.sh @@ -233,6 +233,44 @@ quick_cleanup() pft_cleanup } +atf_test_case "counter" "cleanup" +counter_head() +{ + atf_set descr 'Test counters on anchors' + atf_set require.user root +} + +counter_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 \ + "anchor \"foo\" {\n\ + pass\n\ + }" + + # Generate traffic + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.1 + atf_check -s exit:0 -e ignore \ + -o match:'[ Evaluations: 1 Packets: 2 Bytes: 168 States: 1 ]' \ + jexec alcatraz pfctl -sr -vv +} + +counter_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "pr183198" @@ -241,4 +279,5 @@ atf_init_test_cases() atf_add_test_case "wildcard" atf_add_test_case "nested_label" atf_add_test_case "quick" + atf_add_test_case "counter" }