🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24920

Re: [PATCH net-next v5 5/5] selftests: seg6: add PSP flavor testing for SRv6 End.X

#24920
From: Hangbin Liu
Date: Tue, 01 Dec 2026 02:53
238 lines
17485 bytes
Hi Andrea,
On Tue, Dec 01, 2026 at 01:14:21AM +0100, Andrea Mayer wrote:
> On Thu, 26 Nov 2026 14:27:27 +0800
> Hangbin Liu <hangbin.liu@linux.dev> wrote:
> 
> Hi Hangbin,
> thanks for the v5, and for all the work across the versions.
> 
> The main points are on the commit message, setup_rt_unreachable() and
> the probe helper. The rest are smaller points.

Thanks for your review. I'm really not good at documentation :)
I appreciate your help. I will update them with my best effort.

> 
> > From: Hangbin Liu <liuhangbin@kylinos.cn>
> >
> > Add an End.X flavor scenario to srv6_end_flavors_test.sh that applies
> > the same PSP policies as the End scenario, alone and combined with
> > NEXT-C-SID, with every node bound through its adjacency (e.g. 4>2 for
> > rt-4 towards rt-2, 2>h towards the host).
> >
> > Teach the policy helpers about <nodeid:op:act> elements:
> >   - __get_srv6_node_id() and __get_srv6_adjacent_id() return the node
> >     and adjacent id
> >   - __get_srv6_rtcfg_act() extracts the action
> >   - __get_srv6_act_cfg() derives the End.X next hop (nh6)
> >   - __get_srv6_param() takes the behavior parameter (adjacency for
> >     End.X, 0 for End)
> >   - __get_srv6_func() picks the Function for an <act> <op> pair
> >   - build_csid()/get_rt_sid() encode the parameter and adjacency into
> >     the SIDs (e.g. fcbb:0:34a9:: is End.X on rt-3 towards rt-4)
> >   - __check_srv6_rtcfg() validates each element node against the
> >     behavior with a per-act regular expression
> >
> > Reuse the existing psp and next-csid,psp helpers for End.X, and add a
> > consumed-SRH test that inserts the extra SRH on the ingress router,
> > since the End.X policy forces the next hop.
> >
> > Install unreachable routes in table 90 for the next SID of each End.X
> > hop under test, so that a broken End.X that falls back to End fails the
> > lookup while a working End.X still forwards via nh6.
> 
> If I read the setup right, the routes are not for each End.X hop,
> only for the ones on rt-3 and rt-4 from hs-1 to hs-2. These seem to
> be enough, as on these hops the packets take the paths of
> input_action_end_x() without flavors, with the RFC 8986 flavors and
> with the NEXT-C-SID shift. Thanks also for the route on rt-4 for
> (i.c), which is the one for the shift.

Yes, I will update it.

> 
> >
> > Extend test_kernel_supp_or_ksft_skip() to probe End.X psp as well as
> > End psp. Failures after a successful probe no longer abort the run, and
> > when End.X psp is missing the scenario is skipped through
> > log_test_skipped() so it still appears in the summary. iproute2 already
> > supports the PSP flavor with End.X.
> >
> > Add the packet path to each test section so the route taken by the
> > traffic is clear.
> >
> > Signed-off-by: Hangbin Liu <liuhangbin@kylinos.cn>
> > ---
> >
> > Hi Andrea, The changelog line is getting extremely long. Please let me
> > know if you'd like me to split this into smaller pieces. Thanks a lot
> > for your kind review.
> 
> To me most of the changes look tied together. The new helpers are
> added for the End.X elements, and without the End.X scenario their
> End.X parts would have no user.
> 
> One part that could be split out is the read back of the route in
> the probe. It also applies to the End probe, which is already in the
> tree, so it could be its own patch, before this one.

Sorry, which probe do you mean? I didn't get.

> 
> Just an idea on the length of the message. The other paragraphs
> already say what the tests cover, how they catch an End.X that falls
> back to End, and when they are skipped. IMHO the list of the helpers
> is the part that could be shorter, for example a few lines on what
> changes in the elements and in the SIDs, such as the adjacency in
> the End.X SIDs (e.g. fcff:3::400a, fcbb:0:34a9::).

Will do.

