git: 9748482d343d - stable/13 - pf tests: test longer anchor names

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Tue, 18 Jun 2024 14:47:24 UTC
The branch stable/13 has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=9748482d343dfaca9cb92359d0af7b4d38aea3bd

commit 9748482d343dfaca9cb92359d0af7b4d38aea3bd
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-05-24 12:50:53 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-06-18 14:43:43 +0000

    pf tests: test longer anchor names
    
    PR:             279225
    MFC after:      3 weeks
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    
    (cherry picked from commit 8b28ec3861d5b3e9fd8a60dbfda13059a5301281)
---
 tests/sys/netpfil/pf/anchor.sh | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/tests/sys/netpfil/pf/anchor.sh b/tests/sys/netpfil/pf/anchor.sh
index cf6da8740003..eba1ee935930 100644
--- a/tests/sys/netpfil/pf/anchor.sh
+++ b/tests/sys/netpfil/pf/anchor.sh
@@ -58,6 +58,37 @@ pr183198_cleanup()
 	pft_cleanup
 }
 
+atf_test_case "pr279225" "cleanup"
+pr279225_head()
+{
+	atf_set descr "Test that we can retrieve longer anchor names, PR 279225"
+	atf_set require.user root
+}
+
+pr279225_body()
+{
+	pft_init
+
+	vnet_mkjail alcatraz
+
+	pft_set_rules alcatraz \
+		"nat-anchor \"appjail-nat/jail/*\" all" \
+		"rdr-anchor \"appjail-rdr/*\" all" \
+		"anchor \"appjail/jail/*\" all"
+
+	atf_check -s exit:0 -o match:"nat-anchor \"appjail-nat/jail/\*\" all \{" \
+		jexec alcatraz pfctl -sn -a "*"
+	atf_check -s exit:0 -o match:"rdr-anchor \"appjail-rdr/\*\" all \{" \
+		jexec alcatraz pfctl -sn -a "*"
+	atf_check -s exit:0 -o match:"anchor \"appjail/jail/\*\" all \{" \
+		jexec alcatraz pfctl -sr -a "*"
+}
+
+pr279225_cleanup()
+{
+	pft_cleanup
+}
+
 atf_test_case "nested_anchor" "cleanup"
 nested_anchor_head()
 {
@@ -133,6 +164,7 @@ wildcard_cleanup()
 atf_init_test_cases()
 {
 	atf_add_test_case "pr183198"
+	atf_add_test_case "pr279225"
 	atf_add_test_case "nested_anchor"
 	atf_add_test_case "wildcard"
 }