* [PATCH net-next 1/5] seg6: split final End process out of flavor processing
2026-09-22 8:54 [PATCH net-next 0/5] seg6: add End.X PSP flavor support and selftests Hangbin Liu
@ 2026-09-22 8:54 ` Hangbin Liu
2026-09-23 11:46 ` Andrea Mayer
2026-09-22 8:54 ` [PATCH net-next 2/5] seg6: add RFC8986 flavor support for End.X Hangbin Liu
` (3 subsequent siblings)
4 siblings, 1 reply; 14+ messages in thread
From: Hangbin Liu @ 2026-09-22 8:54 UTC (permalink / raw)
To: Andrea Mayer, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Shuah Khan
Cc: Hangbin Liu, netdev, linux-kernel, linux-kselftest, Hangbin Liu
From: Hangbin Liu <liuhangbin@kylinos.cn>
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 <liuhangbin@kylinos.cn>
---
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;
}
- return input_action_end_finish(skb, slwt);
+ return 0;
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 = &slwt->flv_info;
__u32 fops = finfo->flv_ops;
+ int ret;
if (!fops)
return input_action_end_core(skb, slwt);
@@ -829,7 +830,10 @@ static int input_action_end(struct sk_buff *skb, struct seg6_local_lwt *slwt)
* information extracted from the packet, e.g. presence/absence of SRH,
* Segment Left = 0, etc.
*/
- return end_flv8986_core(skb, slwt);
+ ret = end_flv8986_core(skb, slwt);
+ if (ret)
+ return ret;
+ return input_action_end_finish(skb, slwt);
}
/* regular endpoint, and forward to specified nexthop */
--
2.55.0
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH net-next 1/5] seg6: split final End process out of flavor processing
2026-09-22 8:54 ` [PATCH net-next 1/5] seg6: split final End process out of flavor processing Hangbin Liu
@ 2026-09-23 11:46 ` Andrea Mayer
2026-09-24 8:11 ` Hangbin Liu
0 siblings, 1 reply; 14+ messages in thread
From: Andrea Mayer @ 2026-09-23 11:46 UTC (permalink / raw)
To: Hangbin Liu
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Shuah Khan, netdev, linux-kernel, linux-kselftest,
Hangbin Liu, stefano.salsano, Andrea Mayer
On Tue, 22 Sep 2026 16:54:43 +0800
Hangbin Liu <hangbin.liu@linux.dev> wrote:
Hi Hangbin,
thanks for the patch.
> From: Hangbin Liu <liuhangbin@kylinos.cn>
>
> 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 <liuhangbin@kylinos.cn>
> ---
> 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;
> }
>
> - return input_action_end_finish(skb, slwt);
> + return 0;
>
> 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 = &slwt->flv_info;
> __u32 fops = finfo->flv_ops;
> + int ret;
>
> if (!fops)
> return input_action_end_core(skb, slwt);
> @@ -829,7 +830,10 @@ static int input_action_end(struct sk_buff *skb, struct seg6_local_lwt *slwt)
> * information extracted from the packet, e.g. presence/absence of SRH,
> * Segment Left = 0, etc.
> */
> - return end_flv8986_core(skb, slwt);
> + ret = end_flv8986_core(skb, slwt);
> + if (ret)
> + return ret;
A nit: a blank line before the final return would match the rest of
the file.
> + return input_action_end_finish(skb, slwt);
> }
This changes the semantics of end_flv8986_core(): it no longer
forwards the packet, it only processes it, and the caller does the
finish step. Is it worth saying so in a comment above the function? A
future caller that misses it would leak the skb.
A heads-up: reviewing this made me notice that a fix I have pending
for net touches these same lines. It makes the skb data writable
before advance_nextseg() modifies Segments Left and the IPv6
destination address, since today a clone sees the change.
It also turns the "kfree_skb(skb); return -EINVAL;" right below into
kfree_skb_reason(). Since it goes through net, this hunk may need a
rebase once net is merged back into net-next.
Ciao,
Andrea
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH net-next 1/5] seg6: split final End process out of flavor processing
2026-09-23 11:46 ` Andrea Mayer
@ 2026-09-24 8:11 ` Hangbin Liu
0 siblings, 0 replies; 14+ messages in thread
From: Hangbin Liu @ 2026-09-24 8:11 UTC (permalink / raw)
To: Andrea Mayer
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Shuah Khan, netdev, linux-kernel, linux-kselftest,
Hangbin Liu, stefano.salsano
On Wed, Sep 23, 2026 at 01:46:37PM +0200, Andrea Mayer wrote:
> > @@ -829,7 +830,10 @@ static int input_action_end(struct sk_buff *skb, struct seg6_local_lwt *slwt)
> > * information extracted from the packet, e.g. presence/absence of SRH,
> > * Segment Left = 0, etc.
> > */
> > - return end_flv8986_core(skb, slwt);
> > + ret = end_flv8986_core(skb, slwt);
> > + if (ret)
> > + return ret;
>
> A nit: a blank line before the final return would match the rest of
> the file.
OK
>
> > + return input_action_end_finish(skb, slwt);
> > }
>
> This changes the semantics of end_flv8986_core(): it no longer
> forwards the packet, it only processes it, and the caller does the
> finish step. Is it worth saying so in a comment above the function? A
> future caller that misses it would leak the skb.
I will add a comment for the function change.
>
> A heads-up: reviewing this made me notice that a fix I have pending
> for net touches these same lines. It makes the skb data writable
> before advance_nextseg() modifies Segments Left and the IPv6
> destination address, since today a clone sees the change.
> It also turns the "kfree_skb(skb); return -EINVAL;" right below into
> kfree_skb_reason(). Since it goes through net, this hunk may need a
> rebase once net is merged back into net-next.
Sure, I will do rebase once it merged to net-next.
Thanks
Hangbin
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH net-next 2/5] seg6: add RFC8986 flavor support for End.X
2026-09-22 8:54 [PATCH net-next 0/5] seg6: add End.X PSP flavor support and selftests Hangbin Liu
2026-09-22 8:54 ` [PATCH net-next 1/5] seg6: split final End process out of flavor processing Hangbin Liu
@ 2026-09-22 8:54 ` Hangbin Liu
2026-09-23 16:05 ` Andrea Mayer
2026-09-24 11:57 ` netdev-bot+sashiko
2026-09-22 8:54 ` [PATCH net-next 3/5] selftests: seg6: move SRv6 End PSP setup into its own helper Hangbin Liu
` (2 subsequent siblings)
4 siblings, 2 replies; 14+ messages in thread
From: Hangbin Liu @ 2026-09-22 8:54 UTC (permalink / raw)
To: Andrea Mayer, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Shuah Khan
Cc: Hangbin Liu, netdev, linux-kernel, linux-kselftest, Hangbin Liu
From: Hangbin Liu <liuhangbin@kylinos.cn>
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 <liuhangbin@kylinos.cn>
---
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 {
#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)
struct seg6_flavors_info {
/* Flavor operations */
@@ -841,12 +842,19 @@ static int input_action_end_x(struct sk_buff *skb, struct seg6_local_lwt *slwt)
{
const struct seg6_flavors_info *finfo = &slwt->flv_info;
__u32 fops = finfo->flv_ops;
+ int ret;
+
+ if (!fops)
+ return input_action_end_x_core(skb, slwt);
/* 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);
- return input_action_end_x_core(skb, slwt);
+ ret = end_flv8986_core(skb, slwt);
+ if (ret)
+ return ret;
+ return input_action_end_x_finish(skb, slwt);
}
static int input_action_end_t(struct sk_buff *skb, struct seg6_local_lwt *slwt)
--
2.55.0
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH net-next 2/5] seg6: add RFC8986 flavor support for End.X
2026-09-22 8:54 ` [PATCH net-next 2/5] seg6: add RFC8986 flavor support for End.X Hangbin Liu
@ 2026-09-23 16:05 ` Andrea Mayer
2026-09-24 10:55 ` Hangbin Liu
2026-09-24 11:57 ` netdev-bot+sashiko
1 sibling, 1 reply; 14+ messages in thread
From: Andrea Mayer @ 2026-09-23 16:05 UTC (permalink / raw)
To: Hangbin Liu
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Shuah Khan, netdev, linux-kernel, linux-kselftest,
Hangbin Liu, stefano.salsano, Andrea Mayer
On Tue, 22 Sep 2026 16:54:44 +0800
Hangbin Liu <hangbin.liu@linux.dev> wrote:
Hi Hangbin,
please see below.
> From: Hangbin Liu <liuhangbin@kylinos.cn>
>
> 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 <liuhangbin@kylinos.cn>
> ---
> 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 {
>
> #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)
>
This adds PSP to a mask that already had NEXT-C-SID. PSP alone then
works through end_flv8986_core().
> struct seg6_flavors_info {
> /* Flavor operations */
> @@ -841,12 +842,19 @@ static int input_action_end_x(struct sk_buff *skb, struct seg6_local_lwt *slwt)
> {
> const struct seg6_flavors_info *finfo = &slwt->flv_info;
> __u32 fops = finfo->flv_ops;
> + int ret;
> +
> + if (!fops)
> + return input_action_end_x_core(skb, slwt);
>
> /* 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);
>
> - return input_action_end_x_core(skb, slwt);
> + ret = end_flv8986_core(skb, slwt);
> + if (ret)
> + return ret;
> + return input_action_end_x_finish(skb, slwt);
> }
>
The problem is the combination with NEXT-C-SID: the NEXT-C-SID early
return above is still taken, and neither branch of
end_x_next_csid_core() applies PSP. So "End.X flavors next-csid,psp"
becomes configurable and PSP is never applied.
The same mask and the same early return are already in End, where the
combination is accepted and PSP is not applied either. I will send a
fix for that to net.
For this patch I would handle the combination.
On the selftest side, the combination of next-csid and psp is not
covered yet. I am going to add coverage for it in any case with the
End fix, and I would be glad to do it with you if you are interested:
the same coverage would serve End.X too, if you decide to handle the
combination there.
Thanks,
Andrea
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH net-next 2/5] seg6: add RFC8986 flavor support for End.X
2026-09-23 16:05 ` Andrea Mayer
@ 2026-09-24 10:55 ` Hangbin Liu
0 siblings, 0 replies; 14+ messages in thread
From: Hangbin Liu @ 2026-09-24 10:55 UTC (permalink / raw)
To: Andrea Mayer
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Shuah Khan, netdev, linux-kernel, linux-kselftest,
Hangbin Liu, stefano.salsano
Hi Andrea,
On Wed, Sep 23, 2026 at 06:05:06PM +0200, Andrea Mayer wrote:
> > 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 {
> >
> > #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)
> >
>
> This adds PSP to a mask that already had NEXT-C-SID. PSP alone then
> works through end_flv8986_core().
>
> > struct seg6_flavors_info {
> > /* Flavor operations */
> > @@ -841,12 +842,19 @@ static int input_action_end_x(struct sk_buff *skb, struct seg6_local_lwt *slwt)
> > {
> > const struct seg6_flavors_info *finfo = &slwt->flv_info;
> > __u32 fops = finfo->flv_ops;
> > + int ret;
> > +
> > + if (!fops)
> > + return input_action_end_x_core(skb, slwt);
> >
> > /* 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);
> >
> > - return input_action_end_x_core(skb, slwt);
> > + ret = end_flv8986_core(skb, slwt);
> > + if (ret)
> > + return ret;
> > + return input_action_end_x_finish(skb, slwt);
> > }
> >
>
> The problem is the combination with NEXT-C-SID: the NEXT-C-SID early
> return above is still taken, and neither branch of
> end_x_next_csid_core() applies PSP. So "End.X flavors next-csid,psp"
> becomes configurable and PSP is never applied.
Ah, right. The NEXT-C-SID could combine with other flavors.
>
> The same mask and the same early return are already in End, where the
> combination is accepted and PSP is not applied either. I will send a
> fix for that to net.
OK
>
> For this patch I would handle the combination.
Thanks
>
> On the selftest side, the combination of next-csid and psp is not
> covered yet. I am going to add coverage for it in any case with the
> End fix, and I would be glad to do it with you if you are interested:
> the same coverage would serve End.X too, if you decide to handle the
> combination there.
Yes, I will add support for the End.X combination (and End.T in follow-up
patch) once you add the next-csid/psp selftest.
Thanks
Hangbin
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH net-next 2/5] seg6: add RFC8986 flavor support for End.X
2026-09-22 8:54 ` [PATCH net-next 2/5] seg6: add RFC8986 flavor support for End.X Hangbin Liu
2026-09-23 16:05 ` Andrea Mayer
@ 2026-09-24 11:57 ` netdev-bot+sashiko
1 sibling, 0 replies; 14+ messages in thread
From: netdev-bot+sashiko @ 2026-09-24 11:57 UTC (permalink / raw)
To: hangbin.liu
Cc: andrea.mayer, davem, edumazet, kuba, pabeni, horms, shuah,
netdev, linux-kernel, linux-kselftest, liuhangbin
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] net/ipv6/seg6_local.c: the patch widens
SEG6_LOCAL_END_X_FLV_SUPP_OPS to (SEG6_F_LOCAL_FLV_NEXT_CSID |…
- [Low] net/ipv6/seg6_local.c:759-761 — the kerneldoc-style comment on
end_flv8986_core() still says the helper processes the packet "on the…
--
seg6: add RFC8986 flavor support for End.X
This adds PSP processing to the SRv6 End.X behavior by reusing
end_flv8986_core(), and widens SEG6_LOCAL_END_X_FLV_SUPP_OPS so End.X
advertises PSP flavor support alongside NEXT-C-SID.
> diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c
> index 584e6aca38930..7462da1da3629 100644
> --- a/net/ipv6/seg6_local.c
> +++ b/net/ipv6/seg6_local.c
> @@ -121,7 +121,8 @@ struct bpf_lwt_prog {
>
> #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)
[Severity: Medium]
With this mask widened, does parse_nla_flavors() now accept the
combination next-csid plus psp for an End.X instance?
parse_nla_flavors() only rejects bits outside the per-action mask:
rc = seg6_flv_supp_ops_by_action(action, &supp_fops);
if (rc < 0 || (fops & ~supp_fops)) {
NL_SET_ERR_MSG(extack, "Unsupported Flavor operation(s)");
return -EOPNOTSUPP;
}
finfo->flv_ops = fops;
and seg6_flv_supp_ops_by_action() returns SEG6_LOCAL_END_X_FLV_SUPP_OPS for
SEG6_LOCAL_ACTION_END_X, so "ip route ... action End.X nh6 <addr> oif <dev>
flavors next-csid,psp" would be installed, and put_nla_flavors() echoes the
stored mask including PSP back to user space.
Is PSP actually executed in that configuration? In the new
input_action_end_x() below, the NEXT-C-SID test returns before
end_flv8986_core() is reached, and the arg-zero sub-case of
end_x_next_csid_core() goes to input_action_end_x_core():
if (seg6_next_csid_is_arg_zero(daddr, finfo))
return input_action_end_x_core(skb, slwt);
input_action_end_x_core() only does advance_nextseg() and then
input_action_end_x_finish(), so seg6_pop_srh() is never called and the SRH
stays on the packet even though PSP was accepted and is reported as
configured. The comment above seg6_flv_supp_ops_by_action() states that
unsupported combinations make the kernel refuse to instantiate the tunnel.
Would it be better to reject next-csid together with psp for End.X in
parse_nla_flavors(), or to route the NEXT-C-SID arg-exhausted path into
end_flv8986_core()?
For reference, the same shape already exists for the End action via
SEG6_LOCAL_END_FLV_SUPP_OPS and input_action_end()/end_next_csid_core(),
but for End.X the combination only becomes configurable with this change.
At the end of the series the mask and input_action_end_x() are unchanged,
and the added selftest only installs psp on its own, so the combination
stays accepted but unimplemented.
>
> struct seg6_flavors_info {
> /* Flavor operations */
> @@ -841,12 +842,19 @@ static int input_action_end_x(struct sk_buff *skb, struct seg6_local_lwt *slwt)
> {
> const struct seg6_flavors_info *finfo = &slwt->flv_info;
> __u32 fops = finfo->flv_ops;
> + int ret;
> +
> + if (!fops)
> + return input_action_end_x_core(skb, slwt);
>
> /* 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);
>
> - return input_action_end_x_core(skb, slwt);
> + ret = end_flv8986_core(skb, slwt);
> + if (ret)
> + return ret;
> + return input_action_end_x_finish(skb, slwt);
> }
[Severity: Low]
This isn't a bug, but the comment above end_flv8986_core() still reads:
/* process the packet on the basis of the RFC8986 flavors set for the given
* SRv6 End behavior instance.
*/
With this new call site the helper also serves End.X, whose post-processing
differs (input_action_end_x_finish() forwards to slwt->nh6/slwt->oif rather
than doing a DA-based lookup). Could the comment say "End* behavior", which
is the wording already used above seg6_flv_supp_ops_by_action() and in the
SEG6_F_LOCAL_FLAVORS comment?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260922-srv6_flavors_endx-v1-0-4d01c05c47b7%40kylinos.cn
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH net-next 3/5] selftests: seg6: move SRv6 End PSP setup into its own helper
2026-09-22 8:54 [PATCH net-next 0/5] seg6: add End.X PSP flavor support and selftests Hangbin Liu
2026-09-22 8:54 ` [PATCH net-next 1/5] seg6: split final End process out of flavor processing Hangbin Liu
2026-09-22 8:54 ` [PATCH net-next 2/5] seg6: add RFC8986 flavor support for End.X Hangbin Liu
@ 2026-09-22 8:54 ` Hangbin Liu
2026-09-24 11:57 ` netdev-bot+sashiko
2026-09-22 8:54 ` [PATCH net-next 4/5] selftest: seg6: add explicit cleanup for SRv6 End PSP test Hangbin Liu
2026-09-22 8:54 ` [PATCH net-next 5/5] selftests: seg6: add End.X PSP selftest Hangbin Liu
4 siblings, 1 reply; 14+ messages in thread
From: Hangbin Liu @ 2026-09-22 8:54 UTC (permalink / raw)
To: Andrea Mayer, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Shuah Khan
Cc: Hangbin Liu, netdev, linux-kernel, linux-kselftest, Hangbin Liu
From: Hangbin Liu <liuhangbin@kylinos.cn>
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 <liuhangbin@kylinos.cn>
---
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/testing/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"
+ # testing environment was set up successfully
+ SETUP_ERR=0
+}
+
+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=1)
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=0
}
check_rt_connectivity()
@@ -758,7 +761,13 @@ host2gateway_tests()
host_srv6_end_flv_psp_tests()
{
- log_section "SRv6 connectivity test hosts (h1 <-> h2, PSP flavor)"
+ set -e
+ SETUP_ERR=1
+ setup_end_flv_psp
+ SETUP_ERR=0
+ set +e
+
+ log_section "SRv6 connectivity test hosts (h1 <-> h2, End flavor PSP)"
check_and_log_hs_connectivity 1 2
check_and_log_hs_connectivity 2 1
--
2.55.0
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH net-next 3/5] selftests: seg6: move SRv6 End PSP setup into its own helper
2026-09-22 8:54 ` [PATCH net-next 3/5] selftests: seg6: move SRv6 End PSP setup into its own helper Hangbin Liu
@ 2026-09-24 11:57 ` netdev-bot+sashiko
0 siblings, 0 replies; 14+ messages in thread
From: netdev-bot+sashiko @ 2026-09-24 11:57 UTC (permalink / raw)
To: hangbin.liu
Cc: andrea.mayer, davem, edumazet, kuba, pabeni, horms, shuah,
netdev, linux-kernel, linux-kselftest, liuhangbin
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] Mid-run re-arming of the SETUP_ERR latch converts already-
recorded test FAILures into an overall SKIP.
- [Low] setup_end_flv_psp()
(tools/testing/selftests/net/srv6_end_flavors_test.sh:651-670) is…
--
selftests: seg6: move SRv6 End PSP setup into its own helper
This moves the End PSP policy installation out of setup() into a new
setup_end_flv_psp() helper, and calls that helper from
host_srv6_end_flv_psp_tests() with errexit enabled around it. The intent
is to decouple the base topology setup from the flavor-specific test case.
> diff --git a/tools/testing/selftests/net/srv6_end_flavors_test.sh b/tools/testing/selftests/net/srv6_end_flavors_test.sh
> index 318487eda671b..56a1c5f865a77 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"
>
> + # testing environment was set up successfully
> + SETUP_ERR=0
> +}
> +
> +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.
[ ... ]
> # - rt-1 (SRv6 End flavor PSP with SL=1)
> 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=0
> }
[Severity: Low]
The commit message says the split lets "each PSP test case can setup and
later cleanup independently", but this commit only adds the setup half.
setup_end_flv_psp() installs the localsid seg6local routes, the cafe::<dst>
H.Insert route and the proxy NDP entries through __setup_rt_policy(), and
nothing releases them except the global EXIT trap cleanup(), which just
does:
for i in ${ROUTERS}; do
nsname="$(get_rtname "${i}")"
ip netns del "${nsname}" &>/dev/null || true
done
Would it make sense to mention in the commit message that the matching
cleanup_end_flv_psp() arrives in the following patch ("selftest: seg6: add
explicit cleanup for SRv6 End PSP test")? As it stands the description
promises a teardown path that does not exist yet at this commit. There is no
functional problem here, since the two PSP policies are the only flavor
state installed and netns deletion reclaims everything.
>
> check_rt_connectivity()
> @@ -758,7 +761,13 @@ host2gateway_tests()
>
> host_srv6_end_flv_psp_tests()
> {
> - log_section "SRv6 connectivity test hosts (h1 <-> h2, PSP flavor)"
> + set -e
> + SETUP_ERR=1
> + setup_end_flv_psp
> + SETUP_ERR=0
> + set +e
[Severity: Low]
Can re-arming SETUP_ERR here turn already-recorded failures into a skip?
By the time host_srv6_end_flv_psp_tests() runs, router_tests() and
host2gateway_tests() have already executed and may have set ret=1 and
incremented nfail:
setup
set +e
router_tests
host2gateway_tests
host_srv6_end_flv_psp_tests
print_log_test_results
If any ip command inside setup_end_flv_psp() fails, for example the
"encap seg6local action End flavors psp" route add, errexit aborts the
script while SETUP_ERR is still 1, and the EXIT trap takes this path in
cleanup():
if [ "${SETUP_ERR}" -ne 0 ]; then
echo "SKIP: Setting up the testing environment failed"
exit "${ksft_skip}"
fi
exit "${ret}"
so the script exits 4 (skip) instead of reaching exit ${ret} with ret=1, and
print_log_test_results is never reached, meaning the tests passed/failed
summary is lost too.
The final patch of this series ("selftests: seg6: add End.X PSP selftest")
changes the guard to also require [ "$ret" -ne "$ksft_fail" ], which removes
the fail-to-skip masking. Could that guard change be moved earlier in the
series, so the intermediate commits do not carry the masking behaviour?
> +
> + log_section "SRv6 connectivity test hosts (h1 <-> h2, End flavor PSP)"
>
> check_and_log_hs_connectivity 1 2
> check_and_log_hs_connectivity 2 1
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260922-srv6_flavors_endx-v1-0-4d01c05c47b7%40kylinos.cn
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH net-next 4/5] selftest: seg6: add explicit cleanup for SRv6 End PSP test
2026-09-22 8:54 [PATCH net-next 0/5] seg6: add End.X PSP flavor support and selftests Hangbin Liu
` (2 preceding siblings ...)
2026-09-22 8:54 ` [PATCH net-next 3/5] selftests: seg6: move SRv6 End PSP setup into its own helper Hangbin Liu
@ 2026-09-22 8:54 ` Hangbin Liu
2026-09-24 11:57 ` netdev-bot+sashiko
2026-09-22 8:54 ` [PATCH net-next 5/5] selftests: seg6: add End.X PSP selftest Hangbin Liu
4 siblings, 1 reply; 14+ messages in thread
From: Hangbin Liu @ 2026-09-22 8:54 UTC (permalink / raw)
To: Andrea Mayer, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Shuah Khan
Cc: Hangbin Liu, netdev, linux-kernel, linux-kselftest, Hangbin Liu
From: Hangbin Liu <liuhangbin@kylinos.cn>
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 <liuhangbin@kylinos.cn>
---
.../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/testing/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}"
}
# see __setup_rt_policy
@@ -576,6 +572,56 @@ setup_rt_policy_ipv6()
__setup_rt_policy "$1" "$2" "$3"
}
+cleanup_rt_policy_ipv6()
+{
+ local dst="$1"
+ local encap_rt="$2"
+ local policy_rts="$3"
+ local in_nsname
+ local rt_nsname
+ local function
+ local fullsid
+ local op_type
+ local node
+ local n
+
+ in_nsname="$(get_rtname "${encap_rt}")"
+
+ for n in ${policy_rts}; do
+ node="$(__get_srv6_rtcfg_id "${n}")"
+ op_type="$(__get_srv6_rtcfg_op "${n}")"
+ rt_nsname="$(get_rtname "${node}")"
+
+ case "${op_type}" in
+ "noflv")
+ function="${END_FUNC}"
+ ;;
+
+ "psp")
+ function="${END_PSP_FUNC}"
+ ;;
+
+ *)
+ break
+ ;;
+ esac
+
+ fullsid="${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="$1"
@@ -645,6 +691,14 @@ setup()
setup_rt_local_sids 3 "1 2 4"
setup_rt_local_sids 4 "1 2 3"
+ # 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=0
}
@@ -669,6 +723,12 @@ setup_end_flv_psp()
setup_rt_policy_ipv6 1 2 "1:psp"
}
+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="$1"
@@ -771,6 +831,8 @@ host_srv6_end_flv_psp_tests()
check_and_log_hs_connectivity 1 2
check_and_log_hs_connectivity 2 1
+
+ cleanup_end_flv_psp
}
test_iproute2_supp_or_ksft_skip()
--
2.55.0
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH net-next 4/5] selftest: seg6: add explicit cleanup for SRv6 End PSP test
2026-09-22 8:54 ` [PATCH net-next 4/5] selftest: seg6: add explicit cleanup for SRv6 End PSP test Hangbin Liu
@ 2026-09-24 11:57 ` netdev-bot+sashiko
0 siblings, 0 replies; 14+ messages in thread
From: netdev-bot+sashiko @ 2026-09-24 11:57 UTC (permalink / raw)
To: hangbin.liu
Cc: andrea.mayer, davem, edumazet, kuba, pabeni, horms, shuah,
netdev, linux-kernel, linux-kselftest, liuhangbin
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] Asymmetric teardown: `cleanup_rt_policy_ipv6()` deletes
localsid routes it never created.
--
selftest: seg6: add explicit cleanup for SRv6 End PSP test
This adds cleanup_rt_policy_ipv6() and cleanup_end_flv_psp(), called at the
end of host_srv6_end_flv_psp_tests(), to tear down the policy and localsid
state installed for the PSP test. It also moves the host neighbour proxy
entries from __setup_rt_policy() into the common setup().
> diff --git a/tools/testing/selftests/net/srv6_end_flavors_test.sh b/tools/testing/selftests/net/srv6_end_flavors_test.sh
> index 56a1c5f865a77..52731983b4cc9 100755
> --- a/tools/testing/selftests/net/srv6_end_flavors_test.sh
> +++ b/tools/testing/selftests/net/srv6_end_flavors_test.sh
[ ... ]
> @@ -576,6 +572,56 @@ setup_rt_policy_ipv6()
> __setup_rt_policy "$1" "$2" "$3"
> }
>
> +cleanup_rt_policy_ipv6()
> +{
[ ... ]
> + for n in ${policy_rts}; do
> + node="$(__get_srv6_rtcfg_id "${n}")"
> + op_type="$(__get_srv6_rtcfg_op "${n}")"
> + rt_nsname="$(get_rtname "${node}")"
> +
> + case "${op_type}" in
> + "noflv")
> + function="${END_FUNC}"
> + ;;
[Severity: Medium]
Does the "noflv" case here delete a SID that the policy helper never
created?
On the add side, __setup_rt_policy() only installs the SID if it is not
already present:
fullsid="${LOCATOR_SERVICE}:${node}::${function}"
# add SRv6 Endpoint behavior to the selected router
if ! ip -netns "${rt_nsname}" -6 route get "${fullsid}" \
&>/dev/null; then
ip -netns "${rt_nsname}" -6 route \
add "${fullsid}" \
...
For "noflv" that guard is always taken, because setup_rt_local_sids()
already installed fcff:<rt>::${END_FUNC} for every router during the
common setup():
# Local End behavior (note that "dev" is a dummy interface chosen for
# the sake of simplicity).
ip -netns "${nsname}" -6 route \
add "${LOCATOR_SERVICE}:${rt}::${END_FUNC}" \
table "${LOCALSID_TABLE_ID}" \
encap seg6local action End dev "${DUMMY_DEVNAME}"
> +
> + fullsid="${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
Since the delete is gated on the route existing rather than on whether
this helper created it, the condition succeeds precisely for the
setup()-owned End SID, and it is removed.
[ ... ]
> @@ -669,6 +723,12 @@ setup_end_flv_psp()
> setup_rt_policy_ipv6 1 2 "1:psp"
> }
>
> +cleanup_end_flv_psp()
> +{
> + cleanup_rt_policy_ipv6 2 1 "3:noflv 4:psp 2:psp"
> + cleanup_rt_policy_ipv6 1 2 "1:psp"
> +}
> +
With the "3:noflv" entry above, every normal run ends with
fcff:3::${END_FUNC} deleted from rt-3's localsid table, so the
environment no longer matches what setup() built. After the deletion a
lookup of fcff:3::000e in rt-3 falls through the
to fcff::/16 lookup localsid
rule down to the "unreachable default" route that setup_rt_local_sids()
installed. Should the teardown mirror the guarded add and only remove
the flavor SIDs plus the encap route it actually created?
This matters for exactly the case the commit message mentions, "when
later tests are added to the same script": a later test that depends on
the default End SIDs would fail or take a different path unless it
happens to call __setup_rt_policy() with a noflv entry, which silently
re-creates the SID. In this series the End.X PSP test added later does
re-add fcff:3::000e via setup_endx_flv_psp(), so the asymmetry is
currently masked and the behaviour becomes order dependent. The
cleanup_rt_policy_ipv6() and cleanup_end_flv_psp() helpers are unchanged
at the end of the series, still passing "3:noflv".
The commit message describes the change as tearing down flavor-specific
state the PSP test installed:
"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."
Could it also mention that shared state created by setup() is removed?
> check_rt_connectivity()
> {
> local rtsrc="$1"
> @@ -771,6 +831,8 @@ host_srv6_end_flv_psp_tests()
>
> check_and_log_hs_connectivity 1 2
> check_and_log_hs_connectivity 2 1
> +
> + cleanup_end_flv_psp
> }
One more question on the call site: host_srv6_end_flv_psp_tests() runs
after "set +e", so a failing or over-reaching "ip route del" in
cleanup_end_flv_psp() produces no test failure. Would it be worth
checking the return values here so teardown errors are visible?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260922-srv6_flavors_endx-v1-0-4d01c05c47b7%40kylinos.cn
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH net-next 5/5] selftests: seg6: add End.X PSP selftest
2026-09-22 8:54 [PATCH net-next 0/5] seg6: add End.X PSP flavor support and selftests Hangbin Liu
` (3 preceding siblings ...)
2026-09-22 8:54 ` [PATCH net-next 4/5] selftest: seg6: add explicit cleanup for SRv6 End PSP test Hangbin Liu
@ 2026-09-22 8:54 ` Hangbin Liu
2026-09-23 1:48 ` Hangbin Liu
4 siblings, 1 reply; 14+ messages in thread
From: Hangbin Liu @ 2026-09-22 8:54 UTC (permalink / raw)
To: Andrea Mayer, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Shuah Khan
Cc: Hangbin Liu, netdev, linux-kernel, linux-kselftest, Hangbin Liu
From: Hangbin Liu <liuhangbin@kylinos.cn>
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 <liuhangbin@kylinos.cn>
---
.../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/testing/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=cafe::1 is sent
# to the destination, i.e. hs-1.
-# Kselftest framework requirement - SKIP code is 4.
-readonly ksft_skip=4
+# shellcheck source=lib.sh
+source lib.sh
readonly RDMSUFF="$(mktemp -u XXXXXXXX)"
readonly DUMMY_DEVNAME="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'
}
+# Given the description of a router <id:op:act> as an input, the function
+# returns the <act> 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="$1"
+ local net_prefix
+ local acts
+ local out
+
+ acts="$(echo "${element}" | cut -d':' -f3)"
+ act="$(echo "${acts}" | cut -d',' -f1)"
+ act="${act:-"End"}"
+
+ rt="$(echo "${acts}" | cut -d',' -f2)"
+ neigh="$(echo "${acts}" | cut -d',' -f3)"
+
+ if [ "$act" == "End" ]; then
+ echo "End"
+ elif [ "$act" == "End.X" ]; then
+ net_prefix="$(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
@@ -522,19 +553,20 @@ __setup_rt_policy()
for n in ${policy_rts}; do
node="$(__get_srv6_rtcfg_id "${n}")"
op_type="$(__get_srv6_rtcfg_op "${n}")"
+ action="$(__get_srv6_rtcfg_act "${n}")"
rt_nsname="$(get_rtname "${node}")"
case "${op_type}" in
"noflv")
policy="${policy}${LOCATOR_SERVICE}:${node}::${END_FUNC},"
function="${END_FUNC}"
- behavior_cfg="End"
+ behavior_cfg="${action}"
;;
"psp")
policy="${policy}${LOCATOR_SERVICE}:${node}::${END_PSP_FUNC},"
function="${END_PSP_FUNC}"
- behavior_cfg="End flavors psp"
+ behavior_cfg="${action} flavors psp"
;;
*)
@@ -729,6 +761,30 @@ cleanup_end_flv_psp()
cleanup_rt_policy_ipv6 1 2 "1:psp"
}
+setup_endx_flv_psp()
+{
+ # Direction hs-1 -> hs-2 (End.X PSP flavor)
+ # SID List=fcff: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=1)
+ # - rt-2 (Route to hs-2 via nh and oif)
+ #
+ # Direction hs-2 -> hs-1 (End.X PSP flavor)
+ # SID List=fcff:3::ef1,cafe::1
+ # - rt-2 (SRv6 H.Insert policy)
+ # - rt-3 (SRv6 End.X flavor PSP with SL=1)
+ # - 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="$1"
@@ -835,6 +891,22 @@ host_srv6_end_flv_psp_tests()
cleanup_end_flv_psp
}
+host_srv6_endx_flv_psp_tests()
+{
+ set -e
+ SETUP_ERR=1
+ setup_endx_flv_psp
+ SETUP_ERR=0
+ 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="$1"
@@ -936,5 +1008,6 @@ set +e
router_tests
host2gateway_tests
host_srv6_end_flv_psp_tests
+host_srv6_endx_flv_psp_tests
print_log_test_results
--
2.55.0
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH net-next 5/5] selftests: seg6: add End.X PSP selftest
2026-09-22 8:54 ` [PATCH net-next 5/5] selftests: seg6: add End.X PSP selftest Hangbin Liu
@ 2026-09-23 1:48 ` Hangbin Liu
0 siblings, 0 replies; 14+ messages in thread
From: Hangbin Liu @ 2026-09-23 1:48 UTC (permalink / raw)
To: Andrea Mayer, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Shuah Khan
Cc: netdev, linux-kernel, linux-kselftest, Hangbin Liu
On Tue, Sep 22, 2026 at 04:54:47PM +0800, Hangbin Liu wrote:
> From: Hangbin Liu <liuhangbin@kylinos.cn>
>
> 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 <liuhangbin@kylinos.cn>
> ---
> .../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/testing/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
[...]
>
> +setup_endx_flv_psp()
> +{
> + # Direction hs-1 -> hs-2 (End.X PSP flavor)
> + # SID List=fcff: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=1)
> + # - rt-2 (Route to hs-2 via nh and oif)
Oh, just noticed that I made a mistake comment. It should be
# - rt-4 (SRv6 End.X flavor PSP with SL=1, route to rt-2 via nh and oif)
# - rt-2 (Route to hs-2 with same subnet)
> + #
> + # Direction hs-2 -> hs-1 (End.X PSP flavor)
> + # SID List=fcff:3::ef1,cafe::1
> + # - rt-2 (SRv6 H.Insert policy)
> + # - rt-3 (SRv6 End.X flavor PSP with SL=1)
> + # - rt-1 (Route to hs-1 via nh and oif)
Same here.
> + 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"
Thanks
Hangbin
^ permalink raw reply [flat|nested] 14+ messages in thread