From nobody Tue Dec 17 10:08:14 2024 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 4YCCDv10Jmz5h0wv; Tue, 17 Dec 2024 10:08:15 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YCCDt620Vz4Bs3; Tue, 17 Dec 2024 10:08:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734430094; 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=ol6Xpj1t8PYdzWgewNUtjJstsFJ30J3E0o0pOlnqT7c=; b=phxmpHqrWh1r8vrlxSGD9tEWxtI+jAIIQ3ySlfdQ3Re/OQcrum8EdUoJQeyQiAh7HmMSPR QzinEBxMkYuxH3lmi+Hi0zw7oqor8tJQSiNj5kMyvy1qBfnPuAmab/Msyvxyqj2MWG0I9k 0dsEPW+uwk/SfdAzTBot/cNMQk0u8ihf0mRq1NSqUQaYHY/FccukSiqrVN8cXzXvGULaQ0 gaNT4an2Y5O1HK9Sx9Yub3Q6XsVPWL+ZRzDMIJaV8nmRPiztaF9sLYHGPBha9PV1NitBM0 T3yHvW7wNjc9ATtKHAXs8HfflzakwSqtytB1kAckrlRbSCuCWrogQriANVH0gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734430094; 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=ol6Xpj1t8PYdzWgewNUtjJstsFJ30J3E0o0pOlnqT7c=; b=kJWpE0uZH49N4EVNYCTbqG0FeXI+zYSQdKWg5Oar6WaNg67qhvvj8mqcLqLobBbdKW/x+j d4hTCQlSMbR7gM8WfntwmN+1TFywwZzwRrKfym9aHnUCAfcZKjXArsc5lJgqyZ99iDRev0 Plwt7sBVUmUG2RRQv7kQqq/kufosTmAwC7jlr9U4WNVS+3MHwpLlTORorp6uGrfHbZJyFG GqGmWJRUQWw3acgZNzp4rQCzKfYCHkiXzfAVPdtLbXn18IQEdQ+mxlBoRt+1yq9re1Hroi X+ZrRfwFTDzFC5vflBZhKW4Q1oqNN6ZDJrg3FLZX3Uz2ouLKb2l2YNc16DOojQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1734430094; a=rsa-sha256; cv=none; b=QvQDVdpXPhqf6zoT2L1ms67Fc8ZTNJrwfQqT/mjkyz9H4QA8xq9bw2MrzEGfCyW824LNhe +WqmMoDP+dJ3Q+tTak8J3i7/DjO1QtInRFjku5IqIYm58oXB2cSwL7kg6M420Rie5hKSsv b6/V2vhX5uJoE2EGum00vVsixPhJRsBffkJ0KPeJJfFRoD7n8aWWdRauoBWau8yEdyxjGn CSo8Q4G6mrh+XtSOrmaSW9KE/tKUAUA/ehufMpMHJf3lJCpVR+f16ComzASAVQmytGJ4Mi 8vHWcCDXlV5Q1nv0YdKLM8CW1l4UqLllNDmPGfTWdIGSjPdPi8NUQRxDdHSonw== 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 4YCCDt5DP0zJjp; Tue, 17 Dec 2024 10:08:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4BHA8ERL024943; Tue, 17 Dec 2024 10:08:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4BHA8EGA024940; Tue, 17 Dec 2024 10:08:14 GMT (envelope-from git) Date: Tue, 17 Dec 2024 10:08:14 GMT Message-Id: <202412171008.4BHA8EGA024940@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: bdb583afa198 - main - pf tests: test address range as nat64 from address 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-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: bdb583afa1980b5479836a4b6d2977da1648cd69 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=bdb583afa1980b5479836a4b6d2977da1648cd69 commit bdb583afa1980b5479836a4b6d2977da1648cd69 Author: Kristof Provost AuthorDate: 2024-12-11 10:47:43 +0000 Commit: Kristof Provost CommitDate: 2024-12-17 10:07:18 +0000 pf tests: test address range as nat64 from address Sponsored by: Rubicon Communications, LLC ("Netgate") --- tests/sys/netpfil/pf/nat64.sh | 65 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/tests/sys/netpfil/pf/nat64.sh b/tests/sys/netpfil/pf/nat64.sh index b0559ac1f98c..3091213baa0c 100644 --- a/tests/sys/netpfil/pf/nat64.sh +++ b/tests/sys/netpfil/pf/nat64.sh @@ -276,6 +276,70 @@ no_v4_cleanup() pft_cleanup } +atf_test_case "range" "cleanup" +range_head() +{ + atf_set descr 'Test using an address range for the IPv4 side' + atf_set require.user root +} + +range_body() +{ + pft_init + + epair_link=$(vnet_mkepair) + epair=$(vnet_mkepair) + + ifconfig ${epair}a inet6 2001:db8::2/64 up no_dad + route -6 add default 2001:db8::1 + + vnet_mkjail rtr ${epair}b ${epair_link}a + jexec rtr ifconfig ${epair}b inet6 2001:db8::1/64 up no_dad + jexec rtr ifconfig ${epair_link}a 192.0.2.2/24 up + jexec rtr ifconfig ${epair_link}a inet alias 192.0.2.3/24 up + + vnet_mkjail dst ${epair_link}b + jexec dst ifconfig ${epair_link}b 192.0.2.254/24 up + jexec dst route add default 192.0.2.2 + + # Sanity checks + atf_check -s exit:0 -o ignore \ + jexec rtr ping -c 1 192.0.2.254 + atf_check -s exit:0 -o ignore \ + ping6 -c 1 2001:db8::1 + atf_check -s exit:0 -o ignore \ + jexec dst ping -c 1 192.0.2.2 + atf_check -s exit:0 -o ignore \ + jexec dst ping -c 1 192.0.2.3 + + jexec rtr pfctl -e + pft_set_rules rtr \ + "set reassemble yes" \ + "set state-policy if-bound" \ + "pass in on ${epair}b inet6 from any to 64:ff9b::/96 af-to inet from 192.0.2.2/31 round-robin" + + # Use pf to count sources + jexec dst pfctl -e + pft_set_rules dst \ + "pass" + + atf_check -s exit:0 -o ignore \ + ping6 -c 1 64:ff9b::192.0.2.254 + atf_check -s exit:0 -o ignore \ + ping6 -c 1 64:ff9b::192.0.2.254 + + # Verify on dst that we saw different source addresses + atf_check -s exit:0 -o match:".*192.0.2.2.*" \ + jexec dst pfctl -ss + atf_check -s exit:0 -o match:".*192.0.2.3.*" \ + jexec dst pfctl -ss +} + +range_cleanup() +{ + pft_cleanup +} + atf_test_case "pool" "cleanup" pool_head() { @@ -438,6 +502,7 @@ atf_init_test_cases() atf_add_test_case "sctp" atf_add_test_case "tos" atf_add_test_case "no_v4" + atf_add_test_case "range" atf_add_test_case "pool" atf_add_test_case "table" atf_add_test_case "table_round_robin"