From nobody Mon Feb 28 15:39:08 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 4E08C19EAE74; Mon, 28 Feb 2022 15:39:09 +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 4K6l0r6lTrz4sMB; 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=1646062749; 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=IiraXucJZ2yJdYg+XeFuOPlUlAmJ1pes6jjxYqA7AXo=; b=adgiFPxpPAAqedC4TgaIczUQfDf/MXlyfI3C8siSmR5sWQZBL4hu5GpMe3dXHfIOkz1wUI bjD+2V5qZVGGup+/hBlWpsfS0KHq9212SWL9wP9kOHyYcTRmIhBmiZi1As/eC6HvS5RCoC fKE7MIGxM07i9TDIPrxHBjNkvBKWf058ME6flGVnfBwRnNCqw9FHpfKl5xGZi7a1hTwaXb wOmo4O9eR1WKR6796SQqGrGw028yiXUiJWH6Ca7ckdUU6FdLiS+cUZMEenHODycYo4Wabl vd57uH0zbpGE1csyEVsy6RYlsPEEDUB5LV+tJ3ZFXZQyzqNFZfISe8+Ql0Ow+w== 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 BA1311E128; Mon, 28 Feb 2022 15:39:08 +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 21SFd8OS085373; Mon, 28 Feb 2022 15:39:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21SFd8UT085372; Mon, 28 Feb 2022 15:39:08 GMT (envelope-from git) Date: Mon, 28 Feb 2022 15:39:08 GMT Message-Id: <202202281539.21SFd8UT085372@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: dff227195bac - stable/12 - 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/12 X-Git-Reftype: branch X-Git-Commit: dff227195bac2d2c199566786598317939558971 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646062749; 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=IiraXucJZ2yJdYg+XeFuOPlUlAmJ1pes6jjxYqA7AXo=; b=BGvxASAbU83D/LOpnVFJ+bVsceUtVEiKmPYlm1CSmYDOYIHgI8cr3pnhkjNXWz+4EU70ap f1IP2/sIZN1wb64GMqwHWcFuhP3EeetZ1LH4QfMZd1w93P/vOrM3q+5PDHXaXthvCPIW5o STmshemfGhORMk80Q6aaIo/Sc8UCFNCGRL96mAoCF57kpNFCZ7ASD83/FTyu3tK2506IQg Tqxa2/hqnHNEkguyz85Vl8hYm0bd/adWdvWmW9Yl8jLXp6o2m5YQfmnRHnx4AMQoUN2Xkm T6vNrjbn/LTZ3m2BbNaXIVYQEq+nUEs4wsgHqafp03hsKx4tyUK+pQe6QEwd8A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1646062749; a=rsa-sha256; cv=none; b=foO7l4ShzMUX4tp6z2b4CaaifyjpZq9rXVoMIbXD1TE9VEw+nyeEOuhpVHs5LAwjBMOrPa x8+KQD05GQHqHZuWN4GOz90u9VcL6B2KbEsMFZOrd7rOBIbaNXVnVHPRd1D6dZsNPeMtOh kBueLW/jtLwrii/ipWmdfk52WGJbXULapTWffUVrp3iPylv7kOzHlh9EzLmObyxUPMDf5M wmrwp4l6SRMPzitdtDzbSiy0zlwoyCwxxFylaVWNpy1TUjlywzXT1NIaFdjZQ2HZtCZd7D mX82PVqV2UmAS31833JZqIGWou5NkjoDT9YguQ3rKbefFnoaamDuVaY1siS/MQ== 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=dff227195bac2d2c199566786598317939558971 commit dff227195bac2d2c199566786598317939558971 Author: Kristof Provost AuthorDate: 2022-02-17 13:13:50 +0000 Commit: Kristof Provost CommitDate: 2022-02-26 08:26:15 +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 3d57fba8d2fb..07e830b92e16 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" }