aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKristof Provost <kp@FreeBSD.org>2022-05-31 12:40:05 +0000
committerKristof Provost <kp@FreeBSD.org>2022-06-20 08:16:20 +0000
commit7b271afd62777ea81e96914d143905fc047e9a08 (patch)
tree7f4a66ed9313add08ae85e24d3ff631abf76d594 /tests
parent1f61367f8d61fd6963a47296a86f553c403b5f91 (diff)
downloadsrc-7b271afd62777ea81e96914d143905fc047e9a08.tar.gz
src-7b271afd62777ea81e96914d143905fc047e9a08.zip
pf tests: basic 'tagged' test for Ethernet rules
Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D35363
Diffstat (limited to 'tests')
-rw-r--r--tests/sys/netpfil/pf/ether.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/sys/netpfil/pf/ether.sh b/tests/sys/netpfil/pf/ether.sh
index 7a8b9e0d9b38..dc580b234c39 100644
--- a/tests/sys/netpfil/pf/ether.sh
+++ b/tests/sys/netpfil/pf/ether.sh
@@ -553,6 +553,47 @@ ip_cleanup()
pft_cleanup
}
+atf_test_case "match_tag" "cleanup"
+match_tag_head()
+{
+ atf_set descr 'Test matching tags'
+ atf_set require.user root
+}
+
+match_tag_body()
+{
+ pft_init
+
+ epair=$(vnet_mkepair)
+
+ vnet_mkjail alcatraz ${epair}b
+
+ ifconfig ${epair}a 192.0.2.1/24 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 \
+ "ether block out tagged foo" \
+ "pass in proto icmp tag foo"
+
+ atf_check -s exit:2 -o ignore ping -c 1 192.0.2.2
+
+ pft_set_rules alcatraz \
+ "ether block out tagged bar" \
+ "pass in proto icmp tag foo"
+
+ # Still passes when tagged differently
+ atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2
+}
+
+match_tag_cleanup()
+{
+ pft_cleanup
+}
+
atf_init_test_cases()
{
atf_add_test_case "mac"
@@ -563,4 +604,5 @@ atf_init_test_cases()
atf_add_test_case "dummynet"
atf_add_test_case "anchor"
atf_add_test_case "ip"
+ atf_add_test_case "match_tag"
}