🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26137

Re: [PATCH net-next v7 5/5] selftests: net: add a test for ip6gretap and ip6erspan with VLAN tags

#26137
From: netdev-bot+sashiko
Date: Thu, 03 Dec 2026 03:59
132 lines
12790 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] In tools/testing/selftests/net/ip6_gre_vlan_inherit.sh,
  setup() and tunnel_create() ignore the exit status of every command…

--

selftests: net: add a test for ip6gretap and ip6erspan with VLAN tags

This adds ip6_gre_vlan_inherit.sh. It sends IPv4 and IPv6 packets with a
given TTL and TOS through ip6gretap and ip6erspan, with and without a VLAN
device on top of the tunnel. On the receiving side, tc flower and u32
check the inherited outer hop limit, traffic class and ERSPAN COS.

> diff --git a/tools/testing/selftests/net/ip6_gre_vlan_inherit.sh b/tools/testing/selftests/net/ip6_gre_vlan_inherit.sh
> new file mode 100755
> index 0000000000000..94aed82e9441c
> --- /dev/null
> +++ b/tools/testing/selftests/net/ip6_gre_vlan_inherit.sh

[ ... ]

> +setup()
> +{
> +	setup_ns ns1 ns2 || exit "$ksft_skip"
> +
> +	ip -n "$ns1" link add veth1 type veth peer name veth2 netns "$ns2"

[ ... ]

> +	tc -n "$ns2" qdisc add dev veth2 clsact
> +	# Encapsulated packets with the inherited hop limit and traffic class.
> +	# flower reads a numeric ip_proto as hexadecimal: 0x2f is GRE.
> +	tc -n "$ns2" filter add dev veth2 ingress pref 1 handle 101 \
> +		protocol ipv6 flower ip_proto 0x2f \
> +		ip_ttl "$TTL" ip_tos "$TOS" \
> +		action continue
> +	# ERSPAN packets with the expected COS.
> +	# shellcheck disable=SC2086 # COS_MATCH is a value and a mask
> +	tc -n "$ns2" filter add dev veth2 ingress pref 2 \
> +		protocol ipv6 u32 \
> +		match u8 47 0xff at 6 \
> +		match u8 $COS_MATCH at "$COS_OFF" \
> +		action pass
> +}
> +
> +tunnel_create()
> +{
> +	local kind=$1; shift
> +	local -a args
> +
> +	case "$kind" in
> +	ip6gretap)
> +		args=(type ip6gretap);;
> +	ip6gretap_key)
> +		args=(type ip6gretap key 1);;
> +	ip6erspan_v1)
> +		args=(type ip6erspan seq key 1 erspan_ver 1 erspan 1);;
> +	ip6erspan_v2)
> +		args=(type ip6erspan seq key 1 erspan_ver 2
> +		      erspan_dir ingress erspan_hwid 1);;
> +	esac
> +
> +	ip -n "$ns1" link add tun "${args[@]}" \
> +		local 2001:db8:1::1 remote 2001:db8:1::2 \
> +		tclass inherit hoplimit inherit encaplimit none

[Severity: Medium]
What happens here if the tunnel cannot be created? The exit status of
this ip link add is not checked. The same is true of the clsact qdisc and
the flower and u32 filters in setup(), and of the VLAN, address and
neighbour commands below. The case statement above also has no default
branch. setup_ns is the only step whose failure is handled.

These steps can fail when CONFIG_IPV6_GRE is not built, when iproute2
does not know erspan_dir, erspan_hwid or encaplimit none, or when
cls_flower, cls_u32, act_gact or sch_ingress is missing.

In those cases test_kind() still goes on into send_and_check(). The
counters never increase, so each busywait in send_and_check() runs for the
full BUSYWAIT_TIMEOUT of 20 s. It does not sleep between polls, so it keeps
forking tc and jq the whole time:

tools/testing/selftests/net/lib.sh:busywait() {
	local timeout_ms=$1; shift

	loopy_wait : "$timeout_ms" "$@"
}

