From nobody Mon Mar 14 21:43:56 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 B71EC1A13803; Mon, 14 Mar 2022 21:43:56 +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 4KHVRJ4Nc3z3kVW; Mon, 14 Mar 2022 21:43:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647294236; 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=D30hC+0JkQ3b/rGTMIDNGzDU7srSNnP1sUYO8NREec8=; b=L6Mn2gzgzQAnNXavJeRXTuyykSxqnqhGn0N/zNc7Tz7iSXGdcdeGVy+HAUbYnh3F2TRLau Wo78pfs9JByWiw9PvFJ8RFiBQyNR4WiZbR5yfcaw6keHBmz+VHlIAQfNm3qDhDgsscCM26 fckWVsFaDEqnIBKJn9sL4VOsC4AmlPYlIvuZBv4x9ueELd06E+spIHpwMFGnPyjjHIYbRv 6wkeRlg28/EwNLfqpRhpsCvVImJKjzv/e55qea3qRsEOAwBWoxzrrgV5YJfGLXi5UK/1WV uTpMga062GaUHbckyWGnNTFAxlJuW7pMltG53encBN0CT76V4D7mfvW1XjwJBg== 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 65BFD15606; Mon, 14 Mar 2022 21:43:56 +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 22ELhuif017430; Mon, 14 Mar 2022 21:43:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22ELhuKG017429; Mon, 14 Mar 2022 21:43:56 GMT (envelope-from git) Date: Mon, 14 Mar 2022 21:43:56 GMT Message-Id: <202203142143.22ELhuKG017429@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: 734782a7814e - main - pf tests: Test new L3 inspection for pf 'ether' rules 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: 734782a7814e5eb473c97f29eaafc830b47c1d11 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647294236; 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=D30hC+0JkQ3b/rGTMIDNGzDU7srSNnP1sUYO8NREec8=; b=Mv4fXvJIsvgIfvlzyDnpFIFZK9pJ4MuCpCF92KE7zPGgi++0FJlbVH2STUmrWem2Y4Cuav vvuoItaNUrJbPkYBNHlwnBUWQYyrFBBETol9nqJ8WjN88wM87pP5wFIHFYJXLGp02GDov4 OGek1fHAcZwoZxUvldZJAIrCg96woQ6wkAJwhprbWLgpQte5sVYYAmCMNxWreeI6Dmf1Un ozzMWSyh8CdxFH9v7WlOYXXMAMTNJ/XeuTxeDVhQ+EknIFTrAZtxBqymIvIdv2qz0f2Uez PqX9D7XlsV7MJymm4s687O08ITBhZzCOX2KwgnlVyPVmiw0kGX0GeRRa532E0Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1647294236; a=rsa-sha256; cv=none; b=tGCkMyKFr72X/9/7U2H1PRYWVXWDuRXv+fgvFliuRQUxEkTIiMQ4RmuT6h/Ny3DFiV1uih Pt1iGP8u5DSHPD7hjWOzdfpENYy48Fo0TFU2SUS234nZ4P6p6IdprOe1lralR0rDvs5O4m ix7rCJ1W9oJKGY66rz73b82G36WG3Z44MhM6OUIjBTuIqcyEA7eqlHYE/sGlH3H2ligDwJ 0V/+xj/uZF3EsTvNsuAmE8tUaMP0JAah7meip1y3OoCbt58E1lgTpcxl4RdaNwDpqOp+9B zn8Iw4pgv8Mxk7zEOM/Yr83Vlh5mfljesVDedMTTqF70nHfMAQqDdpzXgLkCeg== 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=734782a7814e5eb473c97f29eaafc830b47c1d11 commit 734782a7814e5eb473c97f29eaafc830b47c1d11 Author: Kristof Provost AuthorDate: 2022-03-08 17:14:39 +0000 Commit: Kristof Provost CommitDate: 2022-03-14 21:43:38 +0000 pf tests: Test new L3 inspection for pf 'ether' rules Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D34483 --- tests/sys/netpfil/pf/ether.sh | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tests/sys/netpfil/pf/ether.sh b/tests/sys/netpfil/pf/ether.sh index 627d027f33c8..319956219fe4 100644 --- a/tests/sys/netpfil/pf/ether.sh +++ b/tests/sys/netpfil/pf/ether.sh @@ -497,6 +497,50 @@ anchor_cleanup() pft_cleanup } +atf_test_case "ip" "cleanup" +ip_head() +{ + atf_set descr 'Test filtering based on IP source/destination' + atf_set require.user root +} + +ip_body() +{ + pft_init + + epair=$(vnet_mkepair) + + vnet_mkjail alcatraz ${epair}b + + ifconfig ${epair}a 192.0.2.1/24 up + jexec alcatraz ifconfig ${epair}b 192.0.2.2/24 up + + # Sanity check + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 + + jexec alcatraz pfctl -e + pft_set_rules alcatraz \ + "ether pass" \ + "ether block in l3 from 192.0.2.1" + + atf_check -s exit:2 -o ignore ping -c 1 192.0.2.2 + + # Change IP address and we can ping again + ifconfig ${epair}a 192.0.2.3/24 up + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 + + # Test the 'to' keyword too + pft_set_rules alcatraz \ + "ether pass" \ + "ether block out l3 to 192.0.2.3" + atf_check -s exit:2 -o ignore ping -c 1 192.0.2.2 +} + +ip_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "mac" @@ -506,4 +550,5 @@ atf_init_test_cases() atf_add_test_case "captive_long" atf_add_test_case "dummynet" atf_add_test_case "anchor" + atf_add_test_case "ip" }