From nobody Mon Sep 15 11:54:29 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4cQNjy2YLGz67FRH; Mon, 15 Sep 2025 11:54:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cQNjx6wKcz44Bb; Mon, 15 Sep 2025 11:54:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757937270; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=aqw+vKy9BCKguw5IZKnrNEkV6ifPi32mPyaB2lUGgIU=; b=tjTJNoj6+JMKWiu/4BapnYWWW+4zyGgcd+JQbdsX06nvGxJEdqZjgceWCD/1NK+lZEYi6Q SDxzmV94mQ+VPSrNTHmHbalJiAx+/ql99V7Rpmua+W5XcG4VyDC/8vlx1ln/0EDb9DcVZd EvzYcRaeKGTmP1aV/ZrkO2YSQOrJhyKTFdXmov8q9DpKdF3cmhF2inh1kcxcdS0huwJSaM Cs8nFC/nWja2MKy/biY06XhbEmtDX7dO0Rc58xsYueSgdjn+yA8TSMhaaDUEsBbl2wea6X lOFhBv66cYfc075pWyulyW+YuminAzHCj7WcaAKAzEkmDvL5AyufB/GrpXNfVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757937270; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=aqw+vKy9BCKguw5IZKnrNEkV6ifPi32mPyaB2lUGgIU=; b=ls+CXZg1tyveiX+l8oRVyvB5vx/uxIduSR8iAwJpSP6kjKQdzX0/lUgpEDWRiJgcWG0qmn hhNgfrEMv5AC2haVYWPH4ysbEzFVSZjYBsS4sIUc4k+rvDRde5XxRemIFfDPQOfPEjBAn1 ZYYXLWkAzr4PCutJKQ51u9qspnrwutGuVMG/aN/SX7wRcygAXvwb7SNjAYRxtIoYRG6p+G OlKbiuM6k1wy2cV/FZVx/908V5aNvUEMPSNcyYwX0YIPz1f0ZbNnUlCtrfg4n9m1POptOi 9aMJdRz8JasOTggtbw6HYSZ7yzFJWShZxbtyl8d5Wm2tmExoI2pB/d/B87BljQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1757937270; a=rsa-sha256; cv=none; b=pWwkY01x+jZK57/aU4M27tqfMRTodF11xZXiq9wbEzuvCSya1mV7rlYKviYIivQooNzfI3 Jm0G3DSQzEmW4E3W5dOXu/lJ9tQd6dAL1N+Qs0Q3kM14fHmK149TrMMOKAnO+tJbXFRftD QjLCHZ31AXxlbMvLuGfsMVlB8Wcz+FB1JgPVN7GrYbJCg7XWRJJw0ixAEFDa/qgigJ+7tI LmBWc21h8qveffPkmRbwFb0L9ixJuNdcxDiKXAe1sXbiPPTvYD2tqxKGkJEK8kmEdskkgu e24O4rg37i9DWvv+akstfd1U+sNZ1WCflRyz8v3Nj31z8lvQ9XBJj5DenjXOzQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cQNjx6PsDztB0; Mon, 15 Sep 2025 11:54:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 58FBsTiY025580; Mon, 15 Sep 2025 11:54:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58FBsT2d025577; Mon, 15 Sep 2025 11:54:29 GMT (envelope-from git) Date: Mon, 15 Sep 2025 11:54:29 GMT Message-Id: <202509151154.58FBsT2d025577@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: d0ea3de0fe71 - main - pf tests: verify rule numbers in pflog output List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d0ea3de0fe71fe67537f84df59da69770784fa9a Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d0ea3de0fe71fe67537f84df59da69770784fa9a commit d0ea3de0fe71fe67537f84df59da69770784fa9a Author: Kristof Provost AuthorDate: 2025-08-21 13:08:05 +0000 Commit: Kristof Provost CommitDate: 2025-09-15 09:32:36 +0000 pf tests: verify rule numbers in pflog output Sponsored by: Rubicon Communications, LLC ("Netgate") --- tests/sys/netpfil/pf/pflog.sh | 59 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/tests/sys/netpfil/pf/pflog.sh b/tests/sys/netpfil/pf/pflog.sh index a34ec893a75c..550548a59c11 100644 --- a/tests/sys/netpfil/pf/pflog.sh +++ b/tests/sys/netpfil/pf/pflog.sh @@ -394,6 +394,64 @@ rdr_action_cleanup() pft_cleanup } +atf_test_case "rule_number" "cleanup" +rule_number_head() +{ + atf_set descr 'Test rule numbers with anchors' + atf_set require.user root +} + +rule_number_body() +{ + pflog_init + + epair=$(vnet_mkepair) + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b 192.0.2.1/24 up + + ifconfig ${epair}a 192.0.2.2/24 up + ifconfig ${epair}a inet alias 192.0.2.3/24 up + ifconfig ${epair}a inet alias 192.0.2.4/24 up + + jexec alcatraz pfctl -e + jexec alcatraz ifconfig pflog0 up + pft_set_rules alcatraz \ + "pass log from 192.0.2.2" \ + "anchor \"foo\" {\n \ + pass log from 192.0.2.3\n \ + }" \ + "pass log from 192.0.2.4" + + jexec alcatraz tcpdump -n -e -ttt --immediate-mode -l -U -i pflog0 >> pflog.txt & + sleep 1 # Wait for tcpdump to start + + atf_check -s exit:0 -o ignore \ + ping -c 1 -S 192.0.2.2 192.0.2.1 + atf_check -s exit:0 -o ignore \ + ping -c 1 -S 192.0.2.3 192.0.2.1 + atf_check -s exit:0 -o ignore \ + ping -c 1 -S 192.0.2.4 192.0.2.1 + + jexec alcatraz pfctl -sr -a '*' -vv + + # Give tcpdump a little time to finish writing to the file + sleep 1 + cat pflog.txt + + atf_check -o match:"rule 0/0\(match\): pass in.*: 192.0.2.2.*ICMP echo request" \ + cat pflog.txt + atf_check -o match:"rule 1.foo.0/0\(match\): pass in.*: 192.0.2.3.*: ICMP echo request" \ + cat pflog.txt + atf_check -o match:"rule 2/0\(match\): pass in.*: 192.0.2.4.*: ICMP echo request" \ + cat pflog.txt +} + +rule_number_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "malformed" @@ -403,4 +461,5 @@ atf_init_test_cases() atf_add_test_case "unspecified_v4" atf_add_test_case "unspecified_v6" atf_add_test_case "rdr_action" + atf_add_test_case "rule_number" }