From nobody Wed Nov 02 14:51:31 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 4N2VFv536Rz4hKVK; Wed, 2 Nov 2022 14:51:31 +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 4N2VFv40g0z3RpX; Wed, 2 Nov 2022 14:51:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667400691; 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=ED01W6K5M/hVW2xLJ5+dllz/SaH84k4mYCLibfy0BdM=; b=nf6I6G+2Yz04/6Qqpkyvn/zOWWaI0rELM8JI5eIsN3vca8XYoz3YD3jt/wq7X4CXegDh/m i6HnNcHk6NccebEGqzFIw6zbzcGHfECRcWmtYbzXKAG3FaiSdShp2CFlHqe6dLRuX7MlNZ FqlEMs/9wssbdotjEVyqMtJDWwyULjwTXDhLjdY51GeFvN64/6V+a752b02/5Obzxklt6P 4V7lCbjH5I4n16nuuIDo1JwzRS25IhEbV2Bm9UGCC6kRsb4YUshes4xSV6XPMXtKO3+HYk 9SbPGzxVgGqu0HuycGN/excv2XYm6f+/C1qDntcFXcCKcVGh8JFXR3gCrl6NVw== 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 4N2VFv34qNz10Rq; Wed, 2 Nov 2022 14:51:31 +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 2A2EpVTO075268; Wed, 2 Nov 2022 14:51:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2A2EpVXZ075267; Wed, 2 Nov 2022 14:51:31 GMT (envelope-from git) Date: Wed, 2 Nov 2022 14:51:31 GMT Message-Id: <202211021451.2A2EpVXZ075267@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: a7222b3cc341 - main - pf tests: bridge-to test case 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: a7222b3cc3417929b520b96672af86a19902d8a9 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667400691; 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=ED01W6K5M/hVW2xLJ5+dllz/SaH84k4mYCLibfy0BdM=; b=EIIE8tt2SWwq99/PeVkvmJAJdBOz/ugN1dHCpxFOVyr3+2SmWn417UmWJ4RitNPiM07jdU 1TnZn5WpLzEJr9vuBXY+FdZgAImkEIDFC49NeMdN8e4HzEsU38H2/YPYKe9l6wi+/HoQCm vULPlHJ+vtQtCtz3XXsai+/7oBMYJAOmDW4HA9pesxC5EXIkGy1cq9Xdy0q1k1WaCVxXHV 5REL3Obm2ONBCZeIYzc9HDe8U9P9KiIL+BCSHbjDwzKE2W+UX1v/4RGFIdBt7v87VQFzAr CHlTgwFrh8rVglgUkdwxE9GOm8UZbTGEs67f1dhE3he49uezu5MkGLnaCab4SQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1667400691; a=rsa-sha256; cv=none; b=TQD3kev2PUhcxyV8JJGLRK1De0T2zGcpKfMyrybFav805H3ySN1JSf1ZD1bU3RIF1d59QV 0tbuQisTJwEYUt9+YixcxSfByueesBM0x0s3TL+WK+wX8o47NII2GBgqb0wSiGA9zan4Or pNq7hYNChafoZKQfrZbhx6nKNp0uXHAhAfCW51pDYDMlmAckWDffnLTa5tkcFhMQBawRFK p8Fbtc6X1chKgVOCxtgEb2U1G4+YW7s8ZUFe1fqgnk4Ci/4dbU6SCUP9dx1XzfagQMZnDY P2vFyFgnsMxNdc8QYbbnl5oK14qZkHhdGISYyxI3cAFWWhpIT1qlbw92xKh3YA== 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=a7222b3cc3417929b520b96672af86a19902d8a9 commit a7222b3cc3417929b520b96672af86a19902d8a9 Author: Kristof Provost AuthorDate: 2022-10-28 09:56:43 +0000 Commit: Kristof Provost CommitDate: 2022-11-02 14:45:23 +0000 pf tests: bridge-to test case Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D37194 --- tests/sys/netpfil/pf/ether.sh | 51 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/tests/sys/netpfil/pf/ether.sh b/tests/sys/netpfil/pf/ether.sh index 63ca9080cbd2..9db1528b6df7 100644 --- a/tests/sys/netpfil/pf/ether.sh +++ b/tests/sys/netpfil/pf/ether.sh @@ -27,6 +27,8 @@ . $(atf_get_srcdir)/utils.subr +common_dir=$(atf_get_srcdir)/../common + atf_test_case "mac" "cleanup" mac_head() { @@ -680,6 +682,54 @@ short_pkt_cleanup() pft_cleanup } +atf_test_case "bridge_to" "cleanup" +bridge_to_head() +{ + atf_set descr 'Test bridge-to keyword' + atf_set require.user root + atf_set require.progs scapy +} + +bridge_to_body() +{ + pft_init + + epair_in=$(vnet_mkepair) + epair_out=$(vnet_mkepair) + + ifconfig ${epair_in}a 192.0.2.1/24 up + ifconfig ${epair_out}a up + + vnet_mkjail alcatraz ${epair_in}b ${epair_out}b + jexec alcatraz ifconfig ${epair_in}b 192.0.2.2/24 up + jexec alcatraz ifconfig ${epair_out}b up + + # Sanity check + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 + atf_check -s exit:1 -o ignore \ + ${common_dir}/pft_ping.py \ + --sendif ${epair_in}a \ + --to 192.0.2.2 \ + --recvif ${epair_out}a + + jexec alcatraz pfctl -e + pft_set_rules alcatraz \ + "ether pass in on ${epair_in}b bridge-to ${epair_out}b" + + # Now the packets go out epair_out rather than be processed locally + atf_check -s exit:2 -o ignore ping -c 1 192.0.2.2 + atf_check -s exit:0 -o ignore \ + ${common_dir}/pft_ping.py \ + --sendif ${epair_in}a \ + --to 192.0.2.2 \ + --recvif ${epair_out}a +} + +bridge_to_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "mac" @@ -693,4 +743,5 @@ atf_init_test_cases() atf_add_test_case "tag" atf_add_test_case "match_tag" atf_add_test_case "short_pkt" + atf_add_test_case "bridge_to" }