From nobody Fri Mar 01 12:19:51 2024 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 4TmRx35YlYz5CGvg; Fri, 1 Mar 2024 12:19:51 +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 4TmRx33PClz58Kx; Fri, 1 Mar 2024 12:19:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709295591; 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=YUgbVjBsZdluG+Rcxy70df2O07AcFrj8fu+Ecob9xXs=; b=ORLmsy1fF8QEEWhy6/XdfSYUBZ4mMf9ggkrX91BePcWuBhk3SIvUy+t/jB45ej8khI4qAo jX1YNG1KtnUE3uuPSpOOHtwrvMxpxt5RR48RZkcLZx8Pw+D6Ph+9J+UJORtgpSaBeM8xLE Wv500MM2yO3GTW1qCZHOKyA1+pCCtHDlGdJcBsBEjlTe15wPeVyw9XwnYrXy8tn524/p4P fXDuhjVtrTOxFpJ8hSf0N+IzPI9LqQ97omRIWHFH9v3b3uKk9XQDgLRpEdXfloWkMFXXuQ Lei5eV4mUnJB+Lzdy1F3AFaFL62NCW2+5knIVbOVIDKCwKbTgMafAS9Sx4t8jA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1709295591; a=rsa-sha256; cv=none; b=SfJPkLUPQGRHX2I+y8ZmwhBGl0A/FZj2OAgs5h2FPSyFn82nqQMP0i9k+QS215KSseZ7O+ Ui/9Xo0ZmWNaXC/UomTE9hfnhUO9GZE08ZbOirsHmyTaZWkwHj6rO4coN/yhFpnqw+n3NE CgKol7uLxDJXLZy0BQsX4BNbv4OMwVEnIPccN6yAdhWBo7phpHHfvnQYUl9yQroJULldwp 1uddk9+kebxG3TjfSkEnEiCijA/nvjOBQ85AajnZHHW7gnVFnM0Yl3nCbmx7RgCAu7o0Ly 8tjxOH1/gqF/+uXsNztgbXz1/RcsqXbLt3c0fZDktrt0XtomitB0rByQy/ZgCQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709295591; 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=YUgbVjBsZdluG+Rcxy70df2O07AcFrj8fu+Ecob9xXs=; b=Mp32+SLMM49Phuvn7mIyrxYJbzOxOO1t4ha8pGdQQ8bledr2pCGEw/w6u86RELUAAi/5p4 9Adit6JGagT2gtk6+qQ/TevBUv8Ml5IiizBHqN8Is/OXBLndcDr3H9EMtpNQ2GAvaffywj vhUs39D7JePc2+uThmrN23gdg7iSAP3HiDxTUx20cl+nS9cINUyezSy1j+dJXUN/xPcQnF h4YgpXnpq1fyPz3DFNTyawbZKgWETHRoOx02WcMMpZWhy//EL7fzv6HQKyX6W6nD8pSkQB IAuyovjYBsM1QL+XVt9GY6FwKb5iETNv+LPCfWevLe5Q3XyZRRDZ6UFj4YtLYQ== 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 4TmRx330nNzQ99; Fri, 1 Mar 2024 12:19:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 421CJpK9039003; Fri, 1 Mar 2024 12:19:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 421CJpQN039000; Fri, 1 Mar 2024 12:19:51 GMT (envelope-from git) Date: Fri, 1 Mar 2024 12:19:51 GMT Message-Id: <202403011219.421CJpQN039000@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: fb995824b9df - main - pf tests: IPv6 versions of the route-to/reply-to if-bound tests 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: fb995824b9df6739ed976166ce5c008c13e31701 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=fb995824b9df6739ed976166ce5c008c13e31701 commit fb995824b9df6739ed976166ce5c008c13e31701 Author: Kristof Provost AuthorDate: 2024-02-29 14:10:56 +0000 Commit: Kristof Provost CommitDate: 2024-03-01 08:39:44 +0000 pf tests: IPv6 versions of the route-to/reply-to if-bound tests Sponsored by: Rubicon Communications, LLC ("Netgate") --- tests/sys/netpfil/pf/route_to.sh | 106 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/tests/sys/netpfil/pf/route_to.sh b/tests/sys/netpfil/pf/route_to.sh index 5223381d9c24..d5d29709fe06 100644 --- a/tests/sys/netpfil/pf/route_to.sh +++ b/tests/sys/netpfil/pf/route_to.sh @@ -407,6 +407,51 @@ ifbound_cleanup() pft_cleanup } +atf_test_case "ifbound_v6" "cleanup" +ifbound_v6_head() +{ + atf_set descr 'Test that route-to states for IPv6 bind the expected interface' + atf_set require.user root +} + +ifbound_v6_body() +{ + pft_init + + j="route_to:ifbound_v6" + + epair_one=$(vnet_mkepair) + epair_two=$(vnet_mkepair) + ifconfig ${epair_one}b up + + vnet_mkjail ${j}2 ${epair_two}b + jexec ${j}2 ifconfig ${epair_two}b inet6 2001:db8:1::2/64 up no_dad + jexec ${j}2 ifconfig ${epair_two}b inet6 alias 2001:db8:2::1/64 no_dad + jexec ${j}2 route -6 add default 2001:db8:1::1 + + vnet_mkjail $j ${epair_one}a ${epair_two}a + jexec $j ifconfig ${epair_one}a inet6 2001:db8::1/64 up no_dad + jexec $j ifconfig ${epair_two}a inet6 2001:db8:1::1/64 up no_dad + jexec $j route -6 add default 2001:db8::2 + + jexec $j ping6 -c 3 2001:db8:1::2 + + jexec $j pfctl -e + pft_set_rules $j \ + "set state-policy if-bound" \ + "block" \ + "pass inet6 proto icmp6 icmp6-type { neighbrsol, neighbradv }" \ + "pass out route-to (${epair_two}a 2001:db8:1::2)" + + atf_check -s exit:0 -o ignore \ + jexec $j ping6 -c 3 2001:db8:2::1 +} + +ifbound_v6_cleanup() +{ + pft_cleanup +} + atf_test_case "ifbound_reply_to" "cleanup" ifbound_reply_to_head() { @@ -462,6 +507,65 @@ ifbound_reply_to_cleanup() pft_cleanup } +atf_test_case "ifbound_reply_to_v6" "cleanup" +ifbound_reply_to_v6_head() +{ + atf_set descr 'Test that reply-to states bind to the expected interface for IPv6' + atf_set require.user root +} + +ifbound_reply_to_v6_body() +{ + pft_init + + j="route_to:ifbound_reply_to_v6" + + epair_one=$(vnet_mkepair) + epair_two=$(vnet_mkepair) + + vnet_mkjail ${j}s ${epair_one}b ${epair_two}b + jexec ${j}s ifconfig ${epair_one}b inet6 2001:db8::2/64 up no_dad + jexec ${j}s ifconfig ${epair_two}b up + #jexec ${j}s route -6 add default 2001:db8::1 + + vnet_mkjail $j ${epair_one}a ${epair_two}a + jexec $j ifconfig ${epair_one}a inet6 2001:db8::1/64 up no_dad + jexec $j ifconfig ${epair_two}a inet6 2001:db8:1::1/64 up no_dad + jexec $j route -6 add default 2001:db8:1::254 + + jexec $j pfctl -e + pft_set_rules $j \ + "set state-policy if-bound" \ + "block" \ + "pass quick inet6 proto icmp6 icmp6-type { neighbrsol, neighbradv }" \ + "pass in on ${epair_one}a reply-to (${epair_one}a 2001:db8::2) inet6 from any to 2001:db8::/64 keep state" + + atf_check -s exit:0 -o ignore \ + jexec ${j}s ping6 -c 3 2001:db8::1 + + atf_check -s exit:0 \ + jexec ${j}s ${common_dir}/pft_ping.py \ + --to 2001:db8::1 \ + --from 2001:db8:2::2 \ + --sendif ${epair_one}b \ + --replyif ${epair_one}b + + # pft_ping uses the same ID every time, so this will look like more traffic in the same state + atf_check -s exit:0 \ + jexec ${j}s ${common_dir}/pft_ping.py \ + --to 2001:db8::1 \ + --from 2001:db8:2::2 \ + --sendif ${epair_one}b \ + --replyif ${epair_one}b + + jexec $j pfctl -ss -vv +} + +ifbound_reply_to_v6_cleanup() +{ + pft_cleanup +} + atf_test_case "dummynet_frag" "cleanup" dummynet_frag_head() { @@ -520,6 +624,8 @@ atf_init_test_cases() atf_add_test_case "icmp_nat" atf_add_test_case "dummynet" atf_add_test_case "ifbound" + atf_add_test_case "ifbound_v6" atf_add_test_case "ifbound_reply_to" + atf_add_test_case "ifbound_reply_to_v6" atf_add_test_case "dummynet_frag" }