git: 5b13b79a5c3a - main - pf tests: test includes inside anchors
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 16 Apr 2025 18:02:53 UTC
The branch main has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=5b13b79a5c3a98c6ed42f5ff049bd26ab8a35c99
commit 5b13b79a5c3a98c6ed42f5ff049bd26ab8a35c99
Author: Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2025-04-15 15:45:59 +0000
Commit: Kristof Provost <kp@FreeBSD.org>
CommitDate: 2025-04-16 14:23:48 +0000
pf tests: test includes inside anchors
Sponsored by: Rubicon Communications, LLC ("Netgate")
---
tests/sys/netpfil/pf/anchor.sh | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/tests/sys/netpfil/pf/anchor.sh b/tests/sys/netpfil/pf/anchor.sh
index 463cd4d475e3..fbac10240d8d 100644
--- a/tests/sys/netpfil/pf/anchor.sh
+++ b/tests/sys/netpfil/pf/anchor.sh
@@ -361,6 +361,46 @@ nat_cleanup()
pft_cleanup
}
+atf_test_case "include" "cleanup"
+include_head()
+{
+ atf_set descr 'Test including inside anchors'
+ atf_set require.user root
+}
+
+include_body()
+{
+ pft_init
+
+ wd=`pwd`
+
+ 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
+
+ echo "pass" > ${wd}/extra.conf
+ jexec alcatraz pfctl -e
+ pft_set_rules alcatraz \
+ "block" \
+ "anchor \"foo\" {\n\
+ include \"${wd}/extra.conf\"\n\
+ }"
+
+ jexec alcatraz pfctl -sr
+
+ atf_check -s exit:0 -o ignore ping -c 1 192.0.2.1
+}
+
+include_cleanup()
+{
+ pft_cleanup
+}
+
atf_init_test_cases()
{
atf_add_test_case "pr183198"
@@ -372,4 +412,5 @@ atf_init_test_cases()
atf_add_test_case "quick_nested"
atf_add_test_case "counter"
atf_add_test_case "nat"
+ atf_add_test_case "include"
}