[PATCH net-next v2 1/5] seg6: split final End process out of flavor processing

From: Hangbin Liu

Date: Fri Oct 09 2026 - 05:59:27 EST


From: Hangbin Liu <liuhangbin@xxxxxxxxxx>

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@xxxxxxxxxx>
---
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 0c3d1be7f129..4fcfcd48cfae 100644
--- a/net/ipv6/seg6_local.c
+++ b/net/ipv6/seg6_local.c
@@ -825,6 +825,9 @@ 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.
+ *
+ * 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)
{
@@ -882,7 +885,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);
@@ -894,6 +897,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);
@@ -907,7 +911,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.55.0