git: 9d004de910bb - main - pf tests: verify that 'quick' works on anchors

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Thu, 03 Jul 2025 12:01:17 UTC
The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=9d004de910bb7ea4d959dd3726318c4c6bdbd48c

commit 9d004de910bb7ea4d959dd3726318c4c6bdbd48c
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2025-06-30 12:13:09 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2025-07-03 07:16:15 +0000

    pf tests: verify that 'quick' works on anchors
    
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 tests/sys/netpfil/pf/anchor.sh | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/tests/sys/netpfil/pf/anchor.sh b/tests/sys/netpfil/pf/anchor.sh
index fbac10240d8d..b4b52d7a24d6 100644
--- a/tests/sys/netpfil/pf/anchor.sh
+++ b/tests/sys/netpfil/pf/anchor.sh
@@ -401,6 +401,42 @@ include_cleanup()
 	pft_cleanup
 }
 
+atf_test_case "quick" "cleanup"
+quick_head()
+{
+	atf_set descr 'Test 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"
+
+	atf_check -s exit:0 -o ignore ping -c 1 192.0.2.1
+	jexec alcatraz pfctl -sr -vv -a "*"
+}
+
+quick_cleanup()
+{
+	pft_cleanup
+}
+
 atf_init_test_cases()
 {
 	atf_add_test_case "pr183198"
@@ -413,4 +449,5 @@ atf_init_test_cases()
 	atf_add_test_case "counter"
 	atf_add_test_case "nat"
 	atf_add_test_case "include"
+	atf_add_test_case "quick"
 }