🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #22911

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

#22911
From: Hangbin Liu
Date: Thu, 26 Nov 2026 06:27
70 lines
10326 bytes
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
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 <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 cd93b72a0b22..fc651a83e4b7 100644
--- a/net/ipv6/seg6_local.c
+++ b/net/ipv6/seg6_local.c
@@ -940,6 +940,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)
 {
@@ -1000,7 +1003,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);
@@ -1012,6 +1015,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);
@@ -1025,7 +1029,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
Technical Details
Message-ID: <20261126-srv6_flavors_endx-v5-1-4d8232eec404@kylinos.cn>
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371890-linux-kernel-netdev=dewy.ru
References: <20261126-srv6_flavors_endx-v5-0-4d8232eec404@kylinos.cn>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371890-linux-kernel-netdev=dewy.ru
From: hangbin.liu@linux.dev (Hangbin Liu)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v5 1/5] seg6: split final End process out of
 flavor processing
Date: Thu, 26 Nov 2026 14:27:23 +0800
Organization: Usenet Network
Message-ID: <20261126-srv6_flavors_endx-v5-1-4d8232eec404@kylinos.cn>
References: <20261126-srv6_flavors_endx-v5-0-4d8232eec404@kylinos.cn>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="398242"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:MZvudcSKZndidfbXumhGyvedRqM= sha256:aMPsABhu5wDXfsndPgzLmzZ4C66jn8zF/f6V64efNw8=
	sha1:mrvqKWPMOXY6xdulsMwCphrmx0A= sha256:4/P+MmcdYJnZceN1HJCKiWFpgqzNtHnYovjrxw9vI4Y=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id B33AA125EB0; Thu, 26 Nov 2026 09:28:24 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.051
X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
	header.d=linux.dev
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id mVgWVrt-HBsm;
	Thu, 26 Nov 2026 09:28:20 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-371890-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.dev
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 04178125EB1; Thu, 26 Nov 2026 09:28:06 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id 1A5F22BFBF; Thu, 26 Nov 2026 06:28:04 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795674480;
	b=ISIBRLWM90h4y6JAgIRo2bEKoy3y2jj2SelDPuIGtGpM1fre3/Y0DNl4eS0gQfJbTCMU
	 FKcGqLneGL0MaivoAqKCrlb3yOpGgBEatuDkQbecOgKQOfl2imq6K5bGhL/Wi133XtLlj
	 ksQ7jwrCS4D7t/U1Nh2O8YzBAfJqEbSEZmiWUa+WyFY23w2F4vcFgNihtVwi8rNZQPyR+
	 H8yXgkU1ZgwTWGawdg+idnz3WO/7mWQwweDlSdlPbRxDOv1RRioAAZqHPjq3dW5wKJTO2
	 JOQErAOdkAn09YuXGgiYZ5EKNCC9JdZRy4BKyIzSIivy3PF0nQ2vLc3cDM7WC5uifRA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795674480;
	h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature:
	 X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow:From:Date:
	 Subject:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type:
	 Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc:
	 X-Mailer;
	bh=LH9JzrmW4RjzXu1Kko7F3YJmREJ7Gsj9omJECIoSc3k=;
	b=Sck/icHBn3DtDByTJGy+BfuXnf676sPndIr3kzNX3YCvBBhwa76MciBEiWMO1HYlKPnC
	 uKSNvDz85FxgCw73Txt+LL1BM7pZgIgU09Acay+7aatPEACrd4f39ifPm12Vbl4Ksvlz+
	 XmnTzmd1JguNVKJtxx7bq5TgDX2IRqgh+Lt8KAQ1v7qkQjIzk1dpsGY/x54EIK9HeecXP
	 IaTbwSfkNu5viVDl1R1gG8StZxSdCX1jGSD3myb9TBhHTVWuiS47JeITHCVxNTYXjtcBd
	 XMLmap2V+6uMtO/c0nWNtU6ZP3jlR1YrYHDUjoubNioc5oBA/GVbQK52UIulvVH6VKg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dmarc=pass header.from=linux.dev;
	spf=pass smtp.mailfrom=linux.dev;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id EC841606A336;
	Thu, 26 Nov 2026 06:27:54 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.25
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795674469;
	b=eVaSlIS8Ns5jzsFOUwzXAQQyOgwg847EtfALAAOwqraFQ2R3+IXtuHtJ9TdrSdEA4xHE
	 YXlLennKMb3fnXpaxo59QAwiCZVBlnBxNZTAd8q4WrRZd+uDUqeAEN29PgcyCGpD5A8fv
	 ZcJeDHldxOUEgmUHj/DsXBiSiw/L6zTsztboz0F3vL8v0AcMsN0dk+uVBwoclAJUcZpTS
	 HClYXME/oUTby9SgGSO0HtrSDUu8OouvAnQlzU9hoXG26EKsluBtADqeZQlMBOURlhreC
	 WdYz1wdZfITpZqFvcaOT9UrUhbNQqeEdKWCkgiUohlODIrcXhZuJSL4i5pQT6k6SnZg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795674469;
	h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received:
	 X-Mizu-Trace-ID:X-Migadu-Flow:From:Date:Subject:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:Message-Id:References:
	 In-Reply-To:To:Cc:X-Mailer;
	bh=LH9JzrmW4RjzXu1Kko7F3YJmREJ7Gsj9omJECIoSc3k=;
	b=PEWFLjw+hsZLpPoAIHbFPM7syEW9l7vPze/gmeWwuWL9CG4I+rA7ecxtY4qrQp7Jj2A+
	 ZkF72oBqfU6U9clHPkdltjkiYHxr06EuDdJhKXVe0exoBT8fLlYq3DMyw7VZL463EctqM
	 Dbb7Mjug4kkxKxyU7DQOItJVsL9frgnhmtScNEhWaDRGPTQqwtMH/UAM6Z2qW57Tkl4DC
	 wHBdD4JYlN6hTbmpXRL5dK1lZyPDDdxznkTsXLwz/dkIsmcZWA8ZtR+aUquX1DNiZjw4f
	 DoU5GzSyOWKa8Ncysf68JWeCdQ5CVSuZ8lqIFmgeKhm2BJ1zvzfnkxpoG+bRiV/sjig==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=linux.dev;
	spf=pass smtp.mailfrom=linux.dev;
	dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=ZMZw1ZTr;
	arc=none smtp.remote-ip=91.218.175.25
