Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Sep 2024 13:05:26 GMT
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 357c95ea4663 - main - pf tests: ensure we correctly optimize { any, 192.0.2.3 }
Message-ID:  <202409161305.48GD5Qrl020881@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=357c95ea4663225803e6f1fa89499286a018eb89

commit 357c95ea4663225803e6f1fa89499286a018eb89
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-08-29 10:03:49 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-09-16 11:48:54 +0000

    pf tests: ensure we correctly optimize { any, 192.0.2.3 }
    
    Reviewed by:    zlei
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D46581
---
 tests/sys/netpfil/pf/pass_block.sh | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/tests/sys/netpfil/pf/pass_block.sh b/tests/sys/netpfil/pf/pass_block.sh
index 36218d8e673f..abd303bae6e6 100644
--- a/tests/sys/netpfil/pf/pass_block.sh
+++ b/tests/sys/netpfil/pf/pass_block.sh
@@ -373,6 +373,41 @@ received_on_cleanup()
 	pft_cleanup
 }
 
+atf_test_case "optimize_any" "cleanup"
+optimize_any_head()
+{
+	atf_set descr 'Test known optimizer bug'
+	atf_set require.user root
+}
+
+optimize_any_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 -t 1 192.0.2.1
+
+	jexec alcatraz pfctl -e
+	pft_set_rules alcatraz \
+	    "block" \
+	    "pass in inet from { any, 192.0.2.3 }"
+
+	atf_check -s exit:0 -o ignore ping -c 1 -t 1 192.0.2.1
+}
+
+optimize_any_cleanup()
+{
+	pft_cleanup
+}
+
 atf_init_test_cases()
 {
 	atf_add_test_case "enable_disable"
@@ -382,4 +417,5 @@ atf_init_test_cases()
 	atf_add_test_case "nested_inline"
 	atf_add_test_case "urpf"
 	atf_add_test_case "received_on"
+	atf_add_test_case "optimize_any"
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202409161305.48GD5Qrl020881>