From nobody Mon Feb 28 15:39:07 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 1F3AA19EAEC6; Mon, 28 Feb 2022 15:39:08 +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 4K6l0r062mz4sJx; Mon, 28 Feb 2022 15:39:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646062748; 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=vP67/hM2bvw2kYI46I6wQafunIvCGIa6pjg8hvLdfa8=; b=PpYDYKo1LfTFDgfvOavnx7nrA7JbQ712dFKXecEqv//9Gpu/Cpum4Wtw5Hhl6e7aPwn4QB oDZ0KQa6VwV7tUqy2VngPVqt9GZMaZNAbdt8X5s9Chqmcr53FEcLX2eGvou/QaFUCm/ki8 Drrkc7yoe+cS6RC9SPGydG4/ykP3dKEWND3zOZyUxm5+ddirxJ1N0W85oOr8GO33eMQABN sezLojfqB0ylSW/rW54+JqrmsyEnoSaPM5I2O5AvZTvjb9pXKvhAj8unuCjEtQKa8/hVMO bt87uhAbEiC9vKNSU/AuD/0m6l8bpVw5fYy+6tjw6uepzeJfZPhDLyDLyvz/CQ== 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 C05AA1E190; Mon, 28 Feb 2022 15:39:07 +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 21SFd7oh085349; Mon, 28 Feb 2022 15:39:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21SFd7av085348; Mon, 28 Feb 2022 15:39:07 GMT (envelope-from git) Date: Mon, 28 Feb 2022 15:39:07 GMT Message-Id: <202202281539.21SFd7av085348@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: e41b30c849ed - stable/13 - pf tests: Test per-anchor tables 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/13 X-Git-Reftype: branch X-Git-Commit: e41b30c849ed9cb5b6c6a9afbd7c37c0d2dcb7bf Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646062748; 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=vP67/hM2bvw2kYI46I6wQafunIvCGIa6pjg8hvLdfa8=; b=e/wcFIqX8RQiglSqcjYIaFvQhdD5Hc2e+xwBbkt7TJYHyJcOiEuej2I9HvXWY1iNDFCdOf kAZ9GdyNawYjvgeO436XbS8h9roZL92tR1uFX68zg25bbBwyZ02lbmEPczljrbpYkhKUwF f9IcBfGTHluVa1gJcg0tXW0X1+7T6O4k49IrE0YftMt4v4aGNjI5W8E+GOkur+weNYvV5G Yzevf2L85gfQ/jksLvccoMgciN3GWgpMlXHnNu+s7P92M6eTe9a0zNsEL8KshJS6gY/dzk zRvLkYysC/pmFH2Cf9Z545UsM4pumyTBsKqnswPuJqJtz/5h7bqo1YEIWAv7qA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1646062748; a=rsa-sha256; cv=none; b=tz4cx9cVTUdYJm/FMo4Zb4usQ5N/G9shZWMJgks/xi0BlAmyXdBFLiwXD9vVFom+K9mYgS eVe5PxDfaEThF8xJ0v9ZNjDqEkChdU2o3Pt5pOPVy7y/C+sdtI44XxbV5PsDjbxkphoTdh cOm/xMn7+A8lzP9Nvo6OjTcY4QtKkMFmhU5zmArep62YseZ4oJXTPm3pxinhyqj9z73WWw kcYXSptH9CBN1yXe+DMb2pyVOKzZ5uC2+YlyHrA4kj8gFX2PaK2jzKmsYUKFcaBoufprSU PUaHvhSAc9xZdAqTIV/ui/r+vNX9fSCXloIvH18IuuJ5WE64h4VgOhyD9uZBzg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e41b30c849ed9cb5b6c6a9afbd7c37c0d2dcb7bf commit e41b30c849ed9cb5b6c6a9afbd7c37c0d2dcb7bf Author: Kristof Provost AuthorDate: 2022-02-17 13:13:50 +0000 Commit: Kristof Provost CommitDate: 2022-02-28 15:38:05 +0000 pf tests: Test per-anchor tables MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 7d3fc84b2d3eb18b675200dbf7732ef41eb79fe2) --- tests/sys/netpfil/pf/table.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/tests/sys/netpfil/pf/table.sh b/tests/sys/netpfil/pf/table.sh index e363c86a4939..cc95daba048b 100644 --- a/tests/sys/netpfil/pf/table.sh +++ b/tests/sys/netpfil/pf/table.sh @@ -277,6 +277,48 @@ precreate_cleanup() pft_cleanup } +atf_test_case "anchor" "cleanup" +anchor_head() +{ + atf_set descr 'Test tables in anchors' + atf_set require.user root +} + +anchor_body() +{ + pft_init + + epair=$(vnet_mkepair) + ifconfig ${epair}a 192.0.2.1/24 up + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b 192.0.2.2/24 up + jexec alcatraz pfctl -e + + (echo "table persist" + echo "block in quick from to any" + ) | jexec alcatraz pfctl -a anchorage -f - + + pft_set_rules noflush alcatraz \ + "pass" \ + "anchor anchorage" + + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 + + # Tables belong to anchors, so this is a different table and won't affect anything + jexec alcatraz pfctl -t testtable -T add 192.0.2.1 + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 + + # But when we add the address to the table in the anchor it does block traffic + jexec alcatraz pfctl -a anchorage -t testtable -T add 192.0.2.1 + atf_check -s exit:2 -o ignore ping -c 1 192.0.2.2 +} + +anchor_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "v4_counters" @@ -286,4 +328,5 @@ atf_init_test_cases() atf_add_test_case "automatic" atf_add_test_case "pr259689" atf_add_test_case "precreate" + atf_add_test_case "anchor" }