From nobody Thu Sep 24 16:09:58 2026 Received: from mta0.migadu.com (out-250.mta0.migadu.com [91.218.175.250]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B117528431 for ; Tue, 22 Sep 2026 08:55:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.250 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790067302; cv=none; b=MJ/ajCWYMMwyHgRvEg0ZNKlZgg+e+1ZHjH7z4Drvk9LjSWOoFdKdYZo7enu+FTKq+c4sTserAhUrgbPxiAOel5qwHjsOXLpIzt8TtGNv07IkctEfzevSMB+mI4Tr30H/MnV538J6LfFPtRyGTC97qq5SEMnFKnc1i74S6h7afnw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790067302; c=relaxed/simple; bh=988pi3oTdtsnoS5j0ActZjzPjSaiob3jbZgYYhq8UUM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=I/Y0KVDusHeVXmJiw3iCwgXbX+uQW0GI7IfuQSMECkH7MPwWrjxs9R49o5HN1UFJHAS5wZqDgo6mCFwwhK4Y4sF2hCCgIqH2bz2t5YLNyqBIMh4+88k6k8UQkQOXyR05TzedEst6R2KR0EUnLDeBGLXMTwj+BPo/XAEUCZeUqT0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=jjWOtt7W; arc=none smtp.client-ip=91.218.175.250 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="jjWOtt7W" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=988pi3oTdtsnoS5j0ActZjzPjSaiob3jbZgYYhq8UUM=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1790067298; v=1; x=1790672098; b=jjWOtt7Wwdw+7deOVWe+RlTVKbG2ojFs0jRO4hUj4FwYNbp1rijsngDUmTPOVUyiqdzZB9dq J++McUz8Pd2MjTFvJFVh/GlaD6rYK0aGiR4HPGDmRzMzOu4jX384ORR+R1aKgAzHeEYkoY6S2lg M8VxuachIl5ZyWQuVcP06js4= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 7a67b773cacf3de3; Tue, 22 Sep 2026 08:54:58 +0000 X-Mizu-Trace-ID: 7a67b773cacf3de3 X-Migadu-Flow: FLOW_OUT From: Hangbin Liu Date: Tue, 22 Sep 2026 16:54:43 +0800 Subject: [PATCH net-next 1/5] seg6: split final End process out of flavor processing Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260922-srv6_flavors_endx-v1-1-4d01c05c47b7@kylinos.cn> References: <20260922-srv6_flavors_endx-v1-0-4d01c05c47b7@kylinos.cn> In-Reply-To: <20260922-srv6_flavors_endx-v1-0-4d01c05c47b7@kylinos.cn> To: Andrea Mayer , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Shuah Khan Cc: Hangbin Liu , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Hangbin Liu X-Mailer: b4 0.14.3 From: Hangbin Liu Move the final End forwarding step out of end_flv8986_core() and return success to the caller instead. Currently end_flv8986_core() performs both RFC8986 flavor processing and final End forwarding by calling input_action_end_finish(). That couples flavor handling with the End-specific forwarding path, which makes it hard to reuse the same flavor logic for other End variants. Split the two steps so input_action_end() does: 1) end_flv8986_core() for flavor processing 2) input_action_end_finish() for final forwarding This keeps end_flv8986_core() focused on RFC8986/PSP flavor semantics and makes it easier to plug the same flavor core into End.X/T later. Signed-off-by: Hangbin Liu --- net/ipv6/seg6_local.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c index d1070aec7b72..584e6aca3893 100644 --- a/net/ipv6/seg6_local.c +++ b/net/ipv6/seg6_local.c @@ -804,7 +804,7 @@ static int end_flv8986_core(struct sk_buff *skb, struct= seg6_local_lwt *slwt) goto drop; } =20 - return input_action_end_finish(skb, slwt); + return 0; =20 drop: kfree_skb(skb); @@ -816,6 +816,7 @@ static int input_action_end(struct sk_buff *skb, struct= seg6_local_lwt *slwt) { const struct seg6_flavors_info *finfo =3D &slwt->flv_info; __u32 fops =3D finfo->flv_ops; + int ret; =20 if (!fops) return input_action_end_core(skb, slwt); @@ -829,7 +830,10 @@ static int input_action_end(struct sk_buff *skb, struc= t seg6_local_lwt *slwt) * information extracted from the packet, e.g. presence/absence of SRH, * Segment Left =3D 0, etc. */ - return end_flv8986_core(skb, slwt); + ret =3D end_flv8986_core(skb, slwt); + if (ret) + return ret; + return input_action_end_finish(skb, slwt); } =20 /* regular endpoint, and forward to specified nexthop */ --=20 2.55.0 From nobody Thu Sep 24 16:09:58 2026 Received: from mta0.migadu.com (out-3.mta0.migadu.com [91.218.175.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CED5352B1F4 for ; Tue, 22 Sep 2026 08:55:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.3 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790067307; cv=none; b=mzsGtKdo8mFEl4izq7pa7AJyT4ESbopl1aaHP+4W7HBgs+Jb6QLOADSTbajL5MbNHBFLVEIvf2w/UlEj2MAa3VJAKYNe5KKeu+ECnApoo4UjKYj/KgVH4KbQANiEKcKs6AKuhRxkzKJnL5ZINVdsMQQ7RihXkC9kWYnsQHKW+6U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790067307; c=relaxed/simple; bh=RqklO2bnVUUdxOx30CGmegn1deBHfBqHXY4iYTWrDmU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ty5dVydt9FNRnPo9KjFrnTicAkk2XwQUeVSBWkztk2Xd2QQbw6bxe/U1Ho6tsKs0aCa8g80+tNjjiC64tLi1Lf0NcBsbsfu0Cq4cgpRg7pQU7OTzvVdiJmKhdgJbWJ0noKG60XENF4+Ykc+TNUVTKL5O1S4146XHSQ//Ki0A4vU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=uEUFG+/k; arc=none smtp.client-ip=91.218.175.3 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="uEUFG+/k" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=RqklO2bnVUUdxOx30CGmegn1deBHfBqHXY4iYTWrDmU=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1790067303; v=1; x=1790672103; b=uEUFG+/kP1/UHZ0s4s0rhpizbRhSbSSrFOKTEL/xcvH/NvqU+aPH4XXmykC9rAKVe1s7xhTZ Q7R3a4YHfQMqVo0ySYpqZlONt7ASxTvGKnbW+n8CwDOxmznVue7gQedj4HNWm//0C06Wib6fHjD qvnDehdOwqAeveGPC4m6UF9M= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id c341bbbc24247b6b; Tue, 22 Sep 2026 08:55:02 +0000 X-Mizu-Trace-ID: c341bbbc24247b6b X-Migadu-Flow: FLOW_OUT From: Hangbin Liu Date: Tue, 22 Sep 2026 16:54:44 +0800 Subject: [PATCH net-next 2/5] seg6: add RFC8986 flavor support for End.X Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260922-srv6_flavors_endx-v1-2-4d01c05c47b7@kylinos.cn> References: <20260922-srv6_flavors_endx-v1-0-4d01c05c47b7@kylinos.cn> In-Reply-To: <20260922-srv6_flavors_endx-v1-0-4d01c05c47b7@kylinos.cn> To: Andrea Mayer , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Shuah Khan Cc: Hangbin Liu , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Hangbin Liu X-Mailer: b4 0.14.3 From: Hangbin Liu Previously End.X only supported NEXT-C-SID, with a plain fallback to input_action_end_x_core(). Add PSP End.X processing by reusing end_flv8986_core(). Add SEG6_LOCAL_FLV8986_SUPP_OPS to SEG6_LOCAL_END_X_FLV_SUPP_OPS so End.X advertises PSP flavor support. Signed-off-by: Hangbin Liu --- net/ipv6/seg6_local.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c index 584e6aca3893..7462da1da362 100644 --- a/net/ipv6/seg6_local.c +++ b/net/ipv6/seg6_local.c @@ -121,7 +121,8 @@ struct bpf_lwt_prog { =20 #define SEG6_LOCAL_END_FLV_SUPP_OPS (SEG6_F_LOCAL_FLV_NEXT_CSID | \ SEG6_LOCAL_FLV8986_SUPP_OPS) -#define SEG6_LOCAL_END_X_FLV_SUPP_OPS SEG6_F_LOCAL_FLV_NEXT_CSID +#define SEG6_LOCAL_END_X_FLV_SUPP_OPS (SEG6_F_LOCAL_FLV_NEXT_CSID | \ + SEG6_LOCAL_FLV8986_SUPP_OPS) =20 struct seg6_flavors_info { /* Flavor operations */ @@ -841,12 +842,19 @@ static int input_action_end_x(struct sk_buff *skb, st= ruct seg6_local_lwt *slwt) { const struct seg6_flavors_info *finfo =3D &slwt->flv_info; __u32 fops =3D finfo->flv_ops; + int ret; + + if (!fops) + return input_action_end_x_core(skb, slwt); =20 /* check for the presence of NEXT-C-SID since it applies first */ if (seg6_next_csid_enabled(fops)) return end_x_next_csid_core(skb, slwt); =20 - return input_action_end_x_core(skb, slwt); + ret =3D end_flv8986_core(skb, slwt); + if (ret) + return ret; + return input_action_end_x_finish(skb, slwt); } =20 static int input_action_end_t(struct sk_buff *skb, struct seg6_local_lwt *= slwt) --=20 2.55.0 From nobody Thu Sep 24 16:09:58 2026 Received: from mta1.migadu.com (out-108.mta1.migadu.com [95.215.58.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3BD5E52E04D for ; Tue, 22 Sep 2026 08:55:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.108 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790067313; cv=none; b=muTLTTWrUEFjasBqyn/1SkfYhLMTtqUo1qWvuN7gHt8yymjMKPD0oNOJYidJk+3pkoRC1zaZgx9wWBHiAIh4rrqv4V2Ft2cb7nqg/v5e9n6lFputkny20rzIFvWtCYRj0g+8gs+sP6TxbXZAwKJ5mS2t8MTG6pl/hZ59UFDiZhw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790067313; c=relaxed/simple; bh=VrecCAfrMmNVamb9Ih2HuJoCchMbXQT7mg1cMbwjUGk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iZ0TZu7qcKIrtRX8xOJ9g11pL7b5t+ogg7AWI9PLIzptlKP8nUMLyQkiQz6d7nIAzf3s6spe7S8o7u1DIhbz/dkf5mlQyJwKp7MiHaNEJdeHKqe1700H0AkyC/9QzqOhpvMnSi4Yfrnd3ObY7R/8UT/PQihPe7JtfDwjaJYPd04= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=qw2amp0S; arc=none smtp.client-ip=95.215.58.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="qw2amp0S" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=VrecCAfrMmNVamb9Ih2HuJoCchMbXQT7mg1cMbwjUGk=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1790067309; v=1; x=1790672109; b=qw2amp0ShewPfxJThgxg/ktIFNlb0x3y4julZFzi+OJrjGLWBs5M84y50orFUNr/ibSP4GOb t8SyqOmcLbKTvWBsUv2gNYfcw+6/HxcOw+2z/ddF2fMkrBccoJ3WvPGrGIMscZi2Hh/moFpAhmM gj5Ysn02XsrKmq0JO7z+uK7Q= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 3d633f2eacbd48c7; Tue, 22 Sep 2026 08:55:08 +0000 X-Mizu-Trace-ID: 3d633f2eacbd48c7 X-Migadu-Flow: FLOW_OUT From: Hangbin Liu Date: Tue, 22 Sep 2026 16:54:45 +0800 Subject: [PATCH net-next 3/5] selftests: seg6: move SRv6 End PSP setup into its own helper Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260922-srv6_flavors_endx-v1-3-4d01c05c47b7@kylinos.cn> References: <20260922-srv6_flavors_endx-v1-0-4d01c05c47b7@kylinos.cn> In-Reply-To: <20260922-srv6_flavors_endx-v1-0-4d01c05c47b7@kylinos.cn> To: Andrea Mayer , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Shuah Khan Cc: Hangbin Liu , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Hangbin Liu X-Mailer: b4 0.14.3 From: Hangbin Liu Extract the End PSP policy setup from setup() into setup_end_flv_psp(). Currently setup() installs both the base topology and the End PSP policy. That couples general SRv6 test setup with a specific flavor test case, which makes it hard to add other flavor scenarios cleanly. Split the PSP-specific setup into its own helper so each PSP test case can setup and later cleanup independently. Use set -e around the PSP setup block so failures during setup are treated as errors instead of silently continuing into the connectivity checks. Signed-off-by: Hangbin Liu --- tools/testing/selftests/net/srv6_end_flavors_test.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/net/srv6_end_flavors_test.sh b/tools/t= esting/selftests/net/srv6_end_flavors_test.sh index 318487eda671..56a1c5f865a7 100755 --- a/tools/testing/selftests/net/srv6_end_flavors_test.sh +++ b/tools/testing/selftests/net/srv6_end_flavors_test.sh @@ -645,6 +645,12 @@ setup() setup_rt_local_sids 3 "1 2 4" setup_rt_local_sids 4 "1 2 3" =20 + # testing environment was set up successfully + SETUP_ERR=3D0 +} + +setup_end_flv_psp() +{ # 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. @@ -661,9 +667,6 @@ setup() # - rt-1 (SRv6 End flavor PSP with SL=3D1) setup_rt_policy_ipv6 2 1 "3:noflv 4:psp 2:psp" setup_rt_policy_ipv6 1 2 "1:psp" - - # testing environment was set up successfully - SETUP_ERR=3D0 } =20 check_rt_connectivity() @@ -758,7 +761,13 @@ host2gateway_tests() =20 host_srv6_end_flv_psp_tests() { - log_section "SRv6 connectivity test hosts (h1 <-> h2, PSP flavor)" + set -e + SETUP_ERR=3D1 + setup_end_flv_psp + SETUP_ERR=3D0 + set +e + + log_section "SRv6 connectivity test hosts (h1 <-> h2, End flavor PSP)" =20 check_and_log_hs_connectivity 1 2 check_and_log_hs_connectivity 2 1 --=20 2.55.0 From nobody Thu Sep 24 16:09:58 2026 Received: from mta1.migadu.com (out-116.mta1.migadu.com [95.215.58.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6963B51C042 for ; Tue, 22 Sep 2026 08:55:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790067335; cv=none; b=QKhCOaD3MEp5IictT49VnyQL2KiaW3U42d6KB5B/GxwqAMH7pDfKYUyVKzLDXWlD2uLW67jSEBLAO5OFuEsIZuHKTTZ749m9R3hEJyQycej7OW+8xBOU0AP8bPPhXNTURC3U0MBx8W1cC6pZ52jcTlF5+ZbHsT0uoU+Kleyhhvc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790067335; c=relaxed/simple; bh=RVa+QN9BbYwwQIvQ58JLG7DM/SEnz2K6A3lncWeiB2g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TIJGGJy5lrGR8Bz6RcTPb02chuWNspMJqgd2ZFfHhZKEj0zGAcm1CYdUqS/pQ+PHGk7LXrhW2vhXdZcT2ddNQ6nnyeCl+8VxxFyHYRWEsT4IR31ChCGrasWrerNpy+Sg+P479sYftBJf0L6g6skqCJanOwuysLPFaSHq8Y4z1I8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=dFe0/2/C; arc=none smtp.client-ip=95.215.58.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="dFe0/2/C" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=RVa+QN9BbYwwQIvQ58JLG7DM/SEnz2K6A3lncWeiB2g=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1790067331; v=1; x=1790672131; b=dFe0/2/CFH0yXlkfaeh/FVz3DRc6CN9Dq/+VE+isNzW/EeJH53C2jrCqc7kVtgt4qLxCOOeT oXuITShSM23JcsxKTWDHL4425F3USCJ221ykV2AOBkQi1Lupiq0Miqb96UY66LSG6d35j+DbgWt J3jNasQMEde8s9fAO7RktNFw= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 96a8b57497de07d5; Tue, 22 Sep 2026 08:55:14 +0000 X-Mizu-Trace-ID: 96a8b57497de07d5 X-Migadu-Flow: FLOW_OUT From: Hangbin Liu Date: Tue, 22 Sep 2026 16:54:46 +0800 Subject: [PATCH net-next 4/5] selftest: seg6: add explicit cleanup for SRv6 End PSP test Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260922-srv6_flavors_endx-v1-4-4d01c05c47b7@kylinos.cn> References: <20260922-srv6_flavors_endx-v1-0-4d01c05c47b7@kylinos.cn> In-Reply-To: <20260922-srv6_flavors_endx-v1-0-4d01c05c47b7@kylinos.cn> To: Andrea Mayer , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Shuah Khan Cc: Hangbin Liu , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Hangbin Liu X-Mailer: b4 0.14.3 From: Hangbin Liu The PSP test installs policy and route state, but relies on global cleanup to tear it down. That can leave flavor-specific state around when later tests are added to the same script. Add cleanup_end_flv_psp() and run it at the end of host_srv6_end_flv_psp_tests(). The host proxies are needed by all PSP testing. So move it to common setup() and no need to delete. Signed-off-by: Hangbin Liu --- .../testing/selftests/net/srv6_end_flavors_test.sh | 70 ++++++++++++++++++= ++-- 1 file changed, 66 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/net/srv6_end_flavors_test.sh b/tools/t= esting/selftests/net/srv6_end_flavors_test.sh index 56a1c5f865a7..52731983b4cc 100755 --- a/tools/testing/selftests/net/srv6_end_flavors_test.sh +++ b/tools/testing/selftests/net/srv6_end_flavors_test.sh @@ -564,10 +564,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}" } =20 # see __setup_rt_policy @@ -576,6 +572,56 @@ setup_rt_policy_ipv6() __setup_rt_policy "$1" "$2" "$3" } =20 +cleanup_rt_policy_ipv6() +{ + local dst=3D"$1" + local encap_rt=3D"$2" + local policy_rts=3D"$3" + local in_nsname + local rt_nsname + local function + local fullsid + local op_type + local node + local n + + in_nsname=3D"$(get_rtname "${encap_rt}")" + + for n in ${policy_rts}; do + node=3D"$(__get_srv6_rtcfg_id "${n}")" + op_type=3D"$(__get_srv6_rtcfg_op "${n}")" + rt_nsname=3D"$(get_rtname "${node}")" + + case "${op_type}" in + "noflv") + function=3D"${END_FUNC}" + ;; + + "psp") + function=3D"${END_PSP_FUNC}" + ;; + + *) + break + ;; + esac + + fullsid=3D"${LOCATOR_SERVICE}:${node}::${function}" + + # Remove SRv6 Endpoint behavior for the selected router + if ip -netns "${rt_nsname}" -6 route get "${fullsid}" &>/dev/null; then + ip -netns "${rt_nsname}" -6 route \ + del "${fullsid}" \ + table "${LOCALSID_TABLE_ID}" \ + dev "${DUMMY_DEVNAME}" + fi + done + + # Remove SRv6 policy for incoming traffic sent by connected hosts + ip -netns "${in_nsname}" -6 route \ + del "${IPv6_HS_NETWORK}::${dst}" dev "${DUMMY_DEVNAME}" +} + setup_hs() { local hs=3D"$1" @@ -645,6 +691,14 @@ setup() setup_rt_local_sids 3 "1 2 4" setup_rt_local_sids 4 "1 2 3" =20 + # setup proxy on route entries for hosts + ip -netns "$(get_rtname 1)" -6 neigh add \ + proxy "${IPv6_HS_NETWORK}::2" \ + dev "${RT2HS_DEVNAME}" + ip -netns "$(get_rtname 2)" -6 neigh add \ + proxy "${IPv6_HS_NETWORK}::1" \ + dev "${RT2HS_DEVNAME}" + # testing environment was set up successfully SETUP_ERR=3D0 } @@ -669,6 +723,12 @@ setup_end_flv_psp() setup_rt_policy_ipv6 1 2 "1:psp" } =20 +cleanup_end_flv_psp() +{ + cleanup_rt_policy_ipv6 2 1 "3:noflv 4:psp 2:psp" + cleanup_rt_policy_ipv6 1 2 "1:psp" +} + check_rt_connectivity() { local rtsrc=3D"$1" @@ -771,6 +831,8 @@ host_srv6_end_flv_psp_tests() =20 check_and_log_hs_connectivity 1 2 check_and_log_hs_connectivity 2 1 + + cleanup_end_flv_psp } =20 test_iproute2_supp_or_ksft_skip() --=20 2.55.0 From nobody Thu Sep 24 16:09:58 2026 Received: from mta1.migadu.com (out-130.mta1.migadu.com [95.215.58.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B890B52845D for ; Tue, 22 Sep 2026 08:55:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790067345; cv=none; b=kW/eQIFgD3OWxzxZEF3l7hNC5W5IoJ0EjmibHRRm4kl+FTc38ubSf6XJgnmNr76e9bh9H1muUduqtrm/DPC9+phtZVf88CjwipG/CNq6Qy//zfbM5jygC7iCQE1u9ZLz3rAxvCoIyXNFtQo2pX8aE0WFWXT3KznTFip2DIvvMRw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790067345; c=relaxed/simple; bh=9S/WJv5Rt2cdity4AXgyXkjGtrAC7glb1fuugeDEndY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bNpKAK6l8OJVkm89WxcE+/89fOEUAUqt1AByIAVZQppX0UUULfC9QQxdwiV3lA5ULHNJppslivGLUvHRujontj8dRB55ZsBW44BJOkyX7kp1hiV0Dg+tFm/A4PwjgVa7orCmyaxqFxNgqj/SjHmJu5upxuUAhIRV8cg1z/5aBK8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=O3Tow/d1; arc=none smtp.client-ip=95.215.58.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="O3Tow/d1" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=9S/WJv5Rt2cdity4AXgyXkjGtrAC7glb1fuugeDEndY=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1790067341; v=1; x=1790672141; b=O3Tow/d1XCGCBR2TdjQ/H58iqMxdOun/VDcu/C2TdZOha/udM8n7sYKGKczJv1E6FWGuuSTw Tnu6N8oaBNrWp5+CkS1OnF42E+o00rS1Lm/3i7E/HUs7HLehfwBXPNnYVKk/uJuIKPUy71LTAN/ yQ1fKP2Oq59AH5Vd7mDTtuEY= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id ef8445d551e51785; Tue, 22 Sep 2026 08:55:41 +0000 X-Mizu-Trace-ID: ef8445d551e51785 X-Migadu-Flow: FLOW_OUT From: Hangbin Liu Date: Tue, 22 Sep 2026 16:54:47 +0800 Subject: [PATCH net-next 5/5] selftests: seg6: add End.X PSP selftest Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260922-srv6_flavors_endx-v1-5-4d01c05c47b7@kylinos.cn> References: <20260922-srv6_flavors_endx-v1-0-4d01c05c47b7@kylinos.cn> In-Reply-To: <20260922-srv6_flavors_endx-v1-0-4d01c05c47b7@kylinos.cn> To: Andrea Mayer , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Shuah Khan Cc: Hangbin Liu , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Hangbin Liu X-Mailer: b4 0.14.3 From: Hangbin Liu The current selftest only exercises End with PSP. Add a new test that uses End.X on the PSP path so the kernel's End.X flavor handling is validated end to end. Extend __setup_rt_policy() to parse End.X action field from the router description, allowing entries like: 4:psp:End.X,4,2 3:psp:End.X,3,1 Since SETUP_ERR is not set in one setup function, and the middle test may set ret to 1, we also need to check ret before setting the result as SKIP. Signed-off-by: Hangbin Liu --- .../testing/selftests/net/srv6_end_flavors_test.sh | 83 ++++++++++++++++++= ++-- 1 file changed, 78 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/net/srv6_end_flavors_test.sh b/tools/t= esting/selftests/net/srv6_end_flavors_test.sh index 52731983b4cc..e130d0d71b3d 100755 --- a/tools/testing/selftests/net/srv6_end_flavors_test.sh +++ b/tools/testing/selftests/net/srv6_end_flavors_test.sh @@ -194,8 +194,8 @@ # after the IPv6 header. At this point, the packet with IPv6 DA=3Dcafe::1 = is sent # to the destination, i.e. hs-1. =20 -# Kselftest framework requirement - SKIP code is 4. -readonly ksft_skip=3D4 +# shellcheck source=3Dlib.sh +source lib.sh =20 readonly RDMSUFF=3D"$(mktemp -u XXXXXXXX)" readonly DUMMY_DEVNAME=3D"dum0" @@ -345,7 +345,7 @@ 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 + if [ "${SETUP_ERR}" -ne 0 ] && [ "$ret" -ne "$ksft_fail" ]; then echo "SKIP: Setting up the testing environment failed" exit "${ksft_skip}" fi @@ -414,6 +414,36 @@ __get_srv6_rtcfg_op() xargs | sed 's/ /,/g' } =20 +# Given the description of a router as an input, the function +# returns the token which represents the action (e.g. End, End.X, +# End.T behavior with or without route table, out interface) configured +# for the node. +# +# Support End, End.X at present. When omit, return default End behavior. +# i.e. input: "1:psp:End.X,1,3" +# output: "End.X nh6 fcf0:0:1:3::3 oif veth-rt-1-3" +__get_srv6_rtcfg_act() +{ + local element=3D"$1" + local net_prefix + local acts + local out + + acts=3D"$(echo "${element}" | cut -d':' -f3)" + act=3D"$(echo "${acts}" | cut -d',' -f1)" + act=3D"${act:-"End"}" + + rt=3D"$(echo "${acts}" | cut -d',' -f2)" + neigh=3D"$(echo "${acts}" | cut -d',' -f3)" + + if [ "$act" =3D=3D "End" ]; then + echo "End" + elif [ "$act" =3D=3D "End.X" ]; then + net_prefix=3D"$(get_network_prefix "${rt}" "${neigh}")" + echo "End.X nh6 ${net_prefix}::${neigh} oif veth-rt-${rt}-${neigh}" + fi +} + # Setup the basic networking for the routers setup_rt_networking() { @@ -514,6 +544,7 @@ __setup_rt_policy() local function local fullsid local op_type + local action local node local n =20 @@ -522,19 +553,20 @@ __setup_rt_policy() for n in ${policy_rts}; do node=3D"$(__get_srv6_rtcfg_id "${n}")" op_type=3D"$(__get_srv6_rtcfg_op "${n}")" + action=3D"$(__get_srv6_rtcfg_act "${n}")" rt_nsname=3D"$(get_rtname "${node}")" =20 case "${op_type}" in "noflv") policy=3D"${policy}${LOCATOR_SERVICE}:${node}::${END_FUNC}," function=3D"${END_FUNC}" - behavior_cfg=3D"End" + behavior_cfg=3D"${action}" ;; =20 "psp") policy=3D"${policy}${LOCATOR_SERVICE}:${node}::${END_PSP_FUNC}," function=3D"${END_PSP_FUNC}" - behavior_cfg=3D"End flavors psp" + behavior_cfg=3D"${action} flavors psp" ;; =20 *) @@ -729,6 +761,30 @@ cleanup_end_flv_psp() cleanup_rt_policy_ipv6 1 2 "1:psp" } =20 +setup_endx_flv_psp() +{ + # Direction hs-1 -> hs-2 (End.X PSP flavor) + # SID List=3Dfcff:3::e,fcff:4::ef1,cafe::2 + # - rt-1 (SRv6 H.Insert policy) + # - rt-3 (SRv6 End behavior) + # - rt-4 (SRv6 End.X flavor PSP with SL=3D1) + # - rt-2 (Route to hs-2 via nh and oif) + # + # Direction hs-2 -> hs-1 (End.X PSP flavor) + # SID List=3Dfcff:3::ef1,cafe::1 + # - rt-2 (SRv6 H.Insert policy) + # - rt-3 (SRv6 End.X flavor PSP with SL=3D1) + # - rt-1 (Route to hs-1 via nh and oif) + setup_rt_policy_ipv6 2 1 "3:noflv:End 4:psp:End.X,4,2" + setup_rt_policy_ipv6 1 2 "3:psp:End.X,3,1" +} + +cleanup_endx_flv_psp() +{ + cleanup_rt_policy_ipv6 2 1 "3:noflv 4:psp" + cleanup_rt_policy_ipv6 1 2 "3:psp" +} + check_rt_connectivity() { local rtsrc=3D"$1" @@ -835,6 +891,22 @@ host_srv6_end_flv_psp_tests() cleanup_end_flv_psp } =20 +host_srv6_endx_flv_psp_tests() +{ + set -e + SETUP_ERR=3D1 + setup_endx_flv_psp + SETUP_ERR=3D0 + set +e + + log_section "SRv6 connectivity test hosts (h1 <-> h2, End.X flavor PSP)" + + check_and_log_hs_connectivity 1 2 + check_and_log_hs_connectivity 2 1 + + cleanup_endx_flv_psp +} + test_iproute2_supp_or_ksft_skip() { local flavor=3D"$1" @@ -936,5 +1008,6 @@ set +e router_tests host2gateway_tests host_srv6_end_flv_psp_tests +host_srv6_endx_flv_psp_tests =20 print_log_test_results --=20 2.55.0