Article View: linux.kernel.netdev
Article #25674[PATCH net-next v6 4/6] selftests: seg6: explicit cleanup for SRv6 End PSP test
From: Hangbin Liu
Date: Wed, 02 Dec 2026 08:46
Date: Wed, 02 Dec 2026 08:46
101 lines
11369 bytes
11369 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 35ac88a1e6cb..03c11a825c32 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:
<20261202-srv6_flavors_endx-v6-4-4e50b828e702@kylinos.cn>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375648-linux-kernel-netdev=dewy.ruReferences:
<20261202-srv6_flavors_endx-v6-0-4e50b828e702@kylinos.cn>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!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375648-linux-kernel-netdev=dewy.ru From: hangbin.liu@linux.dev (Hangbin Liu) Newsgroups: linux.kernel.netdev Subject: [PATCH net-next v6 4/6] selftests: seg6: explicit cleanup for SRv6 End PSP test Date: Wed, 02 Dec 2026 16:46:30 +0800 Organization: Usenet Network Message-ID: <20261202-srv6_flavors_endx-v6-4-4e50b828e702@kylinos.cn> References: <20261202-srv6_flavors_endx-v6-0-4e50b828e702@kylinos.cn> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="1926596"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:APdUxpyMJb1XK7rxB7YdYNocMy8= sha256:c8+7UkRomfjorOcuek0jAqddRBZnuPTu71S0eUF9wv8= sha1:pyJ+WttbciDTk3jLXa1brQvBj6c= sha256:FNK7qC27wq+pD/zkcXNfAfXir05WLtjA9eFjA6VTXjM= 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 6CF9A1175B6; Wed, 2 Dec 2026 11:47:44 +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 g40OsHH0sn7v; Wed, 2 Dec 2026 11:47:41 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-375648-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 587F211757C; Wed, 2 Dec 2026 11:47:32 +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 3E06E267F3; Wed, 2 Dec 2026 08:47:30 +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=1796201248; b=DFTYqiC2zEf8Kvav3ucJtjNoq5rpTTmbArXU3nvsPhP1u+a3sJ/mQQtrvx38qwAKmb8b TmReQ5xL0Ft+JAKYwhkVFRxPkbdcexXJj+H6L7PdlDfmvqAq1C5FtHC7Q4mh6M+aYQbd3 l/wzGf6yGWaYrYcM5foJcCD0hwLIKiDL7GpowfXCJtVMqeqW3l0YdZi837erYv4nVVtXi giOSFOIKeVmJ2F1hXAgtcpEBH4Mg0H3r1hZd+X3yAHHLO9ypDTheK2sEV5kG7T/T+qEAc Jaset/NUD/Q1sP54mpvp2yEWh9WqA3soHj5sXD6LIoPZyLznXQZMqeW3uwh5rySZ4kg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796201248; 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=rF0yQef9JqPmpmeFrHADsR8iLr1mFXfPfXdgGxD9odI=; b=sXvLm2wubqVbogisQBa14jM7opledVJ/9AqiyGVlMQhIGrwTeP7JjczApGwPcRm0am0T Tr1y+7VkeIvrh8lz6vzaW6IF4ptiY0I+TyK2aJsHGwjBP1g9gBo6OLX9k0R7dGZmAHWi5 bPpC45ou+vhC7HRdUt3Jb/+nMndgg5GVK6TDI8ioAQrISD6j/aPwPVo57zRyhOLSCOqRt t4h7M1AxWnKaRZ1uwDLwm2y3+kbnt/+vGX9NIiYZV0lFckPjiUvrq8F9ca2VZGGO2Ld8W nwiVvFszV6pkbvHo2gSkFPXqYMmhhF4aqhpBL/cxIBdREMh+AcRty3cWLYbMBBpnZow== 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="FOLZlx/q"; 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 EFE50606A6A9; Wed, 2 Dec 2026 08:47:27 +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=FOLZlx/q X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.1 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796201247; b=sX7kxmQ5ctg1vJZAFPdTRE4KT7sYzumSonofxAZ9Ji2lo2ESPuyVcyb+HcI0KQTugVLT EjarF4/laU/k/jpsW8rvflCbtwaeKiF/XU7dYXGMuNlqU/DqZQ6LPkUTyLeMHudeJX8yA WG/iXI0PzElotdN6kfOpRyWVn91HdadO+fADqYcFT9fYu0HDJ59haT0NaieowtzpNFA2U reUBY4b5SqILn0vrD7u8+0djCxO+2MRet73YnHbXaQ2AclCtlxW3oOjrm0l/8mvX/ue2T 0F7az9uJo39LUvDxsCy+Gtal5JfOfoT8DrSnQ7nal8FHWpU2+qveuGoCD9TwDYycB4g== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796201247; 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=rF0yQef9JqPmpmeFrHADsR8iLr1mFXfPfXdgGxD9odI=; b=nAtlVPYTln+7rPIRH5cIFMJV5HEVdxZsk3NWmRaVoUOpI9isaY9QkrWbLm1ZoJkeEoRd fCv2bgkqD31BLxILld2MIe2gLIWFTvZAjRszx7iqgCln4PtT/YW4LzvGrLy+YBIwowgAV V4L+22X6fgWxHQPbicJmqsoDzxc0Pqj4zV+fE/N9E8WwoXsOftWahET/KS0Je8z6qINYp BnzQYJLkVfH4mpv3mXdV4uliAZfIVKuvW8piMjyOALl0nf31ckazSUeD6PTGl+RarsFCa 7mxutfTkoSHHOzX+wYss3xc+8Mpn0ZD3yxS67cPR6FMXIOUW1QuZg51FkTJQliVyeaw== 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="FOLZlx/q"; arc=none smtp.remote-ip=91.218.175.1 X-Received: from mta0.migadu.com (out-1.mta0.migadu.com [91.218.175.1]) (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 308BF606A6AF for <netdev@vger.kernel.org>; Wed, 2 Dec 2026 08:47:18 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 308BF606A6AF 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=Z33U9y/uD7xNfaxGizcALUATWUN7nPqsvyvsEuEitJ4=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796201237; v=1; x=1796806037; b=FOLZlx/q9Yq66Y85Gbr1sQee+R0xLqPxHP5ktp3r5c60NcpMLvHnkm/PhnTYXNEvKoxqd7ce Ch/KpAwArqZO6eB5xu1jS0irgxfhoWOTmVw2AuEzf3yEfMChs/aE9NNUFYGEn0z7ThDwcD14nfr wR1JpErphn2MRxY3fIY4JHLg= X-Envelope-To: netdev@vger.kernel.org X-Received: by mta12.migadu.com with ESMTPS id e4ee26653e3c5cc3; Wed, 02 Dec 2026 08:47:17 +0000 X-Mizu-Trace-ID: e4ee26653e3c5cc3 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: <20261202-srv6_flavors_endx-v6-0-4e50b828e702@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