From nobody Tue Dec 17 10:08:11 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 4YCCDq5pmNz5h0jJ; Tue, 17 Dec 2024 10:08:11 +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 4YCCDq3fBFz4BKN; Tue, 17 Dec 2024 10:08:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734430091; 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=nn8lETtyVp9sGKwUp12BjyAZSJcEXlmu7+fUbjELh/s=; b=Hdku0sDnen0NG0w/egftf4Rt0O1ffIt0QautroKxW3XxnNGpnNrzXv44IwCEdSHKe+zauh RZdGUtl7IzIq/7ubyBKBdUwGrFx2DYOAbJsL8Q003In9ZxoFmCxGLiI+k4Pr9EQNCjAnt2 S7VDob+2soBh7+WOvlQiNhnECcboan92auTMqyLXzqkpA6V3gKL6TzXlEIO5zVS2tJ1gv3 eOqRoyijghHbkXPXXkMk+6Vn4QdHKEKBR4y7n4CSrk9TwtxpiPMYOHFHFJ55Plj7lIu/+c gKHo+RhQ4j6BNej4vmxW3ecE5Pb7fN4sesm9VvRMGhuHNIgFwY98bgs0zp1u4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734430091; 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=nn8lETtyVp9sGKwUp12BjyAZSJcEXlmu7+fUbjELh/s=; b=XqslTmMhcM/h4cMSK8ggizTDs5ZNbh+cocfXBeCvdid6mKoS6as4hPIAqNI7WwLDF5v0Zq rT/vk5nbMC2na4BGnNv1WQdSN+oaBkMv8WQn5lHtQkw2RjCMRKrItlBQPUq/qbafSuDC9x aDdR3h09Euhie9Etpp47oeUUwsJdzTPBuR+4mSiQAM+X/WPBrw+uXg/EB4V1E373lCbLq+ jB8sCH3HzRp2PF8VWd4fqPKBnfct4ksjj2uvSY9dIRbYr522eltbeuk9K5p3auDVCVZzsj lVrdpMqAgEQmeiruWH6I/A7qPs5cTllmhlWV2N+s3qUtbOItz/+NN1J5ZGxMgw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1734430091; a=rsa-sha256; cv=none; b=fpwG7Y0m6b8BvM7ROlnBFiZn8zgfFyL9hGh+TlEfHr1Obgdu+S4ZxWMIgvnYlcy4EcppVB uNr3BRxPfq3izqO3osM+yk9jEw99F7pljqBLrQjwSRHPxeFi+UNMMivWH/zMTgOVb/lZKk v/xdWkJ8cWp3JpBmYhOU4ZEmdi84EbLYVpCgD5ZDNFbjy13KXZ2FwHxjP9QsIlwUEsMTQb q+X01USNIvn0eKNLmSRCfp4GYVEaFesHIznhnlAkmagwlIYUCvLLmzILNFDKEE+HMzT3s1 FlYfSmyTXGqLErfcbnEC8Rpuz6F9rF0s+4e+EQHniaJ/vSKoyl4i7nkUsNq1Xw== 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 4YCCDq326wzJVQ; Tue, 17 Dec 2024 10:08:11 +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 4BHA8BUQ024773; Tue, 17 Dec 2024 10:08:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4BHA8BTx024770; Tue, 17 Dec 2024 10:08:11 GMT (envelope-from git) Date: Tue, 17 Dec 2024 10:08:11 GMT Message-Id: <202412171008.4BHA8BTx024770@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: 9e039875cb40 - main - pf tests: verify pool use for nat64 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: 9e039875cb40e131dba4d5f00d0e44b619901e79 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=9e039875cb40e131dba4d5f00d0e44b619901e79 commit 9e039875cb40e131dba4d5f00d0e44b619901e79 Author: Kristof Provost AuthorDate: 2024-12-06 13:01:03 +0000 Commit: Kristof Provost CommitDate: 2024-12-17 10:07:17 +0000 pf tests: verify pool use for nat64 Verify that if we provide a pool of addresses we use the entire pool. Sponsored by: Rubicon Communications, LLC ("Netgate") --- tests/sys/netpfil/pf/nat64.sh | 67 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/tests/sys/netpfil/pf/nat64.sh b/tests/sys/netpfil/pf/nat64.sh index 809d058d34c9..b6b2b97a2f63 100644 --- a/tests/sys/netpfil/pf/nat64.sh +++ b/tests/sys/netpfil/pf/nat64.sh @@ -275,6 +275,72 @@ no_v4_cleanup() { pft_cleanup } + +atf_test_case "pool" "cleanup" +pool_head() +{ + atf_set descr 'Use a pool of IPv4 addresses' + atf_set require.user root +} + +pool_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.1/24 up + jexec rtr ifconfig ${epair_link}a inet alias 192.0.2.3/24 up + jexec rtr ifconfig ${epair_link}a inet alias 192.0.2.4/24 up + + vnet_mkjail dst ${epair_link}b + jexec dst ifconfig ${epair_link}b 192.0.2.2/24 up + jexec dst route add default 192.0.2.1 + + # Sanity checks + 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.1 + + 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.1, 192.0.2.3, 192.0.2.4 } 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.2 + atf_check -s exit:0 -o ignore \ + ping6 -c 1 64:ff9b::192.0.2.2 + atf_check -s exit:0 -o ignore \ + ping6 -c 1 64:ff9b::192.0.2.2 + + # Verify on dst that we saw different source addresses + atf_check -s exit:0 -o match:".*192.0.2.1.*" \ + jexec dst pfctl -ss + atf_check -s exit:0 -o match:".*192.0.2.3.*" \ + jexec dst pfctl -ss + atf_check -s exit:0 -o match:".*192.0.2.4.*" \ + jexec dst pfctl -ss +} + +pool_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "icmp_echo" @@ -284,4 +350,5 @@ atf_init_test_cases() atf_add_test_case "sctp" atf_add_test_case "tos" atf_add_test_case "no_v4" + atf_add_test_case "pool" }