From nobody Tue Sep 06 11:19:45 2022 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 4MMNFt0VMkz4bZ8Z; Tue, 6 Sep 2022 11:19:46 +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 4MMNFs6nXQz3mH1; Tue, 6 Sep 2022 11:19:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662463186; 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=G7K49hXrfAAqp77FoevpHygIRvqVWCq54XCdtESyF3k=; b=B0WwqCD/7ldop9XHqBTHLjUhrKJq7q62LSdx00vFnO+P0EfP4J7DITYyMeoxmOvAOMs/rU BzoZPEG0rnz3/PqczAgwUzaFjt+A8ujWmdA59C72DVpMejwI7RyBPu0dyauzRc6Vs8p+XH cX+SVmlCvKditDNr5vXd/HQUsGQ/g6NB6k834xsOMI6lq3nieggmmB617ioBAS0DUoxSaM UyZRTJx7hjeH32oA75cYDy/OTC+wHwSRysiZ0l0g6F+b1pM74Gz8F33Zp4V+XCJvFJSldY lJrTNvGqfJdE++4hU2su1213vFk89/mpUXjcLVcVqpGTluUo5GkhSXjwnrcj7w== 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 4MMNFs5pWmz18RS; Tue, 6 Sep 2022 11:19:45 +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 286BJj5N024888; Tue, 6 Sep 2022 11:19:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 286BJjxe024887; Tue, 6 Sep 2022 11:19:45 GMT (envelope-from git) Date: Tue, 6 Sep 2022 11:19:45 GMT Message-Id: <202209061119.286BJjxe024887@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: d5a0bf4517c0 - main - pf tests: test wildcard anchors 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: 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: d5a0bf4517c053803b266742d16be456c5393ae7 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662463186; 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=G7K49hXrfAAqp77FoevpHygIRvqVWCq54XCdtESyF3k=; b=AN40yuoxHPT7wzRFjBpNz1GM7Rx1wtgA+l3b8SxxWJvldKASkkF812MHp/Ro+0j0+oQsWM xmawTm3yz2iTl8iQvlVBYPQS2EuItcrKDXrsquU4nMJprq3wAhIGUBhxMcg8HKSQgQawaP PJFHDbZWTJ+dgpegxMZi9hxVwrrNJioFpYspr+z79NQ/+/A6P8Alve6Y0EUs5ceijYwt2Z vcUPJJK0p2RcCGBzqH3ZupIJmytX22gZM9/xKtn5QQbhW2BrV3tYRvu+jx88rVEGAn3zdX S9MlTziavw/1YVLk8rJrIFdhtnRmPZLUOlkvjSt/0eGVijCGVMvmGDivsS2dZg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1662463186; a=rsa-sha256; cv=none; b=qWXAa9jA5H3dp2TnMS8xFlfNHT59f+BZ50+cqvOTXRIENEYumXIwQkFSQyDxCuWBG4onT+ 1d31YCvMUyi1LKe0xyKPiZwg2EPqFkF14AcAcfQJol7gsAVKixp2XChatI/Yasik2A8WR3 41/1rSl0DF/V5P/VkQhr0Iew+Kwwna7a09X/92PPsRte3Mi9poPUcdl5FF3vDbVRJ9kRYq F1WXzQZihv+WTGXunWRwNw9zW4dv1gpUDeDSwgIwTeNe/1G7IStPbwZjrJ5vaVR7VVki// CVROBhPKAj7UJirxJXPxJcjYdzMeaLGdkcgSI4fXomDrzZ486AnKb5KnK6vxsw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d5a0bf4517c053803b266742d16be456c5393ae7 commit d5a0bf4517c053803b266742d16be456c5393ae7 Author: Kristof Provost AuthorDate: 2022-08-31 13:40:33 +0000 Commit: Kristof Provost CommitDate: 2022-09-06 08:42:09 +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 --- 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 100644 --- 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" }