🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #19049

Re: [PATCH net v2 5/6] seg6: account for the MAC header in skb checksum on L2 encapsulation

#19049
From: Hangbin Liu
Date: Thu, 19 Nov 2026 08:47
49 lines
10903 bytes
On Wed, Nov 18, 2026 at 04:02:50PM +0100, Andrea Mayer wrote:
> In L2ENCAP and L2ENCAP_RED mode, seg6_do_srh() puts the MAC header back
> in front of the frame with skb_push(), without adding it to skb->csum.
> The encapsulation then calls skb_postpush_rcsum() only for the outer
> headers. With CHECKSUM_COMPLETE the MAC header is missing from
> skb->csum, which no longer covers the whole packet as required.
> 
> For a forwarded packet, ip6_forward() sets ip_summed to CHECKSUM_NONE with
> skb_forward_csum(), and End.DX2 does the same before sending the frame.
> When the packet is delivered on the same node, a raw socket with
> IPV6_CHECKSUM still reads skb->csum. With skb->csum computed by the device,
> the kernel can then log a "hw csum failure", as if the device had computed
> a wrong skb->csum.
> 
> Use skb_push_rcsum(), which also calls skb_postpush_rcsum() for the MAC
> header.
> 
> Found by manual code inspection of the skb->csum updates in the SRv6 code,
> and observed in a VM without kernel changes or error injection: with
> skb->csum computed by a tc ct action, a BPF tracing program on
> ip6_forward() shows skb->csum missing the MAC header. With this patch,
> skb->csum covers it. Also tested against the srv6 selftests, and with a
> ConnectX-6 Lx NIC (mlx5) that provides CHECKSUM_COMPLETE.
> 
> Fixes: 38ee7f2d4756 ("ipv6: sr: add support for encapsulation of L2 frames")
> Signed-off-by: Andrea Mayer <andrea.mayer@uniroma2.it>
> ---
>  net/ipv6/seg6_iptunnel.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv6/seg6_iptunnel.c b/net/ipv6/seg6_iptunnel.c
> index 3bc47c5614ff..82b3c2af03f7 100644
> --- a/net/ipv6/seg6_iptunnel.c
> +++ b/net/ipv6/seg6_iptunnel.c
> @@ -472,7 +472,7 @@ static int seg6_do_srh(struct sk_buff *skb, struct dst_entry *cache_dst)
>  			return err;
>  
>  		skb_mac_header_rebuild(skb);
> -		skb_push(skb, skb->mac_len);
> +		skb_push_rcsum(skb, skb->mac_len);
>  
>  		if (tinfo->mode == SEG6_IPTUN_MODE_L2ENCAP)
>  			err = __seg6_do_srh_encap(skb, tinfo->srh,
> -- 
> 2.43.0
> 

Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Technical Details
Message-ID: <av63tgNtC6__wjWS@fedora>
Path: mbox-mo1.pugleaf.net!news-lax.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-366862-linux-kernel-netdev=dewy.ru
References: <20261118150251.65-1-andrea.mayer@uniroma2.it> <20261118150251.65-6-andrea.mayer@uniroma2.it>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.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-366862-linux-kernel-netdev=dewy.ru
From: hangbin.liu@linux.dev (Hangbin Liu)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v2 5/6] seg6: account for the MAC header in skb
 checksum on L2 encapsulation
