From nobody Thu Feb 17 13:15:06 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 8742119CFCFF; Thu, 17 Feb 2022 13:15:07 +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 4JzwKl0SSNz3LD2; Thu, 17 Feb 2022 13:15:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645103707; 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=XGTb828ZV9TjPY/SkLqkc1cFpLef6HfLSE77R52RxxU=; b=LTfJgYcEqZkBJEM/SIj7YCUM0RbI+CG3vg3MhyTvpjSpSWkQOfK3rUxJiNUY+MLkfz5cRu 23k0ZLL5ZoskCyT+LObcg45kbszJEmF1SsxVEfvk7uQFkNONvJBBwwAoKhFYQHt/z//cYp vPB3S+XeYdseIdxucHaCt4xkmZCR903tYb486ieaYlpXMBHUcFy9pW07vqD9MYSl+fstRw Izw4qWBMsEg6ykNckr6nlR9JbGh4UP1j+ibchNRATU5neWXrkJvTqSn6y9u6CHqN6vT3BA hTzscFwBsXPrydd6PMr5FMj38fo3g/7o7ohs/AMxZFRZIzBFGDJuiSGqyUEbjQ== 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 D2DEF276A; Thu, 17 Feb 2022 13:15:06 +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 21HDF6Qk008056; Thu, 17 Feb 2022 13:15:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21HDF6bZ008055; Thu, 17 Feb 2022 13:15:06 GMT (envelope-from git) Date: Thu, 17 Feb 2022 13:15:06 GMT Message-Id: <202202171315.21HDF6bZ008055@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: 7d3fc84b2d3e - main - pf tests: Test per-anchor tables 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: 7d3fc84b2d3eb18b675200dbf7732ef41eb79fe2 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645103707; 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=XGTb828ZV9TjPY/SkLqkc1cFpLef6HfLSE77R52RxxU=; b=TKXSE54IhzLwLU6A3KBF2OVJUg0X3rctK8xZYoWp3+o2hNhi+YGPC44ulesBOrLSbwzRJz geOzSr4hZdGgXTYsbIJ1/e4tzoRv3qxQ0TWkkkLknLDeQI3tefCCqgqbe//X+ccdLYPlOl 0f9LNJ7iHD/E7FhBMP8vVCGNYUeTqhCVeeaCFfCKO95oczNMLIvKXGYhaWUGLJ+pLXDGQi yQBTWj3TbCRJKU5jjeZg19/Rcc7hTJEXJKB74FCx0JWQMznYJav8iPtfDuOq+jXz+1KoS6 PvXRb5VmqY3QhtCRYK9KRVd03GcfaZ58pdV0cuVeywfhEaFRLU74R4uKsCcN2g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1645103707; a=rsa-sha256; cv=none; b=R3FaG4r8lKwiZe7UDLkrkt+1UtLnw8vyAYPm4rwJpMAzfYtjFPp16jkwoJUqsxs78icJAD 70J4HTzmswO8l0GuYjuTVCUiX8Q0W6t7nddhC6ucRXDMRvCnVP45UX8G+v87ztFRDtZP6t Zz+DpLxijlReStOZ/4VjPy2itHznBKMJq/+hvAPH88eysCKFJaK/9v4p+feP/JPG8tdJeD CIgE+kUZZlQPJEHjdEImcZaSA6uAGibO9NjGovL/PXOfqSIHq/GjhT7/Blzm2xsAZwO1+r TpFiKPdplFe/EUeM7XXG719wyjan4v9jtVYpQWqy6hHh8FQQZm4VSoHp/DrTPw== 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=7d3fc84b2d3eb18b675200dbf7732ef41eb79fe2 commit 7d3fc84b2d3eb18b675200dbf7732ef41eb79fe2 Author: Kristof Provost AuthorDate: 2022-02-17 13:13:50 +0000 Commit: Kristof Provost CommitDate: 2022-02-17 13:13:50 +0000 pf tests: Test per-anchor tables MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") --- 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 b224f3520bb9..ef23a71711f2 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 "network" atf_add_test_case "pr259689" atf_add_test_case "precreate" + atf_add_test_case "anchor" }