From nobody Fri Feb 21 08:11:50 2025 X-Original-To: dev-commits-src-all@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 4YzjX6623Qz5pMhP; Fri, 21 Feb 2025 08:11:50 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YzjX63GKFz3QZ9; Fri, 21 Feb 2025 08:11:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740125510; 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=ty68XxpcgadAijqfPj8G/+TLpyB2PZyfqDdTQtyZphs=; b=pDKwj+sOWDD1Ehz8972MEkhYEIBO+a6u8DWN1OLigOJNPhmN/EP9AI5OPsNdGi2HViHKrM 3y8RasrC+S48vwCwbBt6NrhNaShyu8IIYRIHKw/5Aco5LbAVG8XdzibU6stWYBDevG2aDu KJKuvaswR5QG6yRTYM7rJw1aX6M5Usjvwd5NUm+Nnp220Nfx/TMNgrDO1OMsJ6bX5i16Bs jr1p/gwMu7f69mrgW8uWUauo6/qONYi9P7A7SvGoaPGX9R80bq2pdn+nCEpEBFqEHibOS+ NrA0InbjtWcu76vaa69CqWcVgO8l3tBPdoyUZnONRBDv7ECAxYvNieGMJMGzAA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740125510; a=rsa-sha256; cv=none; b=PPuRM5UiS4fC5f5AEbEMB17fbhce6Z8AtXPH7mHbJJ6aU3nlzpu0p6DWgjlA5PD02AjE53 JUpGEpEZ09y8d2sDRYGrfaKAoa5sKU243t03wSpbEelNhPug2vxlDk1s1bsBpRlS1DVEuO MWK5CAxw+mlw1eZWV4xv4ZeV7jfMANGx6bPLTBSOPg7gvyowhiabr3tRTt/6b2fWndAMdC 8Vvisi+HcyiGeV9DrLbz0xsdSMzf3xiPO6cCOlZswLjwwrzRwZ+OuS+8mcIoc9kigPYyXp uurY8LvtqRJ+2bl/GEyZ/jpqGbZBnh44Es9L08dSH9Zbdz2vWupe/xDab9MsyQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740125510; 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=ty68XxpcgadAijqfPj8G/+TLpyB2PZyfqDdTQtyZphs=; b=imb43jgR6Z1jMSZzTGkoLP9+saODLLVqTqtl4Rox0S4cyxL0i4CPkxDEGz24YVovx2VQyd NHj4tI/6Mm/zhnbLEVLbSZk18A5iQPhnqcsZaTdC7uwgtukvugdz8idTruvaHy4hohuYMO X0sy2PQuP3ql8Eh8cCpU5luSrt/CYyIN0gMgA86YkWjA6rUHWAKM2bPEl2BInbWE7P14Ng EnpvwQ4GoOj6n5Cmq8uXBd51w1s4V9lxt3ExWmj/5OhLTMnZU0zPixjJ6WgaQ43XrNyUH9 cXKzcBW/YtxvITfZDsH4jI9pWC9frneaHyFtrqLV9h8iWj3PlcTC/mJQ1XXauA== 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 4YzjX62lyDz1SFX; Fri, 21 Feb 2025 08:11:50 +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 51L8Bocb076947; Fri, 21 Feb 2025 08:11:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51L8Boqq076944; Fri, 21 Feb 2025 08:11:50 GMT (envelope-from git) Date: Fri, 21 Feb 2025 08:11:50 GMT Message-Id: <202502210811.51L8Boqq076944@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: 921c9c7bcc35 - main - pf tests: test new log(matches) behaviour List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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: 921c9c7bcc35747d61a9200c38da13c5fbce3643 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=921c9c7bcc35747d61a9200c38da13c5fbce3643 commit 921c9c7bcc35747d61a9200c38da13c5fbce3643 Author: Kristof Provost AuthorDate: 2025-02-14 13:55:30 +0000 Commit: Kristof Provost CommitDate: 2025-02-21 08:11:03 +0000 pf tests: test new log(matches) behaviour Ensure that a log(matches, to pflog1) sends all future matches to pflog1. Sponsored by: Rubicon Communications, LLC ("Netgate") --- tests/sys/netpfil/pf/pflog.sh | 61 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/tests/sys/netpfil/pf/pflog.sh b/tests/sys/netpfil/pf/pflog.sh index d885364e0df7..a315b88bd4c0 100644 --- a/tests/sys/netpfil/pf/pflog.sh +++ b/tests/sys/netpfil/pf/pflog.sh @@ -133,6 +133,64 @@ matches_cleanup() pft_cleanup } +atf_test_case "matches_logif" "cleanup" +matches_logif_head() +{ + atf_set descr 'Test log(matches, to pflogX)' + atf_set require.user root +} + +matches_logif_body() +{ + pflog_init + + epair=$(vnet_mkepair) + + vnet_mkjail alcatraz ${epair}a + jexec alcatraz ifconfig ${epair}a 192.0.2.1/24 up + + ifconfig ${epair}b 192.0.2.2/24 up + + # Sanity check + atf_check -s exit:0 -o ignore \ + ping -c 1 192.0.2.1 + + jexec alcatraz pfctl -e + jexec alcatraz ifconfig pflog0 up + jexec alcatraz ifconfig pflog1 create + jexec alcatraz ifconfig pflog1 up + pft_set_rules alcatraz \ + "match log(matches, to pflog1) inet proto icmp" \ + "match log inet from 192.0.2.2" \ + "pass log(to pflog0)" + + jexec alcatraz tcpdump -n -e -ttt --immediate-mode -l -U -i pflog1 >> ${PWD}/pflog1.txt & + jexec alcatraz tcpdump -n -e -ttt --immediate-mode -l -U -i pflog0 >> ${PWD}/pflog0.txt & + sleep 1 # Wait for tcpdump to start + + atf_check -s exit:0 -o ignore \ + ping -c 1 192.0.2.1 + + echo "Rules" + jexec alcatraz pfctl -sr -vv + echo "States" + jexec alcatraz pfctl -ss -vv + echo "Log 0" + cat ${PWD}/pflog0.txt + echo "Log 1" + cat ${PWD}/pflog1.txt + + atf_check -o match:".*rule 0/0\(match\): match in on ${epair}a: 192.0.2.2 > 192.0.2.1: ICMP echo request.*" \ + cat pflog1.txt + atf_check -o match:".*rule 1/0\(match\): match in on ${epair}a: 192.0.2.2 > 192.0.2.1: ICMP echo request.*" \ + cat pflog1.txt +} + +matches_logif_cleanup() +{ + pft_cleanup +} + atf_test_case "state_max" "cleanup" state_max_head() { @@ -326,8 +384,9 @@ atf_init_test_cases() { atf_add_test_case "malformed" atf_add_test_case "matches" - atf_add_test_case "rdr_action" + atf_add_test_case "matches_logif" atf_add_test_case "state_max" atf_add_test_case "unspecified_v4" atf_add_test_case "unspecified_v6" + atf_add_test_case "rdr_action" }