git: fff621251320 - main - pf tests: ensure that 'quick' on anchor rules works as expected
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 26 Aug 2024 16:53:52 UTC
The branch main has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=fff6212513205a4989b38e9debe455343a8d309f
commit fff6212513205a4989b38e9debe455343a8d309f
Author: Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-08-26 15:24:32 +0000
Commit: Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-08-26 16:50:02 +0000
pf tests: ensure that 'quick' on anchor rules works as expected
Sponsored by: Rubicon Communications, LLC ("Netgate")
---
tests/sys/netpfil/pf/anchor.sh | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/tests/sys/netpfil/pf/anchor.sh b/tests/sys/netpfil/pf/anchor.sh
index 311d6485e794..25d9d5b6df03 100644
--- a/tests/sys/netpfil/pf/anchor.sh
+++ b/tests/sys/netpfil/pf/anchor.sh
@@ -195,6 +195,44 @@ nested_label_cleanup()
pft_cleanup
}
+atf_test_case "quick" "cleanup"
+quick_head()
+{
+ atf_set descr "Test handling of quick on anchors"
+ atf_set require.user root
+}
+
+quick_body()
+{
+ pft_init
+
+ epair=$(vnet_mkepair)
+ vnet_mkjail alcatraz ${epair}a
+
+ ifconfig ${epair}b 192.0.2.2/24 up
+ jexec alcatraz ifconfig ${epair}a 192.0.2.1/24 up
+
+ # Sanity check
+ atf_check -s exit:0 -o ignore ping -c 1 192.0.2.1
+
+ jexec alcatraz pfctl -e
+ pft_set_rules alcatraz \
+ "anchor quick {\n\
+ pass\n\
+ }" \
+ "block"
+
+ # We can still ping because the anchor is 'quick'
+ atf_check -s exit:0 -o ignore ping -c 1 192.0.2.1
+ jexec alcatraz pfctl -sr -v
+ jexec alcatraz pfctl -ss -v
+}
+
+quick_cleanup()
+{
+ pft_cleanup
+}
+
atf_init_test_cases()
{
atf_add_test_case "pr183198"
@@ -202,4 +240,5 @@ atf_init_test_cases()
atf_add_test_case "nested_anchor"
atf_add_test_case "wildcard"
atf_add_test_case "nested_label"
+ atf_add_test_case "quick"
}