X-Received: from mta0.migadu.com (out-25.mta0.migadu.com [91.218.175.25])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7228A606A323
	for <netdev@vger.kernel.org>; Thu, 26 Nov 2026 06:27:48 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7228A606A323
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev
X-Envelope-To: netdev@vger.kernel.org
X-DKIM-Signature: a=rsa-sha256; bh=Y6LYYqQ95aOcNmPkhXlhNVYcp9TvyJk5v12vFfQtoeQ=;
 c=simple/simple; d=linux.dev;
 h=from:to:subject:date:message-id:mime-version:content-type; s=key1;
 t=1795674466; v=1; x=1796279266;
 b=ZMZw1ZTrh1shKPEjr3PEQfzUjj8JFPQqW+6wK9QOMjdpAisubk1VBpNLZkvh5L+9br1q+BOL
 R+vRDiYQiArqEsZskrCNELZizKK6lPsNak6ENRhiBYGWRmtwPsrvxe2eMRX4+Q/feIWMt1AQD8q
 dycbQJJBWnmwfKzJcIK9VZ5g=
X-Envelope-To: netdev@vger.kernel.org
X-Received: by mta12.migadu.com with ESMTPS id 0758fd16dc76def4;
	Thu, 26 Nov 2026 06:27:46 +0000
X-Mizu-Trace-ID: 0758fd16dc76def4
X-Migadu-Flow: FLOW_OUT
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261126-srv6_flavors_endx-v5-0-4d8232eec404@kylinos.cn>
X-Cc: Hangbin Liu <hangbin.liu@linux.dev>, netdev@vger.kernel.org, 
 linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, 
 Hangbin Liu <hangbin.liu@linux.dev>
X-Mailer: b4 0.16.0