Date: Thu, 19 Nov 2026 16:47:50 +0800
Organization: Usenet Network
Message-ID: <av63tgNtC6__wjWS@fedora>
References: <20261118150251.65-1-andrea.mayer@uniroma2.it>
 <20261118150251.65-6-andrea.mayer@uniroma2.it>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="2831711"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:UL55C0/x04MT/d+BcjbeUQ8G8WI= sha256:9whvMbhJ/RRK9gwlnRzYtl20UW69Blhxm/mlcEooj2s=
	sha1:4URFFCBmPR3f+Z9g/I+5T3PWbWM= sha256:KSfCObCgXBLNDcWG77LXSHvXsodCAaF7CrESnkYor5U=
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 41F1E11556D; Thu, 19 Nov 2026 11:48:25 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 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, URIBL_BLOCKED=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 TqQ7jDt_5bWB;
	Thu, 19 Nov 2026 11:48:20 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-366862-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 61402115525; Thu, 19 Nov 2026 11:48:11 +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 5E0143C042; Thu, 19 Nov 2026 08:48:08 +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=1795078086;
	b=cjR/xft7sTBacAlRCaNbYLEMxE78UnHe/dze95qptsfUNW79Dgkqo+TlBLgc6JbwbfgY
	 5b1baUtMBwWNmXh1e91hLNiZHQgAlj7H6fQAL/jk9KeQt+V0fTodagPlJTGY35+nV423q
	 ds994nRFJx9+ffHR5Up122Rq+9LgzDVD68zsZLzcWEqyMzMtCbK/I3acdXKw7YK6EhAK8
	 ZuqqwLsZLI2RhBdAmX83NuZnfSVZfOHD+iwiA0cTpDtyjJn8zLzYIEiFSEtgcG8Q91vHQ
	 A1tewSYBP7Wwy725djyRxwgyKWlcNcOYP2eXnGVvz4gp+cMFNPzxP7EGL79+zuM03KQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795078086;
	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=H1bhQLtIfRhu5KAqAjgC9nCVZmy6r3NXMjolwdRpzaA=;
	b=K5+bvYzYWCKokzW+tmKYHSEeQ4dPcC7INJy7+spR0O5WoAZKMpDSjBT8WcJztr6/mgif
	 rl/Dq14OKCq7Yuz+HZip3024H7MboBezNiVXPiktEBd9sdaDnhkHlE5mN9HE1UBw5NT+k
	 FusduQUkIT8jRsMfL9MHAHvNpiMdtKQqThBrvyXv0YJkRa1IIAFRz535C6qp2+/yMum+4
	 YjYouH0WMS2R+0GlSYW/0nDteQH6eEYbKIa/ljQ3Rm4PT1gD1Va8LlyRkDxzgaeEvsmrM
	 M0MjyvoFvtbJF6j6z5v+V+yzkBv5Ijp1zKPw6TSSc1IQPVlsL8YTw2wVojc/fD5aqlg==
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=X5uQIsei;
	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 D0E2C606A33A;
	Thu, 19 Nov 2026 08:48:06 +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=X5uQIsei
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.165
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795078086;
	b=IlFns99yncllc9jlhvcRdDc/umooCzhu7QRoocDTAJ1FowTAhTAL4JY5N5S65JKVMg5X
	 HTK2DTU2pzXMjkZZP5gyng5E0lRFsuX2HodXsf1VUQyN9+TD9DwJouPhRu9oPee49b9d5
	 0DH06RjYTFavwl2pT1IthCCMg5NW+OpEeATg/Ton0sUaBzKrt901uq9yvSpPVEfiVGPW4
	 MgpVFthkNESF8HHZfr1LEA+qjcsuyR5iHdmbmFmM4DEOh1x95ZzdNsijVjHIdQ3U0mpDS
	 ROiD82Eq9hu7JBrVhQRC4P2LfbBP/XNYPsIn+CpMsfhDGCMTLwVuvM1We9Q4zkKQ7zA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795078086;
	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=H1bhQLtIfRhu5KAqAjgC9nCVZmy6r3NXMjolwdRpzaA=;
	b=OqFKDDER3QKthc4y+6q7WgqZruyScN7HBa+RHflGmw5Dmzsi0oDn3t+ZLB4kWugmHZXT
	 YwRA1bbweoZKeEM8nhk6k9K/u+77+QXDKJQlE+0o06KLWmvX/3l4YUbr7mXBEvJSoyQnc
	 Bxn5yUpHJ3/Z4zwicESzjnqGnoffpmp9tC6FjR/GuZksmtlS5lP5i2CioARJk2F72Fpt/
	 odwXBCymuoOdRSoYQy2rl7lhhTrySdjTPQK37UEX+oHnqT5K/1y/96elyIGBc2paGNXg4
	 J/L0RmXw3RsHr5TasPj6jHbFbdQPFoZ5MfKn+Gx/U4excCg2Sj6XJd5u/JAAPSypdyA==
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=X5uQIsei;
	arc=none smtp.remote-ip=91.218.175.165
X-Received: from mta0.migadu.com (out-165.mta0.migadu.com [91.218.175.165])
	(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 37033606A320
	for <netdev@vger.kernel.org>; Thu, 19 Nov 2026 08:48:04 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 37033606A320
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=Y9EVLqGCLJb6bEWtsztP5YW7dfjn2JrAKJzkvnEfwzE=;
 c=simple/simple; d=linux.dev;
 h=from:to:subject:date:message-id:mime-version:content-type; s=key1;
 t=1795078083; v=1; x=1795682883;
 b=X5uQIseiNdtIy5kUc5kkUN0fHVDdotCpin2O6LAb54zpbTe7M5FhgnjCAX5I6iMf5sVh8Akh
 SN1nOFFeCGfrpDamjcrNbFOWa71kQECZG5eiq0BoXvc0IpGMQ3/4BVf1T7Zz0ZtCh2OxMeKeOCH
 t63HNmA4ww8XIGjUpfRPpY0E=
X-Envelope-To: netdev@vger.kernel.org
X-Received: by mta10.migadu.com with ESMTPS id d0654b647b7ec1a7;
	Thu, 19 Nov 2026 08:48:03 +0000
X-Mizu-Trace-ID: d0654b647b7ec1a7
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>,
	Justin Iurman <justin.iurman@gmail.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: <20261118150251.65-6-andrea.mayer@uniroma2.it>