🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #9211

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

#9211
From: Andrea Mayer
Date: Sat, 31 Oct 2026 22:50
45 lines
11766 bytes
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 0d39a38a5dd2..3821d8e1409e 100644
--- a/net/ipv6/seg6_iptunnel.c
+++ b/net/ipv6/seg6_iptunnel.c
@@ -456,7 +456,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
Technical Details
Message-ID: <20261031225033.64-6-andrea.mayer@uniroma2.it>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-354165-linux-kernel-netdev=dewy.ru
References: <20261031225033.64-1-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-354165-linux-kernel-netdev=dewy.ru
From: andrea.mayer@uniroma2.it (Andrea Mayer)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net 5/6] seg6: account for the MAC header in skb checksum on L2 encapsulation
Date: Sat, 31 Oct 2026 23:50:32 +0100
Organization: Usenet Network
Message-ID: <20261031225033.64-6-andrea.mayer@uniroma2.it>
References: <20261031225033.64-1-andrea.mayer@uniroma2.it>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2572663"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:0sCE65wWgJGf2P5tPjTy/qXtFIM= sha256:FpCwwc9+nIt4orIJQBrd6THvG25+f5i2zieYtVSUpvE=
	sha1:4VA0y/dMJ/7ihT7YMM+2hYfyI/Q= sha256:gIN50h5tzsjZWqNMSklQ+wDElARSCucL/MDnvdyYA8g=
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 CE6FB1122C0; Sun,  1 Nov 2026 01:56:13 +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.25,
	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=neutral
	reason="invalid (unsupported algorithm ed25519-sha256)"
	header.d=uniroma2.it header.b=E3I7x+c5; dkim=pass (2048-bit key)
	header.d=uniroma2.it header.b=t5RCtOui
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 B21Kh6RNi0eP;
	Sun,  1 Nov 2026 01:56:11 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-354165-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=uniroma2.it
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 5AC801122BE; Sun,  1 Nov 2026 01:55:58 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id E35E62DB83; Sat, 31 Oct 2026 22:52:34 +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=1793487149;
	b=A6DIhYNS7Irbr+FcwsinMtRiZo4OdSpD/Z7hD1vkf/FMEtKTYqaVZh89VMgVDCx4n52w
	 poJjHbQypU60KigrLAm0Q7LaiwL7tWHCf4UBcFhTaZ7QfHYgNdeX1jDM0lbsuYAvAa2sz
	 4eJLseTiErDEpIv8XEFcWFnWCCjjhZZzWnwOqs1ylg6eQCxSWDndNbh5bmhZxJWTdAH2X
	 B8+BdLCxSBWmVsEz1yehyFc5WNNk6NIPDHlaDXsHiGEU0BY0kJDbddU9MZgmgBtqXvyz7
	 nr4dQ/h86WDLo5xN+J1RzIfHG6g29mVRoDO5+8xD8pvHAc+yn94EieFb5xvA+7z+o2Q==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793487149;
	h=X-Original-To:Received:DMARC-Filter:Received:Received:DKIM-Signature:
	 DKIM-Signature:From:To:Cc:Subject:Date:Message-Id:X-Mailer:
	 In-Reply-To:References:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding:X-Virus-Scanned:X-Virus-Status;
	bh=bK4w1yMKnR9FGJtFhRyJrL+d6EWl3MZqzIXWR3zmOmk=;
	b=Qg9zJB0M/lotiBIKvDKStjBOCuogPnTIxM457RNYBTlrm7xa2QM1HX7RIj0KzGEuWbtn
	 LTu1PdAeNDvNEpRGPQKteLrxRq3d4bhGezCa2oL6thS1FJ2AEPdgjAJ1FprJTq5K/It5v
	 ZssH/nMLN1xNN9yr9YQdna+nQp+BKUXnPEnL4ylSKSfSwrSUPYQ8bVwQEDWIn+Sd7QU7g
	 SGg/y5EALYZh1+cEfwB7ArX40IP9s5q/sKgxf1p1FeTmqF/l59ztRdPiv5ccU7bdTHd7S
	 OI1wSFTkxQiUjhAbScfCWrC8f5bNo2C+Mk+F6b0JUkxvOiQ8CjVt5zU+5k97wHuvHdg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=ed25519-sha256 header.s=ed201904 header.b=E3I7x+c5;
	dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=rsa-sha256 header.s=rsa201904 header.b=t5RCtOui;
	dmarc=pass header.from=uniroma2.it;
	spf=pass smtp.mailfrom=uniroma2.it;
	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 3692560A263A;
	Sat, 31 Oct 2026 22:52:29 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=ed25519-sha256 header.s=ed201904 header.b=E3I7x+c5;
	dkim=pass (2048-bit key, unprotected) header.d=uniroma2.it header.i=@uniroma2.it header.a=rsa-sha256 header.s=rsa201904 header.b=t5RCtOui
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=160.80.4.37
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793487143;
	b=vRnlTHRdhwdAMfEN3WWprE3KhS1TM5YPKBdJ3aTuWqU8IzGd1CTQ5TDTXVPf6ngcfwPl
	 jnFhFI/aW4Wc/dXEp32yH7xpmc/eK87JBh64/x9m3qheG3YVirERHP5z1Ld7YM6WKwgb/
	 ykpMUqdE4dCJpFvmYfDJHiPyrmrUVGeX3pNdPyIFfN4cfhJhNzkjcuSfv4BLoHvYSPNHc
	 i7FqKd/Se4khikgF/Y9UuiKSUGPPdE4HzSTZDsI2BFSicllh7f8CcfarZbYgs3hSDmcG8
	 U8oohteLdyIAp4dp3sGGnAzug3Ebtu4p0t1mFa1j3WnjN3uBrRSQeeNkAPxDoWYmfRw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793487143;
	h=DMARC-Filter:Received:Received:DKIM-Signature:DKIM-Signature:From:To:
	 Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References:
	 MIME-Version:Content-Transfer-Encoding:X-Virus-Scanned:
	 X-Virus-Status;
	bh=bK4w1yMKnR9FGJtFhRyJrL+d6EWl3MZqzIXWR3zmOmk=;
	b=2qdFrPSoNUkPe9cR6VQ4egDn84n3hk06MvI+WtJ8nXg6Z2/QL7ttGmczGFTaU71uhUhN
	 nbm1iuhhUiuLr4U8vXkiToFt82kApYj6rNnnEcwjNnBlj+bwZjLvqC0CVW6a8RR8tU9J4
	 Ag8RNsiESmmcQY7hGqNaO2n0rqrydqv2/urTnZ+1Fk+t7wOeYEK7qRqTkuprbW3XYK2A8
	 cGXvL7zWGG2UMXEfFnjYJMs7cdXH/QIJevA8aq346pq+fQZQAR5FS8R90d4gMlMXvggbk
	 4JfcpXTXhuF4sFxhTKjmokA/10PqcmeQJfEEu4LBY1D5B7Y2Xj2uAu17ywwzLkL9TCg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=uniroma2.it;
	spf=pass smtp.mailfrom=uniroma2.it;
	dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=ed25519-sha256 header.s=ed201904 header.b=E3I7x+c5;
	dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=rsa-sha256 header.s=rsa201904 header.b=t5RCtOui;
	arc=none smtp.remote-ip=160.80.4.37
