From: Hangbin Liu <[email protected]>

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 <[email protected]>
---

For Sashiko:

With the SEG6_LOCAL_END_X_FLV_SUPP_OPS mask widened, parse_nla_flavors()
now accept the combination next-csid plus psp for an End.X instance. And
the current code is unable to handle this combination. The End instance
also has this issue. Andrea is preparing a fix for this bug.
---
 net/ipv6/seg6_local.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c
index 4fcfcd48cfae..521a9b0c0929 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 */
@@ -824,7 +825,7 @@ static bool seg6_pop_srh(struct sk_buff *skb, int srhoff)
 }
 
 /* process the packet on the basis of the RFC8986 flavors set for the given
- * SRv6 End behavior instance.
+ * SRv6 End, End.X behavior instance.
  *
  * Returns with skb freed on failure. On success, the caller must complete
  * final processing and forward the packet.
@@ -923,12 +924,20 @@ 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


Reply via email to