🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #18597

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

#18597
From: Andrea Mayer
Date: Wed, 18 Nov 2026 15:02
45 lines
11841 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 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
Technical Details
Message-ID: <20261118150251.65-6-andrea.mayer@uniroma2.it>
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-366229-linux-kernel-netdev=dewy.ru
References: <20261118150251.65-1-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-366229-linux-kernel-netdev=dewy.ru
From: andrea.mayer@uniroma2.it (Andrea Mayer)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v2 5/6] seg6: account for the MAC header in skb checksum on L2 encapsulation
Date: Wed, 18 Nov 2026 16:02:50 +0100
Organization: Usenet Network
Message-ID: <20261118150251.65-6-andrea.mayer@uniroma2.it>
References: <20261118150251.65-1-andrea.mayer@uniroma2.it>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2626210"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:wcKWAjoC9xQdtYMU6JgItQ501Dg= sha256:sKLySdfdmDnqyFlhDkgyCV7MvGxO6BxMhcsuPXT5tjE=
	sha1:O0kJSM2Xo1pOzWAE3+V4E4dyW4Y= sha256:mjo0g5izwLBN9jxj5QgFeZpYq/TES1CyvXaqXV4wHoU=
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 AA7BA1152D1; Wed, 18 Nov 2026 18:10:29 +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=neutral
	reason="invalid (unsupported algorithm ed25519-sha256)"
	header.d=uniroma2.it header.b=U+XfrZ9p; dkim=pass (2048-bit key)
	header.d=uniroma2.it header.b=BE3xfWBa
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 4QD1mugttG1W;
	Wed, 18 Nov 2026 18:10:26 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-366229-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 90B021152F6; Wed, 18 Nov 2026 18:10:13 +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 CAF3936E4B; Wed, 18 Nov 2026 15:08:53 +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=1795014515;
	b=NS4cLc2ZarC8/hR7jK/dgjlzf7WgJOknQatxOW3sRui2uZimhQH6LCFyWYpP2u0fracT
	 TDC8FNi7pSxBtWuPp64Z6fQpm7dgqPCZEMrq98rFs0f+UZF9R3vWzqM8xIX3gy2tNUQ9W
	 szExJ7bGhnQTtLQHNSG0IfFs1c9Sxonvwab//PNUAAJLLXZH04ucct9z9jiObkL2viO0L
	 C7zsX+COzrRT7CdLZO/KAgZdFJsx3HPVwvR9OZVqtMYmYi7lbr6p7GHtN6l5K6roC7Zom
	 +XyhbOpZjrOCTzXt/hOc2Quu9SvI081jWtKBvT49XghIes5nLx9kjMeVuRtP6aWm3RQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795014515;
	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=hmXBOFJVisUqKsWSXSyM1C7VfnAQRO3g66qqmgXB4ZE=;
	b=bruZ/0WZtN5qbvYMeDU+5OjgC8AhkKveIh5NkTWQ6ydiG3NXC19hK9DJr6/EHDWJT9tv
	 nZK0YMhbXakH2kiFvUHJt+tIxFv6rdhOF7qroNXegcEErafeM/lien1bKJ81bk5384WqX
	 S4LLClEW0zW6T1NeEXioiHugKit5z/7j9xyt4v8mZHn3+BqK9SB9LWhG+q1LRS4mpkqQI
	 +VVf+aYaAymfkJfGpppJClcPguUcHC54KwzXK5VOltr3b7F89xVmcScCAP8f0bmdCRLmz
	 DhgGEoeUMuvuAEj2yWZpfsKdt5DROsqLo5VKPRHXU2IvTKPLcx3YDRQMfW8ezFWCBfA==
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=U+XfrZ9p;
	dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=rsa-sha256 header.s=rsa201904 header.b=BE3xfWBa;
	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 6D72060A2612;
	Wed, 18 Nov 2026 15:08:35 +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=U+XfrZ9p;
	dkim=pass (2048-bit key) header.d=uniroma2.it header.i=@uniroma2.it header.a=rsa-sha256 header.s=rsa201904 header.b=BE3xfWBa
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=1795014509;
	b=RkJeE6wp4TJDobPIe6gISy2i1bJq1+ci3bhISAWtJBXYWTSntQfO0rvMM0lfXgSMG1ec
	 +VwymWLjeo5EW4lkta6D1p+Oq2ch/EHLnyaa/ob9Q3bmR1Vp6A+TBSFmQl0zgC1jEawSu
	 IwVhkPep6VBHRmxIlsl3hM7J1R4Hs3ixSILXtJnoRBdbrE/XQM3dZOo0/lbBq4AncGhff
	 Wi0BlNQGiM89c0D39yiEVVHGMA1+nRyQ/7jHL7InHxEz+yjyXxbMNSQeAe7YfsbBUCr20
	 zOXf6zuz+OSQhiiIC5BlRof1uDrjOeq19iRAeb7LQPK/lja/+wvfCCFRfvZhhC2BzJg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795014509;
	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=hmXBOFJVisUqKsWSXSyM1C7VfnAQRO3g66qqmgXB4ZE=;
	b=H30BwTRti6vzfS/3Wb2O0YOyRbbHbUpIktne+wyrkp9UnHPLXrdjuT/Ev5lV8UAxtKh5
	 aNlanqF8KKiGwstLEJyHn6fOtN6XrOV0ZSh0phYrWk8eUJXwy4VEjdamSJxfRTngy3nPM
	 2P7NoRsoykWLo8S9M6G5juUmUymz8jX5KywTzVB25BwMkDDCxu47doPOl6/RaNRLzd4g4
	 K+dbqdodsRQUpqvpxvlXP2RfDKrYbOdWLULw3uZr9a9oD2gjgze7XSKyejstR5IQcM/zm
	 dXXsbDOoCRPErV1rqQXu8o+p3DqPFtNUrU0yZr5WC25OcTn2hx2AEUGOYXzLqiZQ8Mw==
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=U+XfrZ9p;
	dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=rsa-sha256 header.s=rsa201904 header.b=BE3xfWBa;
	arc=none smtp.remote-ip=160.80.4.37
