Article View: linux.kernel.netdev
Article #18591[PATCH net v2 0/6] seg6: fix skb checksum updates with CHECKSUM_COMPLETE
From: Andrea Mayer
Date: Wed, 18 Nov 2026 15:02
Date: Wed, 18 Nov 2026 15:02
85 lines
13557 bytes
13557 bytes
This series fixes the skb->csum updates with CHECKSUM_COMPLETE when the
SRv6 code processes a received packet. In several places skb->csum is not
updated correctly:
- ipv6_srh_rcv() updates skb->csum with the wrong sign for the new
Segments Left and destination address, and not at all for the Hop Limit
decrement.
- advance_nextseg() and seg6_next_csid_advance_arg() in seg6_local do
not update skb->csum.
- The End.BPF program and seg6_bpf_has_valid_srh() can change the
packet without updating skb->csum.
- In L2ENCAP and L2ENCAP_RED mode, the MAC header put back in front of
the frame is not added to skb->csum.
When the packet is then delivered on the same node, the effect depends on
who computed skb->csum. With skb->csum computed in software, for example by
conntrack, UDP can drop the packet as a checksum error. With skb->csum
computed by the device, TCP can log a "hw csum failure", as if the device
had computed a wrong skb->csum. In the L2ENCAP case skb->csum can be read
on local delivery, for example by a raw socket with IPV6_CHECKSUM.
The series is organized as follows:
- Patch 1/6 fixes the update_csum_diff4() and update_csum_diff16()
helpers.
- Patch 2/6 updates skb->csum for the Hop Limit decrement in
ipv6_srh_rcv().
It depends on patch 1/6.
- Patch 3/6 updates skb->csum when SRv6 behaviors advance to the next SID.
It depends on patch 1/6.
- Patch 4/6 discards CHECKSUM_COMPLETE after the End.BPF program.
- Patch 5/6 accounts for the MAC header in skb->csum on L2 encapsulation.
- Patch 6/6 adds a selftest that uses a tc ct action to compute skb->csum.
It covers the paths of patches 1/6 to 4/6, and a control datagram
checks that the test detects a wrong skb->csum.
Tested with the srv6_*.sh selftests, including the new one, and with the
lwt_seg6local BPF selftest. The series was also tested with a ConnectX-6 Lx
NIC (mlx5) that provides CHECKSUM_COMPLETE. Without the series, TCP over
the SRv6 paths of patches 1/6 to 4/6 can log "hw csum failure". The same
happens for a raw socket with IPV6_CHECKSUM, on a packet delivered locally
after L2ENCAP. With this series, none of this happens.
v2:
1/6, 2/6 and 3/6:
- no change, with the Reviewed-by of Hangbin Liu (Thanks Hangbin).
4/6:
- discard CHECKSUM_COMPLETE after the seg6_bpf_has_valid_srh() check
(suggested by Hangbin Liu);
- update the comment, since seg6_bpf_has_valid_srh() now runs before
it;
- add the srv6 selftests to the testing statement of the commit
message.
5/6:
- no change.
6/6:
- call log_test_expected() directly, instead of a local log_test()
wrapper (suggested by Hangbin Liu);
- use require_command() of lib.sh instead of a local helper (suggested
by Hangbin Liu).
v1: https://lore.kernel.org/netdev/20261031225033.64-1-andrea.mayer@uniroma2.it/
Thanks,
Andrea
Andrea Mayer (6):
seg6: fix skb checksum update helpers
seg6: update skb checksum when ipv6_srh_rcv() decrements the Hop Limit
seg6: update skb checksum when SRv6 behaviors advance to the next SID
seg6: discard CHECKSUM_COMPLETE after the End.BPF program
seg6: account for the MAC header in skb checksum on L2 encapsulation
selftests: seg6: add test for skb checksum with CHECKSUM_COMPLETE
include/net/seg6.h | 4 +-
net/ipv6/exthdrs.c | 8 +
net/ipv6/seg6_iptunnel.c | 2 +-
net/ipv6/seg6_local.c | 24 +-
tools/testing/selftests/net/Makefile | 1 +
.../selftests/net/srv6_csum_complete.bpf.c | 65 ++
.../selftests/net/srv6_csum_complete_test.sh | 627 ++++++++++++++++++
7 files changed, 727 insertions(+), 4 deletions(-)
create mode 100644 tools/testing/selftests/net/srv6_csum_complete.bpf.c
create mode 100755 tools/testing/selftests/net/srv6_csum_complete_test.sh
--
2.43.0
Technical Details
Message-ID:
<20261118150251.65-1-andrea.mayer@uniroma2.it>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366228-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366228-linux-kernel-netdev=dewy.ru
From: andrea.mayer@uniroma2.it (Andrea Mayer)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v2 0/6] seg6: fix skb checksum updates with CHECKSUM_COMPLETE
Date: Wed, 18 Nov 2026 16:02:45 +0100
Organization: Usenet Network
Message-ID: <20261118150251.65-1-andrea.mayer@uniroma2.it>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="2624981"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:NqlQVFmjBVkArKJpO+DkB8d0A04= sha256:zcWXrWHfBRe62TkGy/T2cWDaiJR5QClgazhcK6rXY/Y=
sha1:ceS/lAaKeVw3eLL50RAUSQr9eH0= sha256:Cld7V8rQqM8u5GoEt1UT/NXf3wkQtDbR2xvu6z+Qhcw=
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 9D5DA1152F2; Wed, 18 Nov 2026 18:08:53 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.151
X-Spam-Status: No, score=-3.151 tagged_above=-9999 required=6.31
tests=[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=mlBbK8Tt; dkim=pass (2048-bit key)
header.d=uniroma2.it header.b=wSFleYje
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 45cVFnsBZA4p;
Wed, 18 Nov 2026 18:08:48 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-366228-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
by mail.dewy.ru (Postfix) with ESMTPS id D84BC1152EF; Wed, 18 Nov 2026 18:08:33 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sto.lore.kernel.org (Postfix) with ESMTP id F3CD8613129; Wed, 18 Nov 2026 15:08:32 +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=1795014510;
b=Saet3Ou3J/D4VR3YiXBTH7mUyIY4ECasopZ8QnAetjvgvc0ivkvjQfo2ayZNJxopRmuE
jqZoXCj0EOGyCqoFNj86/iHXZANHx0ZX7LP7SNYEXdkAGBE9IQLzhTLX7rDmC3wa6TJgh
S6mUc8BjrgsMfCB6d2Ryq+6lCGj5bGnwq0kJz7yf4uaze/sHDJxsA49ekjGUcm8r0+WhS
ca82M4TyetK6RoufOJPTlSQYYpRaFxJk2nt6XTkfqzB2dfaoDjFrYbajWnBLhlvMRwnFk
oe3K2rD0X45cKX73C1URdczdHXOeBMYR92f7VuYk1EnBdPkgS/nwsXWqaHGRk+0qPXw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795014510;
h=X-Original-To:Received:DMARC-Filter:Received:Received:DKIM-Signature:
DKIM-Signature:From:To:Cc:Subject:Date:Message-Id:X-Mailer:
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=GK5STU+MzzMbRDE228gZW24i7ufyj4DGDobudL8Cxs8=;
b=KPKcJZUl2RQ8tP8JQPX4mF43OQUsx9fy2xRWpAv1cosAdMLKulpUQb402nu3O1MfH80/
PXeMCEyXAzfGk7LjkCABgzNK1M5jigHZBihU8jhQdkTe/H7xco277oc28dDRqGle7XWRg
R0QT4B/xVNqSxU8fV5zWJ5l08G8DROPtWbuLRLqP71JUmMPHqV6RV6UBu6f5xSbVsOLPm
uYAaTdP5k4QjzcVuigPaj0vNWBrxokqEcUbnhqg09hXd3o1Zf3EUC4WhTgWUK7uCOp5Ab
qW2DvPU2B/jETzZLUMNQMFWgVuAQu95UoMAfQvFN+vkUdLqRRUZ8lsZ3jWjeBA3K7Jw==
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=mlBbK8Tt;
dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=rsa-sha256 header.s=rsa201904 header.b=wSFleYje;
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 2916160A2617;
Wed, 18 Nov 2026 15:08:30 +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=mlBbK8Tt;
dkim=pass (2048-bit key) header.d=uniroma2.it header.i=@uniroma2.it header.a=rsa-sha256 header.s=rsa201904 header.b=wSFleYje
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=mUgTe3zmS/4toBuKaOgrNXqmqX3abCUpXJVK0GPhzTLPr2fJKdmRT0IhNh5aBEkJmkP6
pboL8CVGz0JRV5cHW9RJ7cW8hx5+dAAe+F6SAaZr+2Rn2b7ShYWST9lG9pg545mKDQB4b
3PuYk1++MSRs5+tPH9oM5mPmBOdYE3vyN5FBeEk6olitujggaVLhqbO/XqI23PL275csh
mWbD0Ta3XMer7bwjjDXx6jvh1St/nfbWl+50EJXXYMqA7gUcd+eRw6+pmnc0VlyKerCJ1
VCAURWJT45uYI3noRLCekEmTf4rkAPZOJcQmcqVryGFJRMvr68EI0MfSNnkj/D5YFXg==
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:MIME-Version:
Content-Transfer-Encoding:X-Virus-Scanned:X-Virus-Status;
bh=GK5STU+MzzMbRDE228gZW24i7ufyj4DGDobudL8Cxs8=;
b=f0gQF/0ZGxb1cflsyWZs7Ij7FFV5SqsuKY7mW6m73DNZ6DHWQzJy3CssXeJZsBQ3d75X
aJolhUuC3xi3/JpTCChsRQkyUtoBNjT7tUinQNKdkGHpZ+Tw07cT5K6zBLmxXDyPvMHvv
q7nB2WFks72dkJV/4HF4W2Kv8Pw9jILeAxOZAJd/1SXwxFz1X2w7N5egb2Gsi2robmpGW
TZivIQelO8nAYYI9n2GgIYBMbTunQzS0RLyosqIl3QyVlZrfW3y9iGJ83MBELl7ua8VcX
fNfXECU/0zmzQMNy1x49kd7iPYEDsZ+6kiZx2JrErlA7ZR3SwIUxxkVN8JmEtUySqdA==
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=mlBbK8Tt;
dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=rsa-sha256 header.s=rsa201904 header.b=wSFleYje;
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 9B96E60A2607;
Wed, 18 Nov 2026 15:08:28 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9B96E60A2607
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 6AIF7X6s012187;
Wed, 18 Nov 2026 16:07:38 +0100
X-Received: from localhost.localdomain (unknown [160.80.105.87])
by smtpauth-2019-1.uniroma2.it (Postfix) with ESMTPSA id 2488212291C;
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:references; bh=GK5STU+MzzMbRDE228gZW24i7ufyj4DGDobudL8Cxs8=;
b=mlBbK8TtJ7THAMv7BLLklC1V+IPlZBTtr991QDJIBnsJGxZmWbKZXnoF5PlrM6fdQE6k4f
z4v4s9G7n/MTTXCg==
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:references; bh=GK5STU+MzzMbRDE228gZW24i7ufyj4DGDobudL8Cxs8=;
b=wSFleYjej/Ht89lE7abdQCaKSeFt6SbgWuRVY03ervgp6YtAjcucRhxIntTYmpq98G+6wo
+9xfU9MgVZxPatLdmOIa8MQioIgv/SDQfnZWwux1bJopIb7p6cDVh8zJ/6fDCYo4rNEShN
z5OQjfiHLhha8gQMJkfICzv7Kq98e6quXqhl2He47wMJUOwnsc/D3vqDY2Z5GEQNhT3yZy
FM1si4R1G6imOVbGSe4zkZp2s4Tol2/oPAggi91kbRlMHxlltpXFSUN0ut1pIpsb1vFqr3
FzR5aMgSr01e1lE41X9LKG980doYPx1peJAo8j9Vft6m3H9ws8SCLqpjC6hh1Q==
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-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