X-Received: from smtp.uniroma2.it (smtp.uniroma2.it [160.80.4.37])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id C1C5A606A322;
	Sat, 31 Oct 2026 22:52:21 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C1C5A606A322
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uniroma2.it
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=uniroma2.it
X-Received: from smtpauth-2019-1.uniroma2.it (smtpauth-2019-1.uniroma2.it [160.80.5.46])
	by smtp-2015.uniroma2.it (8.14.4/8.14.4/Debian-8) with ESMTP id 69VMpR8B021984;
	Sat, 31 Oct 2026 23:51:32 +0100
X-Received: from localhost.localdomain (unknown [160.80.105.87])
	by smtpauth-2019-1.uniroma2.it (Postfix) with ESMTPSA id 0AB62122954;
	Sat, 31 Oct 2026 23:51:12 +0100 (CET)
X-DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=uniroma2.it;
	s=ed201904; t=1793487072; h=from:from:sender:reply-to:subject:subject:date:date:
	 message-id:message-id:to:to:cc:cc:mime-version:mime-version:
	 content-type:content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=bK4w1yMKnR9FGJtFhRyJrL+d6EWl3MZqzIXWR3zmOmk=;
	b=E3I7x+c59ia0dZtEfqqS7U5qwtdUFli23Md1S/9PJARzagwdEN/t8Km0lPvTtlNS78lIDK
	/cfsGKlQyzn0fWBQ==
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uniroma2.it; s=rsa201904;
	t=1793487072; h=from:from:sender:reply-to:subject:subject:date:date:
	 message-id:message-id:to:to:cc:cc:mime-version:mime-version:
	 content-type:content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=bK4w1yMKnR9FGJtFhRyJrL+d6EWl3MZqzIXWR3zmOmk=;
	b=t5RCtOuijMPHSJV3sJrONmM3QJXHfz0CHdp2TcydULY2hXg05q6TvauETd6S2owMVJ5IUG
	vHkhC4D5fJuVyNW3J1wPDKSgt5ysCpNsRmz2jB45dOFshAaNmGiL2/sq8iUbB9TPHgCg86
	JzyNcJpw3qmGvfJ7f7rmPW3CfIb538zTV96Ij5pH0j/Zm2U1ltJRrUb3MVZ7uZ8GXVjLwk
	ERLiwjXVoF7b3gK/pfU3lJYOTKl8FwQivD09S1wLGdwT4RHuxWgeSs9NJmLddou1om8h9k
	6BseQknCFoS7757sQWc8GDE5X0l9wK/4N9UwbBRq1DR68stXUypC6yuMOq0dcw==
X-Cc: 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>, Hangbin Liu <hangbin.liu@linux.dev>,
        Stefano Salsano <stefano.salsano@uniroma2.it>,
        Andrea Mayer <andrea@common-net.org>,
        Andrea Mayer <andrea.mayer@uniroma2.it>
X-Mailer: git-send-email 2.39.5
X-In-Reply-To: <20261031225033.64-1-andrea.mayer@uniroma2.it>
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-Virus-Scanned: clamav-milter 0.100.0 at smtp-2015
X-Virus-Status: Clean