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 unable 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 | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c index f71e47b5e764..65d552f87fa3 100644 --- a/net/ipv6/seg6_local.c +++ b/net/ipv6/seg6_local.c @@ -885,6 +885,9 @@ static struct ipv6_sr_hdr *seg6_flv8986_get_srh(struct sk_buff *skb) /* process the packet on the basis of the RFC8986 flavors set for the given * SRv6 End behavior instance. + * + * Returns with skb freed on failure. On success, the caller must complete + * final processing and forward the packet. */ static int end_flv8986_core(struct sk_buff *skb, struct seg6_local_lwt *slwt) { @@ -945,7 +948,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_reason(skb, reason); @@ -957,6 +960,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); @@ -970,7 +974,11 @@ 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.56.0