🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #14997

[PATCH net-next v3 4/5] selftest: seg6: explicit cleanup for SRv6 End PSP test

#14997
From: Hangbin Liu
Date: Thu, 12 Nov 2026 09:27
75 lines
10714 bytes
From: Hangbin Liu <liuhangbin@kylinos.cn>

The End PSP tests install policy and localsid state but rely on the
global namespace teardown to remove it. That leaves flavor-specific
state behind once more tests share this script.

Use defer and defer_scopes_cleanup to remove the PSP specified
configurations. i.e.

  * cafe::1, cafe::1:e9, cafe::2, cafe::2:e9 route and proxy on rt1, rt2
  * fcbb:0::x0e9 End next-csid,psp policies on rt 1,2,3,4
  * fcff:x::0ef1 End psp polices on rt 1,2,4

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

diff --git a/tools/testing/selftests/net/srv6_end_flavors_test.sh b/tools/testing/selftests/net/srv6_end_flavors_test.sh
index 0ed5bfe99029..374b43661c28 100755
--- a/tools/testing/selftests/net/srv6_end_flavors_test.sh
+++ b/tools/testing/selftests/net/srv6_end_flavors_test.sh
@@ -759,6 +759,8 @@ setup_rt_endpoint()
 		add "${sid}" table "${LOCALSID_TABLE_ID}" \
 		encap seg6local action ${behavior_cfg} \
 		dev "${DUMMY_DEVNAME}"
+	defer ip -netns "${nsname}" -6 route \
+		del "${sid}" table "${LOCALSID_TABLE_ID}"
 }
 
 # Add an SRv6 Endpoint behavior to each router of a Policy element <nodeid:op>.
@@ -801,10 +803,16 @@ setup_rt_host_proxy()
 	ip -netns "$(get_rtname "${rt}")" -6 neigh add \
 		proxy "${IPv6_HS_NETWORK}::${hs}" \
 		dev "${RT2HS_DEVNAME}"
+	defer ip -netns "$(get_rtname "${rt}")" -6 neigh del \
+		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}"
+	defer ip -netns "$(get_rtname "${rt}")" -6 neigh del \
+		proxy "${IPv6_HS_NETWORK}::${hs}:${func}" \
+		dev "${RT2HS_DEVNAME}"
 }
 
 # This helper function builds and installs the SID List (i.e. SRv6 Policy)
@@ -882,6 +890,8 @@ __setup_rt_policy()
 		add "${IPv6_HS_NETWORK}::${dst}" \
 		encap seg6 mode inline segs "${policy}" \
 		dev "${DUMMY_DEVNAME}"
+	defer ip -netns "${in_nsname}" -6 route \
+		del "${IPv6_HS_NETWORK}::${dst}"
 }
 
 # see __setup_rt_policy
@@ -1460,11 +1470,13 @@ set +e
 router_tests
 host2gateway_tests
 
+defer_scope_push
 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
+defer_scope_pop
 
 print_log_test_results

-- 
2.56.0
Technical Details
Message-ID: <20261112-srv6_flavors_endx-v3-4-c9177bbbd965@kylinos.cn>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361647-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!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361647-linux-kernel-netdev=dewy.ru
From: hangbin.liu@linux.dev (Hangbin Liu)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v3 4/5] selftest: seg6: explicit cleanup for SRv6
 End PSP test
