diff options
| author | Kristof Provost <kp@FreeBSD.org> | 2026-03-12 14:23:32 +0000 |
|---|---|---|
| committer | Kristof Provost <kp@FreeBSD.org> | 2026-03-24 04:27:20 +0000 |
| commit | ab74151e8d097b263237942c0b12277098bc9533 (patch) | |
| tree | ee2601d45c676c4b45fd27fa091a344390b56dfa | |
| parent | 1fa873c93c8b08561c53107c7b90c53dfad30ddc (diff) | |
pf tests: verify that we handle address range rules correctly
There's been a problem where rules which differed only in address ranges
were considered duplicates and not added. Test for this.
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
| -rw-r--r-- | tests/sys/netpfil/pf/pass_block.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/sys/netpfil/pf/pass_block.sh b/tests/sys/netpfil/pf/pass_block.sh index e955068d014b..f6d973de7cf4 100644 --- a/tests/sys/netpfil/pf/pass_block.sh +++ b/tests/sys/netpfil/pf/pass_block.sh @@ -451,6 +451,43 @@ any_if_cleanup() pft_cleanup } +atf_test_case "addr_range" "cleanup" +addr_range_head() +{ + atf_set descr 'Test rulesets with multiple address ranges' + atf_set require.user root +} + +addr_range_body() +{ + pft_init + + epair=$(vnet_mkepair) + ifconfig ${epair}b 192.0.2.2/24 up + + vnet_mkjail alcatraz ${epair}a + jexec alcatraz ifconfig ${epair}a 192.0.2.1/24 up + + # Sanity check + atf_check -s exit:0 -o ignore ping -c 1 -t 1 192.0.2.1 + + jexec alcatraz pfctl -e + pft_set_rules alcatraz \ + "block" \ + "pass inet from any to 10.100.100.1 - 10.100.100.20" \ + "pass inet from any to 192.0.2.1 - 192.0.2.10" + +jexec alcatraz pfctl -sr -vv + + atf_check -s exit:0 -o ignore ping -c 1 -t 1 192.0.2.1 +jexec alcatraz pfctl -sr -vv +} + +addr_range_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "enable_disable" @@ -462,4 +499,5 @@ atf_init_test_cases() atf_add_test_case "received_on" atf_add_test_case "optimize_any" atf_add_test_case "any_if" + atf_add_test_case "addr_range" } |