X-Received: from smtp.uniroma2.it (smtp-2015.uniroma2.it [160.80.4.37])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id DC0A3606A33F;
	Wed, 18 Nov 2026 15:08:28 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DC0A3606A33F
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 6AIF7YJ8012193;
	Wed, 18 Nov 2026 16:07:39 +0100
X-Received: from localhost.localdomain (unknown [160.80.105.87])
	by smtpauth-2019-1.uniroma2.it (Postfix) with ESMTPSA id 8973E122958;
	Wed, 18 Nov 2026 16:07:30 +0100 (CET)
X-DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=uniroma2.it;
	s=ed201904; t=1795014450; 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=hmXBOFJVisUqKsWSXSyM1C7VfnAQRO3g66qqmgXB4ZE=;
	b=U+XfrZ9pAiZV+r1dhjbdVX+7vYw7zMmeAtyQQYkCDgU/UDc6gm8r6F7R7piWXb3LTsedOx
	oPUy/HN4qzUcQQBg==
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uniroma2.it; s=rsa201904;
	t=1795014450; 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=hmXBOFJVisUqKsWSXSyM1C7VfnAQRO3g66qqmgXB4ZE=;
	b=BE3xfWBahuAv++SpGa6ntVuWzrWUubbdVtnM4HRnXwoRcz/dD1jxaYtC8hk0k1yzF8uvPz
	SLLBw836WgJrnjD+Tfa+ylX2UF8CclVAFXEdlwcBH2TiV2bnwBPov7S7TuISayG3pKBu53
	AfydvRXXP77h3QEurV1MrGiFpZvD7HMrRQ2EPh38taDOM3l0YPpVdVZWa4VuHXGnXWpwqS
	uw0GWs7UmoIxLehZMskr8Hu9Sd/f70jkIms14e01mwq/ThhE1GPSZ2YozCH2O1PmbW7Lnv
	tRxUd2S/cbxuYaGWP8AQpS+6J1dEs9xgqm2dhOwGsOFp4TzdNEx9asX7TnqEig==
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>,
        Justin Iurman <justin.iurman@gmail.com>,
        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: <20261118150251.65-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