🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #10009

Re: [PATCH net 2/6] seg6: update skb checksum when ipv6_srh_rcv() decrements the Hop Limit

#10009
From: Hangbin Liu
Date: Tue, 03 Nov 2026 01:27
60 lines
11054 bytes
On Sat, Oct 31, 2026 at 11:50:29PM +0100, Andrea Mayer wrote:
> When the next segment is a local address, ipv6_srh_rcv() processes it
> directly and also decrements the Hop Limit. With CHECKSUM_COMPLETE,
> skb->csum is not updated for this change. If the packet is then delivered
> on the same node and skb->csum was computed in software, for instance by
> conntrack, UDP can drop the packet as a checksum error. With skb->csum
> computed by the device, TCP can instead log a "hw csum failure", as if the
> device had computed a wrong skb->csum.
> 
> Update skb->csum for the Hop Limit decrement with update_csum_diff4().
> 
> Depends on patch "seg6: fix skb checksum update helpers".
> 
> Found by manual code inspection, and reproduced in a VM without kernel
> changes or error injection. A following commit adds a selftest that
> reproduces the problem with a tc ct action. With this patch, the selftest
> passes for the path with local SRH segments. Also tested against the srv6
> selftests, and with a ConnectX-6 Lx NIC (mlx5) that provides
> CHECKSUM_COMPLETE.
> 
> Fixes: 1ababeba4a21 ("ipv6: implement dataplane support for rthdr type 4 (Segment Routing Header)")
> Signed-off-by: Andrea Mayer <andrea.mayer@uniroma2.it>
> ---
>  net/ipv6/exthdrs.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
> index 96c8402a27a5..9d3ba310065a 100644
> --- a/net/ipv6/exthdrs.c
> +++ b/net/ipv6/exthdrs.c
> @@ -460,6 +460,10 @@ static int ipv6_srh_rcv(struct sk_buff *skb, struct inet6_dev *idev)
>  	}
>  
>  	if (skb_dst_dev(skb)->flags & IFF_LOOPBACK) {
> +		/* payload_len, nexthdr and hop_limit */
> +		__be32 *hlim_word = (__be32 *)ipv6_hdr(skb) + 1;
> +		__be32 old;
> +
>  		if (ipv6_hdr(skb)->hop_limit <= 1) {
>  			__IP6_INC_STATS(net, idev, IPSTATS_MIB_INHDRERRORS);
>  			icmpv6_send(skb, ICMPV6_TIME_EXCEED,
> @@ -467,8 +471,12 @@ static int ipv6_srh_rcv(struct sk_buff *skb, struct inet6_dev *idev)
>  			kfree_skb_reason(skb, SKB_DROP_REASON_IP_TTL_EXCEEDED);
>  			return -1;
>  		}
> +		old = *hlim_word;
>  		ipv6_hdr(skb)->hop_limit--;
>  
> +		if (skb->ip_summed == CHECKSUM_COMPLETE)
> +			update_csum_diff4(skb, old, *hlim_word);
> +
>  		skb_pull(skb, skb_transport_offset(skb));
>  		goto looped_back;
>  	}
> -- 
> 2.43.0
> 

Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Technical Details
Message-ID: <auk4Z3DM4up7qVqu@fedora>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-355143-linux-kernel-netdev=dewy.ru
References: <20261031225033.64-1-andrea.mayer@uniroma2.it> <20261031225033.64-3-andrea.mayer@uniroma2.it>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-355143-linux-kernel-netdev=dewy.ru
From: hangbin.liu@linux.dev (Hangbin Liu)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net 2/6] seg6: update skb checksum when ipv6_srh_rcv()
 decrements the Hop Limit
Date: Tue, 3 Nov 2026 09:27:03 +0800
Organization: Usenet Network
Message-ID: <auk4Z3DM4up7qVqu@fedora>
References: <20261031225033.64-1-andrea.mayer@uniroma2.it>
 <20261031225033.64-3-andrea.mayer@uniroma2.it>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="3072315"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:/BWjajoRLs8GykqekMux7TgEfQE= sha256:NjvTJJtXavlIMd6sUvWQHswsND+4trA+iOwUNPNBRVU=
	sha1:Pfa7lH4kIs9Lt26khmMAcMHk4Fc= sha256:V0Me+6i6M5w3xC05cSQiITDI6Qi/inAl9/UHDGLUWuY=
