Article View: linux.kernel.netdev
Article #22913[PATCH net-next v5 4/5] selftests: seg6: explicit cleanup for SRv6 End PSP test
From: Hangbin Liu
Date: Thu, 26 Nov 2026 06:27
Date: Thu, 26 Nov 2026 06:27
101 lines
11293 bytes
11293 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 the defer helper to remove the configurations installed for the
PSP tests:
* cafe::1, cafe::1:e9, cafe::2, cafe::2:e9 routes and proxy neighs
on rt1, rt2, and the cafe::1:e9, cafe::2:e9 addresses on the
hosts' loopback
* fcbb:0:x0e9::/48 End next-csid,psp policies on rt 1,2,3,4
* fcff:x::0ef1 End psp policies on rt 1,2,4
After the change, we can wrap the whole end test with test_end_flv()
and run it separately.
Signed-off-by: Hangbin Liu <liuhangbin@kylinos.cn>
---
.../testing/selftests/net/srv6_end_flavors_test.sh | 29 ++++++++++++++++------
1 file changed, 22 insertions(+), 7 deletions(-)
diff --git a/tools/testing/selftests/net/srv6_end_flavors_test.sh b/tools/testing/selftests/net/srv6_end_flavors_test.sh
index 250de54d8bfa..9d6b7de648da 100755
--- a/tools/testing/selftests/net/srv6_end_flavors_test.sh
+++ b/tools/testing/selftests/net/srv6_end_flavors_test.sh
@@ -763,6 +763,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>.
@@ -865,10 +867,15 @@ __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}"
ip -netns "${in_nsname}" -6 neigh \
add proxy "${IPv6_HS_NETWORK}::${dst}" \
dev "${RT2HS_DEVNAME}"
+ defer ip -netns "${in_nsname}" -6 neigh \
+ del proxy "${IPv6_HS_NETWORK}::${dst}" \
+ dev "${RT2HS_DEVNAME}"
}
# see __setup_rt_policy
@@ -929,10 +936,12 @@ setup_hs_lo_addr()
addr="${IPv6_HS_NETWORK}::${hs}:${suffix}"
ip -netns "${hsname}" addr add "${addr}/128" dev lo nodad
+ defer ip -netns "${hsname}" addr del "${addr}/128" dev lo nodad
ip -netns "${rtname}" -6 route \
add "${addr}" \
via "${IPv6_HS_NETWORK}::${hs}" dev "${RT2HS_DEVNAME}"
+ defer ip -netns "${rtname}" -6 route del "${addr}"
}
setup()
@@ -1412,6 +1421,18 @@ test_dummy_dev_or_ksft_skip()
ip netns del "${test_netns}"
}
+test_end_flv()
+{
+ 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
+}
+
if [ "$(id -u)" -ne 0 ]; then
echo "SKIP: Need root privileges"
exit "${ksft_skip}"
@@ -1443,11 +1464,5 @@ 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
-
+test_end_flv
print_log_test_results
--
2.56.0
Technical Details
Message-ID:
<20261126-srv6_flavors_endx-v5-4-4d8232eec404@kylinos.cn>Path:
mbox-mo1.pugleaf.net!srv.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-371893-linux-kernel-netdev=dewy.ruReferences:
<20261126-srv6_flavors_endx-v5-0-4d8232eec404@kylinos.cn>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.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-371893-linux-kernel-netdev=dewy.ru From: hangbin.liu@linux.dev (Hangbin Liu) Newsgroups: linux.kernel.netdev Subject: [PATCH net-next v5 4/5] selftests: seg6: explicit cleanup for SRv6 End PSP test Date: Thu, 26 Nov 2026 14:27:26 +0800 Organization: Usenet Network Message-ID: <20261126-srv6_flavors_endx-v5-4-4d8232eec404@kylinos.cn> References: <20261126-srv6_flavors_endx-v5-0-4d8232eec404@kylinos.cn> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="398353"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:D0raqs9KC75K/HZ3WoI6fPbg+so= sha256:IuINWpH/EdWJ1gjEkglaDK5HsCqG9vTITxi/ffGpVoY= sha1:qpWxGqE7PXdPgGdiMU2wycbGCDc= sha256:wLfYR6vQuKyHHJwRJRRB9YdAEh5Y2VA42TNvJpioeXs= 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 74738125EB3; Thu, 26 Nov 2026 09:28:43 +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 1HIIXPEQywYs; Thu, 26 Nov 2026 09:28:40 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-371893-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 2C6C9125EB0; Thu, 26 Nov 2026 09:28:31 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id C19E62D061; Thu, 26 Nov 2026 06:28:10 +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=1795674488; b=b/uWqgMiuLbOy38yA267W3CWlIhE0bk4qf+GQnUkMak1USnTOnTOeoYNMDBvotEtkn79 aKR3NVTIWNNWJ6QS3kkKglAJ9YKRk7wHhDA0xKSfLIq4GernkAyFJ7zrx1LNOE85U4RpW aW+g7ohYba8owixb7NPpyvBLyGY8QiqpU8TwI+g9woao7KDdQVYlvy9R8J3kWtwjkV/3+ GwcSZVLIWgJ7FqoOzJ6ndyt+p+zmEsJS2cpgkkzVmJBFIYufwEJ+qOy7y7aV5a2h0lsCu VxnUoDuVMjrLxA3mbBg3ZUi//fN+czNcQzCj+i5sV219HTtl8sJV84dCdJMDmmSm7yg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795674488; 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=kL06f/X8F0pCUsRpt4OdaQK/VJzX2vhlrvqULYx75ac=; b=bWvQJVPpia4L1tDVcOSWd3dwbaWlZ+N4qxsCTW+bCEQPvcrJnI7SSlqXj/24LF0jgn/T lLjA6bQCQdnUkdrUW5pTDsbuzC7Sn2DRLjKXnyXWoRT0JqAhctDrFIFEciCqyfIbZGVs0 99HcWh6fFweKgyzy20rsmmcvhBt1smCnMsiH3W245RMH9qglk3QFGYL+1OHirU7QLsuTl GWt6gmwNvXg1tl9WlK5s5PfiNl8memXrbZ8uO8cbanrKFoRmcuDmXot4y2sJ9bhC+e/EH 7ioOu9gUwBTkMsbyLdnjo6hSeZlSYKDrpvDSbA2avL+n2QMAWEr3a1uLBvOh1gBd5gQ== 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=sxq1snzb; 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 334BA606A31E; Thu, 26 Nov 2026 06:28:08 +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=sxq1snzb X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.42 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795674487; b=cq8Fz2dmskBBbQ1xXTuIU6SoS9d/WnLDajk/7OPAiQyrQrjPIZ1wnQPLo2+10Kj3w79v 42+2LwLQ0uSLaZncxcXbNYzARGlCEtyARmXl6PH8QxyPXSgrrQRyU82zGQzLaa+noevZm G+xKgdIuF5RkwvD5KXicwWIRR2fp4QDw1eY/JNw1pYl7M3B7ZKs72b85vhyGMu7+9N6xM mu/2GfO42m4hkWSEGl3Fdu9yLYb9uyYO2Lev5Oe5TCFi77/k+fMiawClKyQwTp+Azn1yo iXxqC9Mr06v6FuRRdLiFumrG/QDFpeU2mfmdm18v6zZIqja2yLx4/1l7qTNevRtVJdA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795674487; 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=kL06f/X8F0pCUsRpt4OdaQK/VJzX2vhlrvqULYx75ac=; b=Qd13xjKGQxyTxPDIMcC0Hr5VJGezlCGbPfXCj+daO6imdS6H3KKgYgRmEPlDxPRl41Ax EmEM9EArYCDdZUPerzLjyHLG7BbOsg1OhOhHK033xPLOF0RUA90zcDtWVAJ+C6HW/dn+D tRI+6r0nzJue5roIoDvXvEOm+ryhx2Yr8jZlfXasm9rszna7aZtMOnmWbRLx/YrXF/ddl 2A77On048rsChpzht4sAy6QTLd1SlioEbAkMj4jPb2gyb7d5/AElV/WvT69EVU04ljwwG O2D9/B6gm+YauG1EVzJGhMZzZBqV7nmFejnG1hAA5QHvvUZjLoT8N3Mf4Y0oTaG9pbA== 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=sxq1snzb; arc=none smtp.remote-ip=91.218.175.42 X-Received: from mta0.migadu.com (out-42.mta0.migadu.com [91.218.175.42]) (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 B85C0606A321 for <netdev@vger.kernel.org>; Thu, 26 Nov 2026 06:28:06 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B85C0606A321 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=it30w/qv5FXVyLwZWDrrsl536DanKovgZRDzj670pbM=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1795674485; v=1; x=1796279285; b=sxq1snzbUOM/HDs6qPhYgsJGKRXuj04O77TZ2waAtj02pyq6Oy3V9h0kkAvfhjoRQ63sj7LD I5M3OTwdI7MWYGmWUMdxAo8sZq+HR6RRZTaDLdU9z2XLFEK9AxsKsU920yWGjgpudl21lXXpABG iXbnzOF7EcbOrReleSdF9pec= X-Envelope-To: netdev@vger.kernel.org X-Received: by mta12.migadu.com with ESMTPS id 3d58059a4f084852; Thu, 26 Nov 2026 06:28:04 +0000 X-Mizu-Trace-ID: 3d58059a4f084852 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: <20261126-srv6_flavors_endx-v5-0-4d8232eec404@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 <hangbin.liu@linux.dev> X-Mailer: b4 0.16.0