🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #14994

[PATCH net-next v3 3/5] selftests: seg6: move SRv6 End PSP setup into its own helper

#14994
From: Hangbin Liu
Date: Thu, 12 Nov 2026 09:27
125 lines
12363 bytes
From: Hangbin Liu <liuhangbin@kylinos.cn>

setup() installs both the base topology and the End PSP policies. That
couples general test setup with one specific flavor scenario and makes
it hard to add further flavor cases cleanly.

Extract the End PSP policy setup into setup_end_flv_psp() so flavor
tests can set up and later tear down independently (the matching
cleanup arrives in a following patch).

Run the block under set -e so a setup failure is treated as an error
instead of falling through into the connectivity checks. When deciding
to report the run as skipped, keep any failure already recorded by a
test, so a real failure is not converted into a skip.

Signed-off-by: Hangbin Liu <liuhangbin@kylinos.cn>
---
 .../testing/selftests/net/srv6_end_flavors_test.sh | 56 +++++++++++++++++-----
 1 file changed, 45 insertions(+), 11 deletions(-)

diff --git a/tools/testing/selftests/net/srv6_end_flavors_test.sh b/tools/testing/selftests/net/srv6_end_flavors_test.sh
index 157baa8ecb0b..0ed5bfe99029 100755
--- a/tools/testing/selftests/net/srv6_end_flavors_test.sh
+++ b/tools/testing/selftests/net/srv6_end_flavors_test.sh
@@ -488,8 +488,9 @@ cleanup()
 
 	# check whether the setup phase was completed successfully or not. In
 	# case of an error during the setup phase of the testing environment,
-	# the selftest is considered as "skipped".
-	if [ "${SETUP_ERR}" -ne 0 ]; then
+	# the selftest is considered as "skipped", unless a test has already
+	# recorded a failure.
+	if [ "${SETUP_ERR}" -ne 0 ] && [ "$ret" -ne "$ksft_fail" ]; then
 		echo "SKIP: Setting up the testing environment failed"
 		exit "${ksft_skip}"
 	fi
@@ -785,6 +786,27 @@ setup_rt_endpoints()
 	done
 }
 
+# setup proxy on route entries for hosts
+# args:
+#  $1 - ingress router that enforces the SRv6 Policy
+#  $2 - destination host whose addresses are proxied
+#  $3 - suffix of the address on the loopback of the destination host
+#       (i.e. cafe::<host>:<suffix>)
+setup_rt_host_proxy()
+{
+	local rt=$1
+	local hs=$2
+	local func=$3
+
+	ip -netns "$(get_rtname "${rt}")" -6 neigh add \
+		proxy "${IPv6_HS_NETWORK}::${hs}" \
+		dev "${RT2HS_DEVNAME}"
+
+	ip -netns "$(get_rtname "${rt}")" -6 neigh add \
+		proxy "${IPv6_HS_NETWORK}::${hs}:${func}" \
+		dev "${RT2HS_DEVNAME}"
+}
+
 # This helper function builds and installs the SID List (i.e. SRv6 Policy)
 # to be applied on incoming packets at the ingress node. Moreover, it
 # configures the SRv6 nodes specified in the SID List to process the traffic
@@ -860,10 +882,6 @@ __setup_rt_policy()
 		add "${IPv6_HS_NETWORK}::${dst}" \
 		encap seg6 mode inline segs "${policy}" \
 		dev "${DUMMY_DEVNAME}"
-
-	ip -netns "${in_nsname}" -6 neigh \
-		add proxy "${IPv6_HS_NETWORK}::${dst}" \
-		dev "${RT2HS_DEVNAME}"
 }
 
 # see __setup_rt_policy
@@ -962,17 +980,29 @@ setup()
 	setup_hs 1 1
 	setup_hs 2 2
 
-	# set up the loopback addresses of the hosts used by the Policies (i.c)
-	# and (i.d).
-	setup_hs_lo_addr 1 1 "${END_CSID_PSP_FUNC}"
-	setup_hs_lo_addr 2 2 "${END_CSID_PSP_FUNC}"
-
 	# set up default SRv6 Endpoints (i.e. SRv6 End behavior)
 	setup_rt_local_sids 1 "2 3 4"
 	setup_rt_local_sids 2 "1 3 4"
 	setup_rt_local_sids 3 "1 2 4"
 	setup_rt_local_sids 4 "1 2 3"
 