> > [snip]
> > +# Set up an unreachable route on a router so that a lookup of the next SID
> > +# fails under End, while End.X still forwards via its adjacency (nh6).
> > +# args:
> > +#  $1 - router to configure
> > +#  $2 - adjacent router, or a NEXT-C-SID node list (e.g. "4" or "4>2,2>h")
> > +#  $3 - operation <op> of the element (e.g. "psp" or "next-csid,psp")
> > +setup_rt_unreachable()
> > +{
> > +	local rt="$1"
> > +	local adj="$2"
> > +	local op_type="$3"
> > +	local net_prefix
> > +	local devname
> > +	local nsname
> > +	local sid
> > +
> > +	nsname="$(get_rtname "${rt}")"
> > +
> > +	case "${op_type}" in
> > +	"psp")
> > +		sid="${LOCATOR_SERVICE}:${adj}::/32"
> > +		devname="veth-rt-${rt}-${adj}"
> > +		net_prefix="$(get_network_prefix "${rt}" "${adj}")"
> > +		ip -netns "${nsname}" -6 route \
> > +			change unreachable "${sid}" \
> > +			table "${LOCALSID_TABLE_ID}"
> > +		defer ip -netns "${nsname}" -6 route \
> > +			change "${sid}" \
> > +			table "${LOCALSID_TABLE_ID}" \
> > +			via "${net_prefix}::${adj}" dev "${devname}"
> > +		;;
> 
> This case changes the underlay /32 into an unreachable route and
> restores it in the defer. As in the next-csid,psp case below, an
> unreachable route for the exact address, e.g. fcff:4::2af1, would
> leave the underlay /32 as it is. Or am I missing something?

The psp and next-csid,psp use different unreach route

psp use fcff:4::/32 or fcff:2::/32
next-csid,,psp use exact route like fcbb:0:42a9:20a9:: or fcbb:0:20a9::

The previous routing on rt3 for End is
fcff:4::/32 table 90 via fcf0:0:3:4::4 dev veth-rt-3-4

I changed it to unreachable so End.X doesn't read the nh via it.

> 
> > +	"next-csid,psp")
> > +		sid="$(build_csid_container "${adj}" "End.X" \
> > +			"${ENDX_CSID_PSP_FUNC}")"
> > +		ip -netns "${nsname}" -6 route \
> > +			add unreachable "${sid}" \
> > +			table "${LOCALSID_TABLE_ID}"
> > +		defer ip -netns "${nsname}" -6 route \
> > +			delete "${sid}" \
> > +			table "${LOCALSID_TABLE_ID}"
> > +		;;
> > +	esac
> > +}
> 
> If the /32 is not needed, why not make the function take two
> arguments, the router and the element of the next SID, as in the
> Policies? For example:
> 
> 	setup_rt_unreachable 3 "4>2:psp:End.X"
> 	setup_rt_unreachable 3 "4>2,2>h:next-csid,psp:End.X"
> 
> The SID could then come from get_rt_sid() or build_csid_container(),
> as in __setup_rt_policy().

The when defer the PSP route, we need nh6 addr and device name.
If we take the total element like "4>2:psp:End.X", we still need
to get the  "4>2" part first then call __get_srv6_adjacent_id() to
get the "${adj}", I think it takes 2 more efforts.

I can make the function take 2 arguments if you want.

> 
> > +	setup_rt_unreachable 3 4 "psp"
> > +	setup_rt_unreachable 4 2 "psp"
> > +	setup_rt_unreachable 3 "4>2,2>h" "next-csid,psp"
> > +	setup_rt_unreachable 4 "2>h" "next-csid,psp"
> 
> If the function keeps its three arguments, the exact address could come
> from "4>2" in $2, and "2>h" would keep the two calls in the same form:

Hmm, you want to add exact unreach route for PSP. e.g.
unreachable fcff:4::2af1 on rt3? That OK for me. I think
unreachable fcff:4::2af1 and unreachable fcff:4::/32 take the same effect
on rt-3, no?

> 
> 	setup_rt_unreachable 3 "4>2" "psp"
> 	setup_rt_unreachable 4 "2>h" "psp"
> 
> "psp" can stay, as it is already the <op> of the element of the next
> SID, 4>2:psp:End.X.
> 
> > [snip]
> > +test_kernel_supp_or_ksft_skip End psp
> > +test_kernel_supp_or_ksft_skip End.X psp && HAS_ENDX_PSP=true
> 
> Here the helper exits for End and returns for End.X when the action
> is not supported, but its name says that it skips. In v4 the probe
> was inside this helper, while in v5 it is on its own, in
> __test_kernel_supp_or_ksft_skip(), and returns on every path. Could
> the probe be renamed, for example to check_kernel_support(), and called
> directly by the End.X line, as check_srh_match_support() is? Then the
> helper could always exit when the probe fails, and the test results
> stay the same:
> 
> 	# Exit with ksft_skip when check_kernel_support() fails, e.g. when
> 	# the action with the flavor is not supported.
> 	test_kernel_supp_or_ksft_skip()
> 	{
> 		local action="$1"
> 		local flavor="$2"
> 
> 		if ! check_kernel_support "${action}" "${flavor}"; then
> 			exit "${ksft_skip}"
> 		fi
> 	}
> 	...
> 	test_kernel_supp_or_ksft_skip End psp
> 	if check_kernel_support End.X psp; then
> 		HAS_ENDX_PSP=true
> 	fi

