summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKristof Provost <kp@FreeBSD.org>2025-12-01 16:05:09 +0100
committerKristof Provost <kp@FreeBSD.org>2025-12-01 22:30:30 +0100
commit7a283c40188ff7b0a4bae1a47bbd9ecc17ded132 (patch)
tree95ace013697d50d174b7db20a55549868535fb52 /tests
parentd6f1acf94d3a1b310318ea3ff6c4f4b33bc8e85d (diff)
pfctl: restore '-Tload -f pf.conf' functionality
Allow only tables to be loaded from a file, rather than everything (i.e. including options, rules). Add a test case for this. PR: 291318 MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate")
Diffstat (limited to 'tests')
-rw-r--r--tests/sys/netpfil/pf/table.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/sys/netpfil/pf/table.sh b/tests/sys/netpfil/pf/table.sh
index 6761ce652beb..0b2b56592404 100644
--- a/tests/sys/netpfil/pf/table.sh
+++ b/tests/sys/netpfil/pf/table.sh
@@ -808,6 +808,40 @@ replace_cleanup()
pft_cleanup
}
+atf_test_case "load" "cleanup"
+load_head()
+{
+ atf_set descr 'Test pfctl -T load (PR 291318)'
+ atf_set require.user root
+}
+
+load_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
+
+ echo -e "table <private> persist { 172.16/12 }\nblock\npass in from <private>\n" \
+ | atf_check -s exit:0 jexec alcatraz pfctl -Tload -f -
+
+ atf_check -s exit:0 -o ignore ping -c 3 192.0.2.2
+
+ atf_check -s exit:0 -o not-match:"block" \
+ jexec alcatraz pfctl -sr
+ atf_check -s exit:0 -o match:'172.16.0.0/12' \
+ jexec alcatraz pfctl -Tshow -t private
+}
+
+load_cleanup()
+{
+ pft_cleanup
+}
+
atf_init_test_cases()
{
atf_add_test_case "v4_counters"
@@ -827,4 +861,5 @@ atf_init_test_cases()
atf_add_test_case "show_recursive"
atf_add_test_case "in_anchor"
atf_add_test_case "replace"
+ atf_add_test_case "load"
}