+	# testing environment was set up successfully
+	SETUP_ERR=0
+}
+
+setup_end_flv_psp()
+{
+	SETUP_ERR=1
+
+	# set up the loopback addresses of the hosts used by the Policies (i.c)
+	# and (i.d).
+	setup_hs_lo_addr 1 1 "${END_CSID_PSP_FUNC}"
+	setup_hs_lo_addr 2 2 "${END_CSID_PSP_FUNC}"
+
+	# setup proxy on route entries for hosts
+	setup_rt_host_proxy 1 2 "${END_CSID_PSP_FUNC}"
+	setup_rt_host_proxy 2 1 "${END_CSID_PSP_FUNC}"
+
 	# set up SRv6 policies
 	# create a connection between hosts hs-1 and hs-2.
 	# The path between hs-1 and hs-2 traverses SRv6 aware routers.
@@ -1429,6 +1459,10 @@ set +e
 
 router_tests
 host2gateway_tests
+
+set -e
+setup_end_flv_psp
+set +e
 host_srv6_end_flv_psp_tests
 host_srv6_end_flv_next_csid_psp_tests
 host_srv6_end_flv_consumed_srh_tests

-- 
2.56.0
Technical Details
Message-ID: <20261112-srv6_flavors_endx-v3-3-c9177bbbd965@kylinos.cn>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361646-linux-kernel-netdev=dewy.ru
References: <20261112-srv6_flavors_endx-v3-0-c9177bbbd965@kylinos.cn>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361646-linux-kernel-netdev=dewy.ru
From: hangbin.liu@linux.dev (Hangbin Liu)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v3 3/5] selftests: seg6: move SRv6 End PSP setup
 into its own helper
Date: Thu, 12 Nov 2026 17:27:58 +0800
Organization: Usenet Network
Message-ID: <20261112-srv6_flavors_endx-v3-3-c9177bbbd965@kylinos.cn>
References: <20261112-srv6_flavors_endx-v3-0-c9177bbbd965@kylinos.cn>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="1050920"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:USoGh6qgnNQW2ZjB+SB0jE3FQbI= sha256:Z0Y+Bm4hPBqDQjGxfL+s6yFczXVbjnp6sm0Lf2fC+Gk=
	sha1:dMz3OUzTTePOFo38hp6Pos8DHbg= sha256:adux5IiIzUEe0dHupqefSAraC9e+yzlZuUi/e/SLed4=
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 E42A7114181; Thu, 12 Nov 2026 12:36:58 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.051
X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	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 (1024-bit key)
	header.d=linux.dev
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 Zwl43y31L0fv;
	Thu, 12 Nov 2026 12:36:55 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-361646-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.dev
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id A9C6C11417F; Thu, 12 Nov 2026 12:36:46 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id A5276C5140; Thu, 12 Nov 2026 09:29:33 +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=1794475745;
	b=jSgmEYKt9iLuSC1+K99UDHiTHAT80ea3ZsyK6xgfUDofY1dOZKYlfTIGCiRFjT8602GR
	 wmY4LmFGMwEPIJxhV+07wqLFZWWzENRM2yqRtmYIqWZIHWvwsyK9XM8Q0TkUMaH23veDu
	 AvFpGLXYHD6rN/AJC9Oc0jB2wuDSXoPlGHGJEMYzb2bWRRgZoid452G6NgD/DsdQ1W4MQ
	 ZgzZYS/lg2y1aIW9j4rFxk3ElHCtK4a+bFW2BmZmicykO+GR2mywehVxMLI7G6Gajb4KY
	 3QiJ1IRK5ZKyk9EGg8M+OmmkPwpnekzljTyPzj13yxHf1gbzxeRe55BNKSKezE33TJA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794475745;
	h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature:
	 X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow:From:Date:
	 Subject:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type:
	 Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc:
	 X-Mailer;
	bh=jNXpiUp3oDdDyxeEWlLjs1m4mGHUrIyXQcyGp9qGQuo=;
	b=quEBzozC+6EJIO0SJmu/oMhiGIsQ3q1FDCnKdYXMxrhFKh9cWSMmMwB9cvuwyqroyISD
	 x9G8LstG8Va6vZLOmJzsL/c54vJKczNrT8WXB0KGPYVwUAqowzItDOiJQSHq/829P4i57
	 hMwUiSYqbBGWO/KVnH0+B0JNXF9bDWWpnXZTyl6Bh3WeYqUPjXJFsRxSA74zY6CLAc1ya
	 smnw4esVoDIBivTGb8j08K99wSkojw1ptPX8hzQFwi0ZCXulVjI+aYBq5ufscLGD3F0tE
	 PuVucr2ko8gmIBGc0poeK0wS5BrKAHzkYenimR/Jm80NIOumBckxrvcv05N5UtEBXtQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=Rd5qOkgG;
	dmarc=pass header.from=linux.dev;
	spf=pass smtp.mailfrom=linux.dev;
	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 47AAB606A887;
	Thu, 12 Nov 2026 09:29:05 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=Rd5qOkgG
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.193
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794475744;
	b=yFtVvGMCmUv9QsnfdoQ//ms7Y6qrx7zK+YyPQZzQmecMyy4o3Xm83lSItXwRhHNKAPB8
	 nWt2bG/XOMNFi7/p2E72zao+BTSPH8siv6P9OZMul576VLkQ2ssqnETDIBbu1O7fd6guH
	 IZwTLinyUzN9d8MxUhewJXoSuXP7Emy3uWf2sRnAgfuY5zvMU1qaCqLq4zYGxOE1ZCek2
	 wJTD0xbSa+0KW3fPzKw+kZCF4A31Ya4URbEhmDDEOVBRnhA2cc/K+Gnvj015vKYyI/8E9
	 pitv6HCDGo4kRTPH67Dzrb33gr6Fpj9D79BQeraoHtsR1qft/J9LzHQXwUzpqo6Wj2A==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794475744;
	h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received:
	 X-Mizu-Trace-ID:X-Migadu-Flow:From:Date:Subject:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:Message-Id:References:
	 In-Reply-To:To:Cc:X-Mailer;
	bh=jNXpiUp3oDdDyxeEWlLjs1m4mGHUrIyXQcyGp9qGQuo=;
	b=WF+BZiBumB6Q2EL0j6G0BPq/8YjFPF9JL9ZUtic0Ek3ImtoCDFIvhnTcXkKFew+t4rMb
	 GRtuNGMxtK1eHlciufBQMXG6h3HiJb1rFRpa68MfQTpIB4+RdgLP9Q5DgwewsSVuqXo8u
	 cztH9qWl3cVusN6AD5j83vGYPoGR4/fTTq9OLBePrd1mTtbx9tg+OBYGF9rGVDCxQBHqv
	 G+7Jnc/sxZfY3I66Z1IrBQYlPMPyW7sNx48MT+gcYVgcYAdcw1VjQNrsVdztJtYvJnmZq
	 0/il/AiIVOO4fsTzYusDOwVxG+tNR3YVCpmV9C0Jpt2wV85c4BaR8KB64gl0SZaJr6Q==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=linux.dev;
	spf=pass smtp.mailfrom=linux.dev;
	dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=Rd5qOkgG;
	arc=none smtp.remote-ip=91.218.175.193