OK, with this, the End is the only caller of test_kernel_supp_or_ksft_skip().
Maybe let End also calls check_kernel_support and exit directly? e.g.

 	if ! check_kernel_support End psp; then
		exit "${ksft_skip}"
	fi
 	if check_kernel_support End.X psp; then
 		HAS_ENDX_PSP=true
 	fi

If make it shorter

! check_kernel_support End psp && exit "${ksft_skip}"
check_kernel_support End.X psp && HAS_ENDX_PSP=true

Thanks
Hangbin
Technical Details
Message-ID: <aw42oTMEOCMvC22o@fedora>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374646-linux-kernel-netdev=dewy.ru
References: <20261126-srv6_flavors_endx-v5-0-4d8232eec404@kylinos.cn> <20261126-srv6_flavors_endx-v5-5-4d8232eec404@kylinos.cn> <20261201011421.0f393abeefcb9c4f3c5f0ee4@uniroma2.it>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374646-linux-kernel-netdev=dewy.ru
From: hangbin.liu@linux.dev (Hangbin Liu)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v5 5/5] selftests: seg6: add PSP flavor testing
 for SRv6 End.X
Date: Tue, 1 Dec 2026 10:53:21 +0800
Organization: Usenet Network
Message-ID: <aw42oTMEOCMvC22o@fedora>
References: <20261126-srv6_flavors_endx-v5-0-4d8232eec404@kylinos.cn>
 <20261126-srv6_flavors_endx-v5-5-4d8232eec404@kylinos.cn>
 <20261201011421.0f393abeefcb9c4f3c5f0ee4@uniroma2.it>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="1595313"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:FlOAnD4JNAgZyXZwDUiAE+RiDXs= sha256:NNM0vJzkUL9UQatg1awuQnmbDCZg9Qod8qkiN06Ytbo=
	sha1:ef6FjrlkvNedtE8vSdtqR0zrdd8= sha256:NjWIDaZLB8tF5/3A+4NP/NSlrrIUsxXlgwGurMRwHuw=
