From nobody Thu Sep 15 09:29:21 2022 X-Original-To: dev-commits-src-branches@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 4MSsNL0N44z4bdky; Thu, 15 Sep 2022 09:29:22 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MSsNK6yfDz3Y5c; Thu, 15 Sep 2022 09:29:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663234162; 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=S4st+PFqlcqLJfA0Qm8sVt5R1/qSV0rJkeO1UTecly4=; b=bDKOpKZoQg2i6Cohi/wGgV9yncdlyNyFaUO+HNEpU5C26+NOE3NkbsbPEqwAPVSHPJgoCf kEDklYB04u/Lv7yIf9qyZ5E1GAQp24i1Vx7q3wtk+vsyrfxGntTAb+ndYZvekfix9Zof8o O+malgInBBIDmS6M1DomdaSHUf3Ugt2otOHNiHSAHl7C7Z8etVxgnin2cp5wNobno6oeO5 ePCRhB5SbTKlJBRY/7/BRMTR+fBSi5AfHsJOqtx7S5c7O6G3Tn+kG5U+r78MO+cuv0kTHH 3ybEOPZAtXuLThTF4D1yXYFr07xwzLYQ0j3IGUJHHPtQAY0tlglb5DMvpcF9kQ== 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 4MSsNK6023zyVf; Thu, 15 Sep 2022 09:29:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 28F9TLi5013878; Thu, 15 Sep 2022 09:29:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28F9TLaL013876; Thu, 15 Sep 2022 09:29:21 GMT (envelope-from git) Date: Thu, 15 Sep 2022 09:29:21 GMT Message-Id: <202209150929.28F9TLaL013876@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 8c5425c07fd8 - stable/12 - pf tests: test wildcard anchors List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/12 X-Git-Reftype: branch X-Git-Commit: 8c5425c07fd880d878782d15430893e6d6b95b44 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663234162; 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=S4st+PFqlcqLJfA0Qm8sVt5R1/qSV0rJkeO1UTecly4=; b=DhtB8PmkOHcLW3FA52Bg74X2UmqDhF/ztAWxn0kUKEjsOYajc3uotaS6/bmGM7kgCh4nPO KBLaeff30jSjlo6m0yumHsHLpCu+PkD8nejpcSQ0mm4b79NWdAzat8Z/xOCsfpBSsMvFef 9ArXtGiP2LTlTjHZlVwQML7v6brTer/FuOz50luenoIbXR/BNK25Fwi5VrdG6/73koshWP oKiaRotYiJ5TqmoNEiRHzbR8EjmBiOHOY2SazFh1Ku4lyfp+Uek1+u13Fx9F6W1agLNTVl VLvoOx2gU9QBQcifGySvd4FjZq4ucrvFlB+NMdpS1NEouE+i0umKnlWXYXOCHg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1663234162; a=rsa-sha256; cv=none; b=qoLz4wG3iW8coBuurZgDvdlMa5vdqSZ0L1QwyidCmF+o7xDX1sP04aD9+rb3lP425YEgmA /l7khRq763/uCT3u12lwD91EzzhqQ9QZSOSa/Ghe/Eby220D2naHtAWdqhQMepfMNkZqV9 Q7r47+cto3gvcvuzaPZvlMuUVa3QfgxNd7Bbk9yJ/BixTuueJn3SEFJ3ZxYInjw1rCHjww L96Er0UWSXbGN9gXPQV9GbLKsARdnrznU4qQNEY6CXQN+bxhXeX9Rw3gbsF3PuseaPeM77 pMbFXKSIkeDnsdSzlgCMug+LE11Ym7HAwu9AbzPWGuDT83DXQdsqCKC6uFUsRw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=8c5425c07fd880d878782d15430893e6d6b95b44 commit 8c5425c07fd880d878782d15430893e6d6b95b44 Author: Kristof Provost AuthorDate: 2022-08-31 13:40:33 +0000 Commit: Kristof Provost CommitDate: 2022-09-15 09:28:59 +0000 pf tests: test wildcard anchors Ensure that a wildcard anchor actually includes any nested anchors (i.e. foo/* will call into foo/bar). MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D36414 (cherry picked from commit d5a0bf4517c053803b266742d16be456c5393ae7) --- tests/sys/netpfil/pf/anchor.sh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/tests/sys/netpfil/pf/anchor.sh b/tests/sys/netpfil/pf/anchor.sh index 4fd3697155d9..27903d469507 100755 --- a/tests/sys/netpfil/pf/anchor.sh +++ b/tests/sys/netpfil/pf/anchor.sh @@ -93,8 +93,47 @@ nested_anchor_cleanup() pft_cleanup } +atf_test_case "wildcard" "cleanup" +wildcard_head() +{ + atf_set descr 'Test wildcard anchors for functionality' + atf_set require.user root +} + +wildcard_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 \ + "block" \ + "anchor \"foo/*\"" + + atf_check -s exit:2 -o ignore ping -c 1 192.0.2.1 + + echo "pass" | jexec alcatraz pfctl -g -f - -a "foo/bar" + + jexec alcatraz pfctl -sr -a "*" + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.1 +} + +wildcard_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "pr183198" atf_add_test_case "nested_anchor" + atf_add_test_case "wildcard" }