Date: Fri, 17 Apr 2026 11:55:42 +0000 From: Kristof Provost <kp@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 95fe1ba5579d - main - pf tests: test having multiple state limiters Message-ID: <69e21fbe.397d2.7d823b5d@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=95fe1ba5579df2fe204ad30d892160966677ae98 commit 95fe1ba5579df2fe204ad30d892160966677ae98 Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2026-04-16 13:46:59 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2026-04-17 11:55:06 +0000 pf tests: test having multiple state limiters Sponsored by: Rubicon Communications, LLC ("Netgate") --- tests/sys/netpfil/pf/limiters.sh | 51 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/tests/sys/netpfil/pf/limiters.sh b/tests/sys/netpfil/pf/limiters.sh index 8d9a199db787..f576955e5640 100644 --- a/tests/sys/netpfil/pf/limiters.sh +++ b/tests/sys/netpfil/pf/limiters.sh @@ -185,6 +185,56 @@ state_block_cleanup() pft_cleanup } +atf_test_case "state_multiple" "cleanup" +state_multiple_head() +{ + atf_set descr 'Create multiple state limiters' + atf_set require.user root +} + +state_multiple_body() +{ + pft_init + + epair=$(vnet_mkepair) + + ifconfig ${epair}a 192.0.2.2/24 up + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b 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 + # Allow up to one ICMP state. + pft_set_rules alcatraz \ + "set timeout icmp.error 120" \ + "state limiter \"server\" id 1 limit 1" \ + "state limiter \"client\" id 2 limit 1" \ + "block in proto icmp" \ + "pass in proto icmp state limiter \"server\" (no-match)" + + atf_check -s exit:0 -o ignore \ + ping -c 2 192.0.2.1 + + # This should now fail + atf_check -s exit:2 -o ignore \ + ping -c 2 192.0.2.1 + + jexec alcatraz pfctl -sLimiterStates + hardlim=$(jexec alcatraz pfctl -sLimiterStates | awk 'NR>1 { print $5; }') + if [ $hardlim -eq 0 ]; then + atf_fail "Hard limit not incremented" + fi +} + +state_multiple_cleanup() +{ + pft_cleanup +} + atf_test_case "source_basic" "cleanup" source_basic_head() { @@ -261,5 +311,6 @@ atf_init_test_cases() atf_add_test_case "state_basic" atf_add_test_case "state_rate" atf_add_test_case "state_block" + atf_add_test_case "state_multiple" atf_add_test_case "source_basic" }home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69e21fbe.397d2.7d823b5d>