Content-Disposition: inline
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 B5D7A11720A; Tue,  1 Dec 2026 05:53:52 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 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, URIBL_BLOCKED=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 C93chBU2zOG2;
	Tue,  1 Dec 2026 05:53:49 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-374646-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id B9F54117203; Tue,  1 Dec 2026 05:53:40 +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 E0AE923EA5; Tue,  1 Dec 2026 02:53:38 +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=1796093618;
	b=Ebv81hTMCyQJ5V7J6a3xBp/U6WWnVpmOysvLB7q5cOeD0iUs+yxz2FTU9CF8cazIUxbB
	 VLFA7oSG77yLFPduGwz/tFqhPwPRmnJPZtiGBvfSZaLQStcxo0sIu2ZFF2YxKESA/qYAY
	 KzmfKyeIRs1kPqKT74FPcJn3IVGohaXi2D3bnfZ89uODaw36CdINY6qm0qmDSRA3HmaHQ
	 XjPDam78SCFuMi9vg1DjGkae8tg84YiyavktIwyk5bkiKPZUWtsjQ8ciCsgF5AUZIlO+G
	 792ZWgWaWDUK26A+qR7aHwONQOry5WBUFp/0KXSbp1+SpTqbAE0oDEYJjlo5VV+Am9A==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796093618;
	h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature:
	 X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow:Date:From:To:Cc:
	 Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=yP+Jh9D2L6cf4oouoLPIfJun0kylTDrzdzuej5TSfUM=;
	b=mtpR6AeB7INB1AYNcb05Kvkz+cDtPCbwEOOL3S06ADWwzHDZLa7R5PzL2mpoKI1dbm7p
	 7FpN5m817ud8H0fnMlYLV6tzipn7kSSszfC1ELEa0DiVOcnxltbXahUPbPHcpy//w44qr
	 nMxIWjoEioaEVy2pc7VNP2MeQ+BEOOUe1TrhJ8nLGfBNrCIZ5p1yMmLQQChzUInhjVdNy
	 ooOFi9pYKP037+LtX23ZzN0hxuX5L6GbP97vs7N4YopZD4gUmq28Gc+nQk7JkbK0MUK5b
	 OynKzsa7swwQkMMURR5hBAgF8tSOhk7+/iwpUJNTIvnnatqWRKFKt9kPUZ/KcSUrhfw==
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=hoOdDE2P;
	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 2FF22606A32E;
	Tue,  1 Dec 2026 02:53:38 +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=hoOdDE2P
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.190
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796093617;
	b=F2pRqY+NCCTX88RcpgUkKgh1HjRrcu68M0hTv4kVQdaTBGQ87QlqA7mqCJI5vaIVIV5E
	 2e/c74saUYnGWl++4/Oy898kg1QyRex8BMyWxp3E4xNuvWiiNw25eOuACpGU6mYOaJFoO
	 zV5Nnk4EkpVzagHUf3JwVq3YcBdJ3ET0Q6cSB72aQZhIblGKiEz+mi7rk3BiTBLcLPYFh
	 Kc5yOLT4NWHxl37v1jYp1qtpZ8tg93XYbWpTi3e51+UK7x1OMbD4jYky+vcyrU6yME3Mz
	 I7NV98TToSQZ6Xyhu8uI6IHB6IvWsq0EBmz+JwwWN04I7ZCMBo1qPOk/wuu7abIpFLQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796093617;
	h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received:
	 X-Mizu-Trace-ID:X-Migadu-Flow:Date:From:To:Cc:Subject:Message-ID:
	 References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=yP+Jh9D2L6cf4oouoLPIfJun0kylTDrzdzuej5TSfUM=;
	b=VtB/50iyY52z9ILtj8QO8eNuCVce5C/+Z+UTcoi0ORiUadXoT9xIoFBXWrLLa0g6gxAC
	 mKv/XpK0K3UAn76cfkMVSjxbj6iUhoVy6eBRFIWx23asbL4oQHTnAgVWgFGnD6mGVAFou
	 CfNixhw9jwW+qg392gtHvVkT+BhGF4F0OvHSKhls8j+ar6QGK+5NKSgyJaLD8It/Px6K+
	 8AIU6OHl5GXbJlGwpYIFWXf5B+RD+ePTz2hDBvS1xK71FwCJsGHSCC5fuT/VL7kTt/kUl
	 X6NNuUa1lTausV+RJn4vywWNzPlC/Rh3Cd1I3QxBSGyATe0HUNSs94J1vdncPXuw3dw==
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=hoOdDE2P;
	arc=none smtp.remote-ip=91.218.175.190
X-Received: from mta0.migadu.com (out-190.mta0.migadu.com [91.218.175.190])
	(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 4728C606A320
	for <netdev@vger.kernel.org>; Tue,  1 Dec 2026 02:53:35 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4728C606A320
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=X1K0gD0b/sNJe2kIToYzkHHNog6yR1MwrM5fdniMR5k=;
 c=simple/simple; d=linux.dev;
 h=from:to:subject:date:message-id:mime-version:content-type; s=key1;
 t=1796093613; v=1; x=1796698413;
 b=hoOdDE2Pb6D+MSX1btgxSzljlYZ5H4Ry/Yiw38Gr1o51veVoJkCEtgygDDljF23EzLFbVyGY
 nq0/VXK6qxVtMZmQwhDdmnm9htx/LOq3B/qQ0CobIeGz2ao22CP/H8DAU5pFrx3LRU9Xqu5WldT
 7t9NmMDR+2+bhn+VB0+5i/k8=
X-Envelope-To: netdev@vger.kernel.org
X-Received: by mta12.migadu.com with ESMTPS id 0c7c75fa7ccb709c;
	Tue, 01 Dec 2026 02:53:33 +0000
X-Mizu-Trace-ID: 0c7c75fa7ccb709c
X-Migadu-Flow: FLOW_OUT
X-Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>, Shuah Khan <shuah@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org,
	Hangbin Liu <liuhangbin@kylinos.cn>,
	Justin Iurman <justin.iurman@gmail.com>,
	Stefano Salsano <stefano.salsano@uniroma2.it>,
	Andrea Mayer <andrea@common-net.org>
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: <20261201011421.0f393abeefcb9c4f3c5f0ee4@uniroma2.it>