Date: Thu, 12 Nov 2026 17:27:59 +0800
Organization: Usenet Network
Message-ID: <20261112-srv6_flavors_endx-v3-4-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="1051108"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:6p7xZciSCvD/5b8gPK8JTUXfLs4= sha256:Vme5PinYPKNlqXM7tPnqJtZs3fLY80E4RTTBAkZgXVw=
	sha1:D99MrJjYuMKcVdaeuEVi9hKZm9I= sha256:VqcYHbTUIe0Skn5z3KxQi+BqP9Y3v2/SDOn5YtP0SmA=
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 50B56114183; Thu, 12 Nov 2026 12:37:44 +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 K4r1d7gztqay;
	Thu, 12 Nov 2026 12:37:41 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-361647-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 2D85911417F; Thu, 12 Nov 2026 12:37:33 +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 DFB8DA4999; Thu, 12 Nov 2026 09:29:44 +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=1794475758;
	b=uNXIEi/q476iSDHhM+4plVKEbQJ+ivBUO6TdkbveQmdVRT0WVPunbwMKCvPfNgYz63mE
	 UWG5h3oU8aRTXXVZpRIkQoEtAD76sN+Z+0R+yicatSvRQm90kGo+AzzIYv3Gz5PRVdrJb
	 R+/PmTS5oN0AUoaRwp2ThOVZe/O6jg6wY/iUL6/bdAN03LLSXurVQl2JVsEKK7WMMu2lE
	 eOsdyhyug2k2cPf5wV630l6sCZKFVo/tAj1QEx3YdF4lkHKX+ELdmv7nptA3wrV8U+iO5
	 pmfPpfjYf9ScwXlR5tLEt0KHpLSJ/szso9Oohiu2vW/EP8K2ZnkmGonFvz1q17SZOmQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794475758;
	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=VId0h4p/u77ggNkwAFm/J3Zsd5AjX5cfSMD9gYIbFWs=;
	b=xfSHmNQRW0ET2pPh/DxJ8VLefW3QLV/rZZNlxDrCE9WMDS6icLMrnxyD7j/oF7tWKAk6
	 m0POEN1uKWn1VrCLzrGHgQQ+evW4QTXaBtotOK1fYPoV+IfKUoRoBTGM5WubXQxL752Ij
	 CmIj2g81OgsAwI4JmuzI3atGi7gUPK3sxzSDReXwCJVH9bha657v5+nE2/hsD16TDQtS/
	 +MoRrzEFLKRjuXudI/nBQZR1oQQoQqrqTX/zm9Q6V4qtI3MyHLOxoBgMdhJ1x7Ur6q0lt
	 Yq0Nm8K86FTrbmka1vHsYDYYQ1PMKtTk4PW6z7A8otbTewkDYueOfePzoN3Wh9IINUQ==
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=pMlOrmfj;
	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 C5133606A89C;
	Thu, 12 Nov 2026 09:29:18 +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=pMlOrmfj
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.196
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794475758;
	b=Hnojlaist20d8p+5YNFaaZ2iVrXLcr8sg+A0nV83BRn7YBlKY/dD7dUcy8Udh+ARVEcq
	 yjUXMwCpFV3CqxH53B1r8+7HZQ0l/UQCUSEoG1kHL4JDn/y22HhZH5DlTn9U50ViPDyU7
	 cbRSZzHhuLnucHO+qLxiGNRJ+qD0kHLSMtaDcZxFhPbID7pDYGdGABnbJSw25GcVIxKDD
	 qIRlIrTS3ooOYOt1lf6y3ub/iEwPk6L/SIKBizm3TIBQjXPuYKJfSrKb/rluRyMP38qAh
	 Wc9aLn1dQyp35t5N1p315UDFcM0uR8d2PF4xQTW+/ZCJXfHNgvQCFuJF2Kg5BIKZcnA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794475758;
	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=VId0h4p/u77ggNkwAFm/J3Zsd5AjX5cfSMD9gYIbFWs=;
	b=HVPsvtSm2UCRJ09lGZt3NQ5m9fEFbsD+tkshFjsvK+Q8lx4Pjr4BECaTiHmMOYlOvEFU
	 wy3EQAaiwEc69uiqhprSf8cyeWEmMNXhUkB8c78v8kWR5IDSFgk6XK42/rltIhaGxq/Ij
	 16bWw95MWWN/PX2ERPqbVPdwi7QxhRMITt2jXuregvvYjSkWhVH5z1rxWN4KZn79EjRKl
	 k7xkBbTXZidWRsCN4raesAtccdEtUlmhNnl22I6FWbU9z0shvUWUkvzAaQbdRIfzawm3X
	 kvTEMw1EYI9EVkBzHIpJ33ZTQCdAN+46wRhrTsLyE1xhdMzyIUnXdxnFYz2xx6nV7lg==
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=pMlOrmfj;
	arc=none smtp.remote-ip=95.215.58.196
X-Received: from mta1.migadu.com (out-196.mta1.migadu.com [95.215.58.196])
	(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 56476606A333
	for <netdev@vger.kernel.org>; Thu, 12 Nov 2026 09:29:16 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 56476606A333
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=O//EwO8yzWEhB1NbD8MSRBoGsEgVHeqA1DUOjnhAai0=;
 c=simple/simple; d=linux.dev;
 h=from:to:subject:date:message-id:mime-version:content-type; s=key1;
 t=1794475755; v=1; x=1795080555;
 b=pMlOrmfjPSLVb6uJqNJcu6hIt2SB4krIriHqO6n6AWAL85Uv4RjgmCyK9hI0FTRPxaBMWoDJ
 /e76Rmbt2aXzwlYaNwmSXB4YH2nN+8zdLruQyuMJUdryZR4NJjemoziZxtjYJ/TvPrsKFkxiGrw
 RVPgRRFuFjPL6u+zdQHIMK28=
X-Envelope-To: netdev@vger.kernel.org
X-Received: by mta10.migadu.com with ESMTPS id 0c2a5ac31d33393e;
	Thu, 12 Nov 2026 09:29:15 +0000
X-Mizu-Trace-ID: 0c2a5ac31d33393e
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