Would this give up to 24 FAIL lines saying "outer hop limit and traffic
class not inherited" or "COS not taken from the inner header"? That would
be about 8 minutes of busy-spinning and a non-zero exit, where a skip is
expected.

Could these setup steps be checked so that the test exits with $ksft_skip,
as it already does when setup_ns fails?

> +	ip -n "$ns1" link add link tun name tun.10 type vlan id 10
> +	ip -n "$ns1" link set dev tun up
> +	ip -n "$ns1" link set dev tun.10 up

[ ... ]

> +	RET=0
> +	busywait "$BUSYWAIT_TIMEOUT" until_counter_is \
> +		">= $((inherit + COUNT))" inherit_count > /dev/null
> +	check_err $? "outer hop limit and traffic class not inherited"
> +	log_test "$kind: $what, hop limit and traffic class"
> +
> +	[[ "$kind" == ip6erspan* ]] || return 0
> +
> +	RET=0
> +	busywait "$BUSYWAIT_TIMEOUT" until_counter_is \
> +		">= $((cos + COUNT))" cos_count > /dev/null
> +	check_err $? "COS not taken from the inner header"
> +	log_test "$kind: $what, ERSPAN COS"
> +}

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201005941.1536429-1-littlesmilingcloud%40gmail.com
Technical Details
Message-ID: <179627038245.3146.4048768052055131695@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376278-linux-kernel-netdev=dewy.ru
References: <20261201005941.1536429-6-littlesmilingcloud@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376278-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v7 5/5] selftests: net: add a test for ip6gretap
 and ip6erspan with VLAN tags