X-Received: from mta0.migadu.com (out-193.mta0.migadu.com [91.218.175.193])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id CBD88606A321
	for <netdev@vger.kernel.org>; Thu, 12 Nov 2026 09:29:03 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CBD88606A321
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev
X-Envelope-To: netdev@vger.kernel.org
X-DKIM-Signature: a=rsa-sha256; bh=/+WuwrSksAjzAHCCytpm8Y2IGIJxlPeKxsMgUDhSC6o=;
 c=simple/simple; d=linux.dev;
 h=from:to:subject:date:message-id:mime-version:content-type; s=key1;
 t=1794475742; v=1; x=1795080542;
 b=Rd5qOkgGN2Jy58oGC2b5UqSnml46mVBMMf23WeJzKy+NF34DyTrDLdxWMwBz7hnG19WUXX5r
 9TDfz3Fl+n/KjOKQXUNJdGqF+Ox6yclHlS73+kKPIeT4ep+1E/9YwqVXgDiePNK0hMmoGM4ldG+
 yWhWhKAbenlVSYXjBwRydgj8=
X-Envelope-To: netdev@vger.kernel.org
X-Received: by mta10.migadu.com with ESMTPS id b94977e37de25a9a;
	Thu, 12 Nov 2026 09:29:01 +0000
X-Mizu-Trace-ID: b94977e37de25a9a
X-Migadu-Flow: FLOW_OUT
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
X-In-Reply-To: <20261112-srv6_flavors_endx-v3-0-c9177bbbd965@kylinos.cn>
X-Cc: Hangbin Liu <hangbin.liu@linux.dev>, netdev@vger.kernel.org, 
 linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, 
 Hangbin Liu <liuhangbin@kylinos.cn>
X-Mailer: b4 0.16.0