Content-Disposition: inline
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 983251126F3; Tue,  3 Nov 2026 04:28:09 +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 vT5w-5e6-lSb;
	Tue,  3 Nov 2026 04:28:06 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-355143-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 5404D111D53; Tue,  3 Nov 2026 04:27:57 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 5CD6B2797A; Tue,  3 Nov 2026 01:27:25 +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=1793669243;
	b=hAq2+y/5xrLAShh2n6RBgvqAShVzSINcvee99tin/cnqD/20jm5Rljub1iCoXks5wkjC
	 TNHTmPc5iJC9iaOZDsFjLVaDvSPIdqTTLkqJ6PUkNT0S8LAqiSZVWkFffPxlgkub+Gb5v
	 mEurc9wtynK7BRRkfqYko/fZW1mmYSIQXvrSJwcal1m/NByjxd0V+V9MHooptO1e3UdIE
	 G2s+JRjq3/P9mOajRuD5PSjJdz6y5iDb27hDgv8W2MyZ0VsjiQAKJPKXLjpYD2DI8d6Zr
	 Wb0sTtqHToxhp3bCpC1LQPv6YBnhFRPhnxOatSTxd7EqG693VVfeSGflg3ZI2xEJ6vw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793669243;
	h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature:
	 X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow:Date:From:To:Cc:
	 Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=xwrigN4hHrfQ0pdJAvaDQuroSa/OQ6XUSfC/4kh1PgE=;
	b=a9azE10JvdJvDKUUZnA6iUrCs7DabeVW/Gk/Zs2PMCF9kFBXyMxQI2VjUxeajsLLsPzM
	 /p5VdHUR3xnNnzdXDDCcD++LOX0s9m7H3C1lzqDVWj0kh4t/xPU5AscI7YxFJFJFuLe1c
	 mG0NEOUnP1F590K7H+6y5F0IoiEj7MAWMjEe9HwZbBJ7wZutSGo1fXqr9DanKqXEJt6bB
	 KWTPbtmN2f4w5t3FHvhtO5HiMCFhPcamlzAvH+FTD7FNRGHiqJovqfjb/dB5fKRp37h3Y
	 5uT45PtC4Mu69uuQyNfFv6nuUZAPKm9AKynUJuvyNrZnltrUCUXYDJZFkVi/POFaSMw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=PB7soUHQ;
	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 408D8606A338;
	Tue,  3 Nov 2026 01:27:23 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=PB7soUHQ
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.73
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793669242;
	b=Yr4M7BgFfYStl/kvdq3xOERmMjTTarUXSZ4/a0i6Ktwj3Enm5dxW5SY3ETuIMQGGean7
	 ++VoG2w3+2Ugh5cP8izh3fWcsESU85mPfyj7nrZb1e0Ovk2MQoV5MqMJDEq7HsJeEaKuT
	 due3yYIVThabf0Jqo5XAO2zaKG20beV/In+JFZF5Dd8zQLfYc9y7shv9jk4Sz60vi+KRT
	 qdye5TUpFwIMuIAgsAiVsMw9/mpdDjTzO5SzUMEaS7gFHs3A7o8NQYy9m4c2VS20Mzcib
	 44Cgn3Dyd7UglxrNW8L9FUYa6Hs2OQu/vzBkVRAIq7IKGaXo7F96t3tfk9148Hfuc9Q==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793669242;
	h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received:
	 X-Mizu-Trace-ID:X-Migadu-Flow:Date:From:To:Cc:Subject:Message-ID:
	 References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=xwrigN4hHrfQ0pdJAvaDQuroSa/OQ6XUSfC/4kh1PgE=;
	b=Sj7fETkdbmmvJIHRkpTvio2/rUUWKyD16/i0RL9jIHguT2OOakTiqj8ZqC0+J2BwC/TZ
	 r+QiXFSUkSP2pBOW1ldaIbn0MSdeucVA/W4HSjblHPMFr0auzckt/1r8hO416rjoGVpzn
	 Dy8k7vIb4ogm5MxqDkCzPf9INWYH6Di6HmEay3phYIY/SjFUblxDU4a/2SkdLHXDReOGK
	 rW7LExXSDIIvwTnlfybwI2RdykPSalrXeRH6kWqB4r6L6NMp0Kwy6ImhPgRt0APo6kVJ0
	 LiY4KKaOb+4v1Cw8wI3lOUXcUynY25V42fqQPdImIxiChqHwPE7CV2a3ORq3i+/rZsA==
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=PB7soUHQ;
	arc=none smtp.remote-ip=91.218.175.73
X-Received: from mta0.migadu.com (out-73.mta0.migadu.com [91.218.175.73])
	(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 A8965606A331
	for <netdev@vger.kernel.org>; Tue,  3 Nov 2026 01:27:21 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A8965606A331
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=D+/gw0Ztw4cZkf3WTT5E7vaQ4EK3jAqSPRQxFCWd8ok=;
 c=simple/simple; d=linux.dev;
 h=from:to:subject:date:message-id:mime-version:content-type; s=key1;
 t=1793669238; v=1; x=1794274038;
 b=PB7soUHQZzgbmZjXh/fH9csK3Ied1/V+gZxo/SFEdSc1Zj3L2pmU2rSYLsgY2FEKuXAAHXcD
 ZM+yjE7osqIRQ6zEkD9hs1ySTqGPIroojC92NhjBfhUne0f36ayjAAXujQ0g87JjcHBf9wZK5Gl
 Mb8KKgNNX9fRjWUiCl/eteBI=
X-Envelope-To: netdev@vger.kernel.org
X-Received: by mta11.migadu.com with ESMTPS id 53184aca2c7ad085;
	Tue, 03 Nov 2026 01:27:18 +0000
X-Mizu-Trace-ID: 53184aca2c7ad085
X-Migadu-Flow: FLOW_OUT
X-Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>, David Ahern <dsahern@kernel.org>,
	Ido Schimmel <idosch@nvidia.com>, Shuah Khan <shuah@kernel.org>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	linux-kselftest@vger.kernel.org, bpf@vger.kernel.org,
	David Lebrun <david.lebrun@uclouvain.be>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Mathieu Xhonneux <m.xhonneux@gmail.com>,
	David Lebrun <dlebrun@google.com>,
	Stefano Salsano <stefano.salsano@uniroma2.it>,
	Andrea Mayer <andrea@common-net.org>
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: <20261031225033.64-3-andrea.mayer@uniroma2.it>