From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B9E74BCACB; Wed, 6 May 2026 17:28:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778088523; cv=none; b=HqUqa6yYuty12H81wAHVAJjWoWAodpHDgFh5VkOVzjSwMq/WKIwDFznUMZagb1kgQPp1IrK0B7FRQCG3/r9d85Rfgpq+nC3WovBc+Gxs+UciUuVr2Xqv8282l76Oh4ipIT+H8WzGmqPeH1IHcuPOCOPfPHc+jl/ahC8kX3cqaq4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778088523; c=relaxed/simple; bh=nG5MSbEtJnJ3VjKmGgmeUZikkFX/7RM7ASOLsgkhen0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Cw7XMdNEyKzHWE/QDIT17JMugwCaFo/5PjaboaSitQSK+SC4Z7WLGTFtFbJSc+tCrOxVAw9D+6KTE+u+R7wqR8aIJmOiScp9jlnfyvGzpf683yeu6oa2floLh5ZafAxTSb1DhZBl3PBxwu+Fj3znvbRUif41fUkuBOOT3ml0gaQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=t/JJutyF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="t/JJutyF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 405A9C2BCB0; Wed, 6 May 2026 17:28:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778088522; bh=nG5MSbEtJnJ3VjKmGgmeUZikkFX/7RM7ASOLsgkhen0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=t/JJutyF0hz3rVAXbGzBl0SsGu7bmtn1WearY2at+HjJCg1Sh9vma9hD/d3oqMttZ FFUaLbGwDnUEmiwzJl/uXF6Y8/V4YuYV7/lMYykJA3JLWrwHwq3B7944/CLbt1oLQ6 4EOS4T75nWxA3Ywq2rOBDBZCLadWzt1yg/sIaMOCSZmZVQGxvsUg8k4Ou+qDdWHmhZ /bnsC85wmN6fa9nC2DkZ/Z7J8QhomiDp6JL1VIdTiXBe1XrFLHsTxGH2L36SKY0gqu 3bj39ZJOrgsSy8WeI299LSvQxxips61g4uxbRahEVW7N1msIy9DyyiIkMiNUaF//P7 RZLP/3NI8xCfA== From: Lorenzo Bianconi Date: Wed, 06 May 2026 19:27:37 +0200 Subject: [PATCH nf-next v2 6/6] selftests: netfilter: nft_flowtable.sh: Add SIT flowtable selftest Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260506-b4-flowtable-sw-accel-ip6ip-v2-6-439fd427726e@kernel.org> References: <20260506-b4-flowtable-sw-accel-ip6ip-v2-0-439fd427726e@kernel.org> In-Reply-To: <20260506-b4-flowtable-sw-accel-ip6ip-v2-0-439fd427726e@kernel.org> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Felix Fietkau , Matthias Brugger , AngeloGioacchino Del Regno , Simon Horman , David Ahern , Ido Schimmel , Pablo Neira Ayuso , Florian Westphal , Phil Sutter , Shuah Khan , Lorenzo Bianconi Cc: linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, netdev@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, linux-kselftest@vger.kernel.org X-Mailer: b4 0.14.3 Similar to IPIP, IP6IP6 and IPv4 over IPv6, introduce specific selftest for SIT flowtable sw acceleration in nft_flowtable.sh Signed-off-by: Lorenzo Bianconi --- tools/testing/selftests/net/netfilter/config | 1 + .../selftests/net/netfilter/nft_flowtable.sh | 45 ++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/tools/testing/selftests/net/netfilter/config b/tools/testing/selftests/net/netfilter/config index 979cff56e1f5..c46604574653 100644 --- a/tools/testing/selftests/net/netfilter/config +++ b/tools/testing/selftests/net/netfilter/config @@ -30,6 +30,7 @@ CONFIG_IP_SCTP=m CONFIG_IPV6=y CONFIG_IPV6_MULTIPLE_TABLES=y CONFIG_IPV6_TUNNEL=m +CONFIG_IPV6_SIT=m CONFIG_IP_VS=m CONFIG_IP_VS_PROTO_TCP=y CONFIG_IP_VS_RR=m diff --git a/tools/testing/selftests/net/netfilter/nft_flowtable.sh b/tools/testing/selftests/net/netfilter/nft_flowtable.sh index 219339dbaf6e..6527e27b9121 100755 --- a/tools/testing/selftests/net/netfilter/nft_flowtable.sh +++ b/tools/testing/selftests/net/netfilter/nft_flowtable.sh @@ -597,6 +597,10 @@ ip -net "$nsr1" addr add 192.168.210.1/24 dev tun6 ip -net "$nsr1" addr add fee1:3::1/64 dev tun6 nodad ip netns exec "$nsr1" sysctl net.ipv4.conf.tun6.forwarding=1 > /dev/null +ip -net "$nsr1" link add name sit1 type sit local 192.168.10.1 remote 192.168.10.2 ttl 255 +ip -net "$nsr1" link set sit1 up +ip -net "$nsr1" addr add fe01:3::1/64 dev sit1 nodad + ip -net "$nsr2" link add name tun0 type ipip local 192.168.10.2 remote 192.168.10.1 ip -net "$nsr2" link set tun0 up ip -net "$nsr2" addr add 192.168.100.2/24 dev tun0 @@ -608,6 +612,10 @@ ip -net "$nsr2" addr add 192.168.210.2/24 dev tun6 ip -net "$nsr2" addr add fee1:3::2/64 dev tun6 nodad ip netns exec "$nsr2" sysctl net.ipv4.conf.tun6.forwarding=1 > /dev/null +ip -net "$nsr2" link add name sit1 type sit local 192.168.10.2 remote 192.168.10.1 ttl 255 +ip -net "$nsr2" link set sit1 up +ip -net "$nsr2" addr add fe01:3::2/64 dev sit1 nodad + ip -net "$nsr1" route change default via 192.168.100.2 ip -net "$nsr2" route change default via 192.168.100.1 @@ -622,6 +630,7 @@ ip -6 -net "$ns2" route add default via dead:2::1 ip netns exec "$nsr1" nft -a insert rule inet filter forward 'meta oif tun0 accept' ip netns exec "$nsr1" nft -a insert rule inet filter forward 'meta oif tun6 accept' +ip netns exec "$nsr1" nft -a insert rule inet filter forward 'meta oif sit1 accept' ip netns exec "$nsr1" nft -a insert rule inet filter forward \ 'meta oif "veth0" tcp sport 12345 ct mark set 1 flow add @f1 counter name routed_repl accept' @@ -648,6 +657,19 @@ if ! test_tcp_forwarding_nat "$ns1" "$ns2" 1 "IP6IP4 tunnel"; then ret=1 fi +ip -6 -net "$nsr1" route delete default +ip -6 -net "$nsr1" route add default via fe01:3::2 +ip -6 -net "$nsr2" route delete default +ip -6 -net "$nsr2" route add default via fe01:3::1 + +if test_tcp_forwarding "$ns1" "$ns2" 1 6 "[dead:2::99]" 12345; then + echo "PASS: flow offload for ns1/ns2 SIT tunnel" +else + echo "FAIL: flow offload for ns1/ns2 with SIT tunnel" 1>&2 + ip netns exec "$nsr1" nft list ruleset + ret=1 +fi + # Create vlan tagged devices for IPIP traffic. ip -net "$nsr1" link add link veth1 name veth1.10 type vlan id 10 ip -net "$nsr1" link set veth1.10 up @@ -672,6 +694,11 @@ ip -6 -net "$nsr1" route delete default ip -6 -net "$nsr1" route add default via fee1:5::2 ip netns exec "$nsr1" nft -a insert rule inet filter forward 'meta oif tun6.10 accept' +ip -net "$nsr1" link add name sit1.10 type sit local 192.168.20.1 remote 192.168.20.2 ttl 255 +ip -net "$nsr1" link set sit1.10 up +ip -net "$nsr1" addr add fe01:5::1/64 dev sit1.10 nodad +ip netns exec "$nsr1" nft -a insert rule inet filter forward 'meta oif sit1.10 accept' + ip -net "$nsr2" link add link veth0 name veth0.10 type vlan id 10 ip -net "$nsr2" link set veth0.10 up ip -net "$nsr2" addr add 192.168.20.2/24 dev veth0.10 @@ -689,6 +716,11 @@ ip -net "$nsr2" link set tun6.10 up ip -net "$nsr2" addr add 192.168.220.2/24 dev tun6.10 ip -net "$nsr2" addr add fee1:5::2/64 dev tun6.10 nodad ip netns exec "$nsr2" sysctl net.ipv4.conf.tun6/10.forwarding=1 > /dev/null + +ip -net "$nsr2" link add name sit1.10 type sit local 192.168.20.2 remote 192.168.20.1 ttl 255 +ip -net "$nsr2" link set sit1.10 up +ip -net "$nsr2" addr add fe01:5::2/64 dev sit1.10 nodad + ip -6 -net "$nsr2" route delete default ip -6 -net "$nsr2" route add default via fee1:5::1 @@ -715,6 +747,19 @@ if ! test_tcp_forwarding_nat "$ns1" "$ns2" 1 "IP6IP4 tunnel over vlan"; then ret=1 fi +ip -6 -net "$nsr1" route delete default +ip -6 -net "$nsr1" route add default via fe01:5::2 +ip -6 -net "$nsr2" route delete default +ip -6 -net "$nsr2" route add default via fe01:5::1 + +if test_tcp_forwarding "$ns1" "$ns2" 1 6 "[dead:2::99]" 12345; then + echo "PASS: flow offload for ns1/ns2 SIT tunnel over vlan" +else + echo "FAIL: flow offload for ns1/ns2 with SIT tunnel over vlan" 1>&2 + ip netns exec "$nsr1" nft list ruleset + ret=1 +fi + # Restore the previous configuration ip -net "$nsr1" route change default via 192.168.10.2 ip -net "$nsr2" route change default via 192.168.10.1 -- 2.54.0