git: d11a19654aab - main - pf tests: verify that table counters work on match rules
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 12 Feb 2025 19:39:12 UTC
The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d11a19654aab578fad617fe8676146b2734b1679 commit d11a19654aab578fad617fe8676146b2734b1679 Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2025-02-06 18:27:19 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2025-02-12 19:38:39 +0000 pf tests: verify that table counters work on match rules Sponsored by: Rubicon Communications, LLC ("Netgate") --- tests/sys/netpfil/pf/table.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tests/sys/netpfil/pf/table.sh b/tests/sys/netpfil/pf/table.sh index f655463f3c03..3b7e116720f3 100644 --- a/tests/sys/netpfil/pf/table.sh +++ b/tests/sys/netpfil/pf/table.sh @@ -109,6 +109,46 @@ v6_counters_cleanup() pft_cleanup } +atf_test_case "match_counters" "cleanup" +match_counters_head() +{ + atf_set descr 'Test that counters for tables in match rules work' + atf_set require.user root +} + +match_counters_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 \ + "table <foo> counters { 192.0.2.1 }" \ + "pass all" \ + "match in from <foo> to any" \ + "match out from any to <foo>" \ + "set skip on lo" + + atf_check -s exit:0 -o ignore ping -c 3 192.0.2.2 + + atf_check -s exit:0 -e ignore \ + -o match:'In/Block:.*'"$TABLE_STATS_ZERO_REGEXP" \ + -o match:'In/Pass:.*'"$TABLE_STATS_NONZERO_REGEXP" \ + -o match:'Out/Block:.*'"$TABLE_STATS_ZERO_REGEXP" \ + -o match:'Out/Pass:.*'"$TABLE_STATS_NONZERO_REGEXP" \ + jexec alcatraz pfctl -t foo -T show -vv +} + +match_counters_cleanup() +{ + pft_cleanup +} + atf_test_case "zero_one" "cleanup" zero_one_head() { @@ -488,6 +528,7 @@ atf_init_test_cases() { atf_add_test_case "v4_counters" atf_add_test_case "v6_counters" + atf_add_test_case "match_counters" atf_add_test_case "zero_one" atf_add_test_case "reset_nonzero" atf_add_test_case "pr251414"