Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Mar 2026 01:16:04 +0000
From:      Philip Paeps <philip@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Cc:        Kristof Provost <kp@FreeBSD.org>
Subject:   git: 89ab511c1ce2 - releng/14.3 - pf tests: verify that we handle address range rules correctly
Message-ID:  <69c488d4.18f9b.32a95ae5@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch releng/14.3 has been updated by philip:

URL: https://cgit.FreeBSD.org/src/commit/?id=89ab511c1ce2a979b5d0e7fdbb3289442b35d8a3

commit 89ab511c1ce2a979b5d0e7fdbb3289442b35d8a3
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2026-03-12 14:23:32 +0000
Commit:     Philip Paeps <philip@FreeBSD.org>
CommitDate: 2026-03-25 16:13:33 +0000

    pf tests: verify that we handle address range rules correctly
    
    There's been a problem where rules which differed only in address ranges
    were considered duplicates and not added. Test for this.
    
    Approved by:    so
    Security:       FreeBSD-SA-26:09.pf
    Security:       CVE-2026-4748
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    
    (cherry picked from commit ab74151e8d097b263237942c0b12277098bc9533)
    (cherry picked from commit 958dbc87e9c59a2e9f83d84115ce03fb96e9b249)
---
 tests/sys/netpfil/pf/pass_block.sh | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/tests/sys/netpfil/pf/pass_block.sh b/tests/sys/netpfil/pf/pass_block.sh
index 792b73b4a0a5..b91ba7f9ee68 100644
--- a/tests/sys/netpfil/pf/pass_block.sh
+++ b/tests/sys/netpfil/pf/pass_block.sh
@@ -255,6 +255,43 @@ urpf_cleanup()
 	pft_cleanup
 }
 
+atf_test_case "addr_range" "cleanup"
+addr_range_head()
+{
+	atf_set descr 'Test rulesets with multiple address ranges'
+	atf_set require.user root
+}
+
+addr_range_body()
+{
+	pft_init
+
+	epair=$(vnet_mkepair)
+	ifconfig ${epair}b 192.0.2.2/24 up
+
+	vnet_mkjail alcatraz ${epair}a
+	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 inet from any to 10.100.100.1 - 10.100.100.20" \
+	    "pass inet from any to 192.0.2.1 - 192.0.2.10"
+
+jexec alcatraz pfctl -sr -vv
+
+	atf_check -s exit:0 -o ignore ping -c 1 -t 1 192.0.2.1
+jexec alcatraz pfctl -sr -vv
+}
+
+addr_range_cleanup()
+{
+	pft_cleanup
+}
+
 atf_init_test_cases()
 {
 	atf_add_test_case "v4"
@@ -262,4 +299,5 @@ atf_init_test_cases()
 	atf_add_test_case "noalias"
 	atf_add_test_case "nested_inline"
 	atf_add_test_case "urpf"
+	atf_add_test_case "addr_range"
 }


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69c488d4.18f9b.32a95ae5>