From nobody Wed Mar 2 16:00:49 2022 X-Original-To: dev-commits-src-all@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 8F2D119E0B4E; Wed, 2 Mar 2022 16:00:50 +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 4K7zNx6yh1z3NCH; Wed, 2 Mar 2022 16:00:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646236850; 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=ezWsnOhcbK6zhxuOBKyMnTVQpDNguHjufbTkRefqFp4=; b=LNi5x6XmHL8fXz3uV6Vue72zeCR/TxGJxGM/RiOL2Y7DKPg/2gFknFTuakfQoyJCEd6IWS C2Gy82RT+FS7ramEH4jR160c05iZJgt94BdcKAHmVEaoxR6dh2FGVS5be0dccKoC93DDLy YtBGPGlzJBFxzoGhT5pHg20gct3jJl5I9UVTu7iioh0fN6k1C0J0VGdkkjDfFIJybVBPHC lB8KTCbCnHdywnQ5tzE/tFW10yUm8i77jNA4PGeRv4OrUZRLz2JVEC0nOGHNlkyGE87KLR ayHGwoNEe6xpVT3XdOk6n0Q/4PoP3VChOMrPPqdLTXdCQ1iBu7gggv4FbfXrMA== 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 4DE9A26229; Wed, 2 Mar 2022 16:00:49 +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 222G0ngn091127; Wed, 2 Mar 2022 16:00:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 222G0nCf091126; Wed, 2 Mar 2022 16:00:49 GMT (envelope-from git) Date: Wed, 2 Mar 2022 16:00:49 GMT Message-Id: <202203021600.222G0nCf091126@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: 4ffb7d1300a6 - main - pf tests: Test EtherType filtering List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 4ffb7d1300a6e4d46ab7fe212509ba32555d1024 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646236850; 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=ezWsnOhcbK6zhxuOBKyMnTVQpDNguHjufbTkRefqFp4=; b=u0LPxCQBik4vuaL0zb59ihprKl21NGj/4MbIj8vxEP+2Q/jHvbCCabeqTkUIMdgQ5v7H36 uO0w506gS2vigLEkHnQ0FBhdx1OYklPCnOD9/Vd9Tdj0ukTJRqczp/9yyuZdIqLAaZJKPn 7WMX7lL6vMJbX1CgM+rxI/ZZcZi/XRSk2oAJr5I+K5JrJxegvH2R/TuAB8qbxb+i7fzIAR O9ARQ/iFBMWLfLj2tj6QDyIDrCmiiHSDoQDDdHrOb0VZQgCqki+1XNPJE+yoL6ZuDHF+Hu pomhXbpnyo3x5vc95PiLoZ6SNExfCH/QM3KikD14MA63qEMeolqLRrHS4bq5oQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1646236850; a=rsa-sha256; cv=none; b=MlamfnBQjq28heBGnOF/2y1S2abgrQfcBOgNIQh/facihYZf52tdI+SDo2h820Qd9Dlbne 1cbjL/8Fcj5qibBYllO48UyQdsqKWpaOUO9Z1eTMWXsgAqqG3rFG58x2rYsbtC59+Tf1f9 vKD5obqrDeMI7utRbAsvP2NSEx4vjGI4mk5QZMmXC89VPoS5WIrns+D5QUkH03UCFjIw0Q 5qkuWf+x7FYASAd3iIUPwpGb/9Bwch5PAG8/bgx0x0t8BKO6aJCbeIANc91ct7OSUk2IDX NLXU5jvjx/0J0lR0J1RBox5xtOsaL3JpCQdHqg5XRy2qM8qynwptISTUi41P9g== 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=4ffb7d1300a6e4d46ab7fe212509ba32555d1024 commit 4ffb7d1300a6e4d46ab7fe212509ba32555d1024 Author: Kristof Provost AuthorDate: 2021-02-10 09:42:06 +0000 Commit: Kristof Provost CommitDate: 2022-03-02 16:00:05 +0000 pf tests: Test EtherType filtering Test filtering packets by their EtherType (i.e. ARP/IPv4/IPv6/...). Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31745 --- tests/sys/netpfil/pf/ether.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/tests/sys/netpfil/pf/ether.sh b/tests/sys/netpfil/pf/ether.sh index 2781dda611e5..273c5654afa5 100644 --- a/tests/sys/netpfil/pf/ether.sh +++ b/tests/sys/netpfil/pf/ether.sh @@ -91,7 +91,50 @@ mac_cleanup() pft_cleanup } +atf_test_case "proto" "cleanup" +proto_head() +{ + atf_set descr 'Test EtherType filtering' + atf_set require.user root +} + +proto_body() +{ + pft_init + + epair=$(vnet_mkepair) + epair_a_mac=$(ifconfig ${epair}a ether | awk '/ether/ { print $2; }') + + 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 + + pft_set_rules alcatraz \ + "ether block proto 0x0810" + jexec alcatraz pfctl -e + + atf_check -s exit:0 -o ignore ping -c 1 -t 1 192.0.2.2 + + # Block IP + pft_set_rules alcatraz \ + "ether block proto 0x0800" + atf_check -s exit:2 -o ignore ping -c 1 -t 1 192.0.2.2 + + # Block ARP + pft_set_rules alcatraz \ + "ether block proto 0x0806" + arp -d 192.0.2.2 + atf_check -s exit:2 -o ignore ping -c 1 -t 1 192.0.2.2 +} + +proto_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "mac" + atf_add_test_case "proto" }