aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristof Provost <kp@FreeBSD.org>2021-04-26 09:14:44 +0000
committerKristof Provost <kp@FreeBSD.org>2021-04-26 16:08:15 +0000
commit08d77308211f823b8532d27790e8fd29eaf75c77 (patch)
tree54f9ed7f7f57d27ed73b626ab729c35f44d3abc3
parent402dfb0a8d2c6417cb9bff4460ef250a42b0aa05 (diff)
downloadsrc-08d77308211f823b8532d27790e8fd29eaf75c77.tar.gz
src-08d77308211f823b8532d27790e8fd29eaf75c77.zip
pf tests: Test automatically generated tables
Add a test case where the pfctl optimizer will generate a table automatically. These tables have long names, which we accidentally broke in the nvlist ADDRULE ioctl. Reviewed by: melifaro MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29989
-rw-r--r--tests/sys/netpfil/pf/table.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/sys/netpfil/pf/table.sh b/tests/sys/netpfil/pf/table.sh
index 9003f61ba189..5f23a2c82aa9 100644
--- a/tests/sys/netpfil/pf/table.sh
+++ b/tests/sys/netpfil/pf/table.sh
@@ -146,9 +146,47 @@ pr251414_cleanup()
pft_cleanup
}
+atf_test_case "automatic" "cleanup"
+automatic_head()
+{
+ atf_set descr "Test automatic - optimizer generated - tables"
+ atf_set require.user root
+}
+
+automatic_body()
+{
+ pft_init
+
+ epair=$(vnet_mkepair)
+ ifconfig ${epair}a 192.0.2.1/24 up
+
+ vnet_mkjail alcatraz ${epair}b
+ jexec alcatraz ifconfig ${epair}b 192.0.2.2/24 up
+ jexec alcatraz pfctl -e
+
+ pft_set_rules alcatraz \
+ "block in" \
+ "pass in proto icmp from 192.0.2.1" \
+ "pass in proto icmp from 192.0.2.3" \
+ "pass in proto icmp from 192.0.2.4" \
+ "pass in proto icmp from 192.0.2.5" \
+ "pass in proto icmp from 192.0.2.6" \
+ "pass in proto icmp from 192.0.2.7" \
+ "pass in proto icmp from 192.0.2.8" \
+ "pass in proto icmp from 192.0.2.9"
+
+ atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2
+}
+
+automatic_cleanup()
+{
+ pft_cleanup
+}
+
atf_init_test_cases()
{
atf_add_test_case "v4_counters"
atf_add_test_case "v6_counters"
atf_add_test_case "pr251414"
+ atf_add_test_case "automatic"
}