aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristof Provost <kp@FreeBSD.org>2021-05-16 06:51:54 +0000
committerKristof Provost <kp@FreeBSD.org>2021-05-24 15:38:22 +0000
commit25fa4b8e668fed449e4c52f2a9be134c067d749c (patch)
tree77968808b13c9a3fbff3dc21c4ec174393e5c0b5
parent31424ca0a1d02d10011f2d3c32d49c8e8a3e7c96 (diff)
downloadsrc-25fa4b8e668fed449e4c52f2a9be134c067d749c.tar.gz
src-25fa4b8e668fed449e4c52f2a9be134c067d749c.zip
pf tests: More set skip on <ifgroup> tests
Test the specific case reported in PR 255852. Clearing the skip flag on groups was broken because pfctl couldn't work out if a kif was a group or not, because the kernel no longer set the pfik_group pointer. PR: 255852 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30285 (cherry picked from commit 45db38554517c7e1b0cc0265113c22f92a0eb494)
-rw-r--r--tests/sys/netpfil/pf/set_skip.sh46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/sys/netpfil/pf/set_skip.sh b/tests/sys/netpfil/pf/set_skip.sh
index 95c6b6f77825..ce7b1900ae00 100644
--- a/tests/sys/netpfil/pf/set_skip.sh
+++ b/tests/sys/netpfil/pf/set_skip.sh
@@ -117,9 +117,55 @@ set_skip_dynamic_cleanup()
pft_cleanup
}
+atf_test_case "pr255852" "cleanup"
+pr255852_head()
+{
+ atf_set descr "PR 255852"
+ atf_set require.user root
+}
+
+pr255852_body()
+{
+ pft_init
+
+ epair=$(vnet_mkepair)
+
+ ifconfig ${epair}a 192.0.2.1/24 up
+
+ vnet_mkjail alcatraz ${epair}b
+ jexec alcatraz ifconfig lo0 127.0.0.1/8 up
+ jexec alcatraz ifconfig ${epair}b 192.0.2.2/24 up
+
+ # Sanity check
+ atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2
+
+ jexec alcatraz pfctl -e
+ pft_set_rules alcatraz "set skip on { lo0, epair }" \
+ "block"
+ jexec alcatraz pfctl -vsI
+
+ # We're skipping on epair, so this should work
+ atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2
+
+ # Note: flushing avoid the issue
+ pft_set_rules noflush alcatraz "set skip on { lo0 }" \
+ "block"
+
+ jexec alcatraz pfctl -vsI
+
+ # No longer skipping, so this should fail
+ atf_check -s exit:2 -o ignore ping -c 1 -t 1 192.0.2.2
+}
+
+pr255852_cleanup()
+{
+ pft_cleanup
+}
+
atf_init_test_cases()
{
atf_add_test_case "set_skip_group"
atf_add_test_case "set_skip_group_lo"
atf_add_test_case "set_skip_dynamic"
+ atf_add_test_case "pr255852"
}