Date: Thu, 03 Dec 2026 03:59:42 +0000
Organization: Usenet Network
Message-ID: <179627038245.3146.4048768052055131695@kernel.org>
References: <20261201005941.1536429-6-littlesmilingcloud@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2136728"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:DxiN9htuKfELuiyZmCYGSpmTECA= sha256:2TsFPqsQ47TEOV8TqCwT3PrWXeUG0dzyrl4cJqFPMZg=
	sha1:fXL1Uaw0lOqZkEZl5AfxzKT2ZR4= sha256:n5BX0kcpYUYWJxbGT0Oveu6h+PC+PAhfLHWL9dQA7ag=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id EE7E2117813; Thu,  3 Dec 2026 07:00:01 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 7wfcD6hP-lpt;
	Thu,  3 Dec 2026 06:59:58 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-376278-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id BB5BD11780F; Thu,  3 Dec 2026 06:59:48 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id 72071243DC; Thu,  3 Dec 2026 03:59:46 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796270385;
	b=OFQLcwBss8gMJbONtkojYfvTDtI0QflnwoZPIsZOEt32HYpnbJzx7vyEKgW0YY53gbC8
	 SqJsT6ICc8jfB0cu95ngozluOTKfc5NgwuGeXD6mWlFvrN368GilB3x4pPKKkKUusGj+C
	 uIKbnZFuWfMFFCXiS6hNk5XzWkE4HtvMWiW8dUMTNKiekCUS+S1K9ki0WN3dJu+b01LFv
	 KkaLZdFxgJhLUZ0islt6vczg300bRnMfMuaawrnuBTRS7y1i973Nq1amsBNKmT/2UZ0W7
	 nybH2gwZiH/2cHqbZPJJ01sNxr5eL52H3VRcZ8aL6vmVL6pnLF3atUi8n8jQBNC5dZQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796270385;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=MJiLN/tC85uwK5U1vQAq6lJKIGyArUnR6Zu9z55tAiA=;
	b=v2crLnaXJz/awgecQhIz1iZ8Hd52ywtn1pDoq0PSIMZRclx1n9YILUJ1JNquyoxIbKhR
	 zMd9iOSIQcnCvAqH5q+RsNXHUIcqtTGp3880bgXAXTVDMhG/NH5cjoi38q+eoflIfkQm2
	 wevXBxWCYWIt/Y2h6ElnbczXhvdTmKPU4LKNGvYRuelwmeCHa8643S0Wt9hDkvfOIywRI
	 3XEP0VMqMA2ZE4g6Bq1mYx4kaERHcIHwSImk+9LePVxEWGJzefB9KbC2XcsYkIN277NXU
	 ejV/UpojzbvkvqNtlfi6uu19raU2I2qtp/b2LX9c15HxZBq2jYH87vYt/GJN/tTRfTg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fwguwIi4;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id F3E3B606A685;
	Thu,  3 Dec 2026 03:59:44 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fwguwIi4
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796270384;
	b=0v9XEGwSQZ2Xcfy0dqw3nKoDbpH805iglan0o59GhU8FU3ondmPnBQZi//O+W+9+9bkD
	 r68X4uYyYoWGKSbWBUnENXDjU8wutRp45lOEZwWNfmbCZ7pGz5D/TBtaGFOCOkxwuzD4L
	 yVbJtwJIi7uJcn+50ZrYug95TojjtDAprSrBVD5hJdwUVrdO3j/P87WAeoHL9/9cdNIaU
	 wylI9KlG6COcSNEqm1bjmf88JZEQg8SjEmI0Xf+MILyVXrReM2j4ngUcTnXKR6ZbbCg/B
	 pRVjY0wByFIaeHdW5w0FzFM733dZANc2k//XnrdcJwMB+7BlZOZHDOPPrFSZKkOkNYQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796270384;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=MJiLN/tC85uwK5U1vQAq6lJKIGyArUnR6Zu9z55tAiA=;
	b=41NemrO9kDZJ+qTu6/ZybcBAxW4ENqtLzkSxW3BzbWAlkmSybCgqTJAfnB0YMRBTb899
	 WOZ39VoIUYZER5wRoWxl0XNilUOKj5FLxzKwfc9tB8TjNfCqc6cSI3VbAai2aL9PP/GFp
	 W/opZFlfZog5hpmXW09SnSALcjBKhVosE4xX1yoPoZDUM7g1V3PoOb+5NVdGoOGfWsXTQ
	 pl9SaYXQogV8WGF8+EnabchCSQIKJcjuPwDZLFALUEfmIfbyTwXl3F0kXzEFm/TcVWgM9
	 9XqqrdBkuTeAmdUE/qIF9aF8pg0cQFcYQJ5BAg1uwEqlO/cqQWrQ+VZskpEdCs5Zjww==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fwguwIi4;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 223BF606A339;
	Thu,  3 Dec 2026 03:59:43 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4EA31F000C1;
	Thu,  3 Dec 2026 03:59:42 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796270383;
	bh=MJiLN/tC85uwK5U1vQAq6lJKIGyArUnR6Zu9z55tAiA=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=fwguwIi4CXAO1BYtINMj/M92dcCt/3B4ehsDH0E/r8sHVRFPj9O6KsMEBXH3+KSyk
	 S8acxj9KYpEW/CAH5AdwbO+vsgJQZKL6MgujRTztjy0kFYOOkjWJ/CJLB+mOOV21Xf
	 RSpPp1t7qyEoXcljOaJQWN/korVI8OOnaoJX1FxwiOAHrpTt1F8W7AlYhhVG8u1l8b
	 /g0jRdJ7TvtGx1AET6zWPox6FkMNjD84C1z5znN/j/zE/LBZjs2CPZi8P1QnNBTXMR
	 ju67HlbHc2Ai4zIluYjTa7DYHKI+R9fEjPZE4L2lWtoQfzib4rK1bxnaW0Wxq+ak6V
	 EkMz5YlNqEa5w==
X-Cc: netdev@vger.kernel.org, edumazet@kernel.org, kuba@kernel.org,
 pabeni@redhat.com, davem@davemloft.net, horms@kernel.org, dsahern@kernel.org,
 willemb@google.com, idosch@nvidia.com, fw@strlen.de, u9012063@gmail.com,
 mvohra@vmware.com, matthias.may@westermo.com, mazin@getstate.dev,
 shuah@kernel.org, linux-kselftest@vger.kernel.org,
 linux-kernel@vger.kernel.org
X-In-Reply-To: <20261201005941.1536429-6-littlesmilingcloud@gmail.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list