aboutsummaryrefslogtreecommitdiff
path: root/tests/sys/netpfil/pf/table.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/sys/netpfil/pf/table.sh')
-rw-r--r--tests/sys/netpfil/pf/table.sh76
1 files changed, 76 insertions, 0 deletions
diff --git a/tests/sys/netpfil/pf/table.sh b/tests/sys/netpfil/pf/table.sh
index 65492545a13b..69fe12fc9804 100644
--- a/tests/sys/netpfil/pf/table.sh
+++ b/tests/sys/netpfil/pf/table.sh
@@ -673,6 +673,80 @@ large_cleanup()
pft_cleanup
}
+atf_test_case "show_recursive" "cleanup"
+show_recursive_head()
+{
+ atf_set descr 'Test displaying tables in every anchor'
+ atf_set require.user root
+}
+
+show_recursive_body()
+{
+ pft_init
+
+ vnet_mkjail alcatraz
+
+ pft_set_rules alcatraz \
+
+ (echo "table <bar> persist"
+ echo "block in quick from <bar> to any"
+ ) | jexec alcatraz pfctl -a anchorage -f -
+
+ pft_set_rules noflush alcatraz \
+ "table <foo> counters { 192.0.2.1 }" \
+ "pass in from <foo>" \
+ "anchor anchorage"
+
+ jexec alcatraz pfctl -sr -a "*"
+
+ atf_check -s exit:0 -e ignore -o match:'-pa-r-- bar@anchorage' \
+ jexec alcatraz pfctl -v -a "*" -sT
+ atf_check -s exit:0 -e ignore -o match:'--a-r-C foo' \
+ jexec alcatraz pfctl -v -a "*" -sT
+}
+
+show_recursive_cleanup()
+{
+ pft_cleanup
+}
+
+atf_test_case "in_anchor" "cleanup"
+in_anchor_head()
+{
+ atf_set descr 'Test declaring tables in anchors'
+ atf_set require.user root
+}
+
+in_anchor_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 \
+ "block all" \
+ "anchor \"foo\" {\n
+ table <bar> counters { 192.0.2.1 }\n
+ pass in from <bar>\n
+ }\n"
+
+ atf_check -s exit:0 -o ignore ping -c 3 192.0.2.2
+
+ jexec alcatraz pfctl -sr -a "*" -vv
+ jexec alcatraz pfctl -sT -a "*" -vv
+}
+
+in_anchor_cleanup()
+{
+ pft_cleanup
+}
+
atf_init_test_cases()
{
atf_add_test_case "v4_counters"
@@ -689,4 +763,6 @@ atf_init_test_cases()
atf_add_test_case "anchor"
atf_add_test_case "flush"
atf_add_test_case "large"
+ atf_add_test_case "show_recursive"
+ atf_add_test_case "in_anchor"
}