Article View: linux.kernel.netdev
Article #9210[PATCH net 2/6] seg6: update skb checksum when ipv6_srh_rcv() decrements the Hop Limit
From: Andrea Mayer
Date: Sat, 31 Oct 2026 22:50
Date: Sat, 31 Oct 2026 22:50
56 lines
11989 bytes
11989 bytes
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
Technical Details
Message-ID:
<20261031225033.64-3-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-354163-linux-kernel-netdev=dewy.ruReferences:
<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-354163-linux-kernel-netdev=dewy.ru
From: andrea.mayer@uniroma2.it (Andrea Mayer)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net 2/6] seg6: update skb checksum when ipv6_srh_rcv() decrements the Hop Limit
Date: Sat, 31 Oct 2026 23:50:29 +0100
Organization: Usenet Network
Message-ID: <20261031225033.64-3-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="2572187"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:fBC6ZMz4bPem17miNJWXAvY//us= sha256:abxZdQKh5mo73Mi2D/o9R/WoIDa2Wzd0YMNVV7Y5XN4=
sha1:8Hj2vyOISfzrETnRU8ODvqv5a+I= sha256:i/nzRDxLa+qq3OM0z9T8dGsSaLV/vEdD3Ww0RwIM8Kc=
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 19DA91122BD; Sun, 1 Nov 2026 01:53:50 +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=wk/kgJ5L; dkim=pass (2048-bit key)
header.d=uniroma2.it header.b=QQf0V8tn
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 Q9K2N4iqOdeP;
Sun, 1 Nov 2026 01:53:48 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-354163-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 B8AB8112025; Sun, 1 Nov 2026 01:53:34 +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 35FD12B532; Sat, 31 Oct 2026 22:52:26 +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=1793487143;
b=NkDDFSk5vREhTbYkqdKPc+fLZjDBfo4S5eiKnLC2FTtNruHQvuHSWWpTWADCcBSbV1nr
95MbhCHPdTfVzeRxM2IcWDuHzDsL40/U7K9ta4duK0w5F03QMN1KaN8utIYz4fNIukBcg
5sW6rCuKAENchPmCjOsQHmBCH394yLqslvHfVI5e8xE6OKq4oSeQIqZegI8Q74D+4UTZR
+c4eL3FaJs5iS5QKmJs3l/ssSOuukL+1yV7VQb5VLpXNLjxzkFbYiyG6Y4R4oYeZ4dHjQ
XQqukckGVV1nZuqJiA+B/xFaN0yXEZruN/13L7LYNniAnmzOwTuGWEA5rIFKvQXG4+w==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793487143;
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=lY5rZikPuT99XWMY8+HAaXAbjrVFlbn2PfEKSg7534A=;
b=Ashe8dTNQa71MID6KgA9CDpNe1LV/RuMZDQUCLVJRiJAKrk174tFjINbk9UB9QwE7eNJ
Cy3Bupc5/W6rbXfCZooF+8jco0PNItTxptyX2jtP8bhue9b/57QtK6r6ZAakBHqV6NFkf
c2Pfa6+lXCC3Crea4rKUMc73jVEdXAuR5jVFpnD7bAncFhJgADNzb2g4uDkw0uQ+CPab7
7rwPqNnEbrKcC+e7ITigYcxNpB+39/2tr33aJhju4b3sG18+oC9+Y1ni7wCO23krCbray
jFMvyfMHYeFO6MjDgtwO5OXBNTA7KTY7gpUtVZTTIowYG5znOOuR80VKUyx3lCr4slA==
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="wk/kgJ5L";
dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=rsa-sha256 header.s=rsa201904 header.b=QQf0V8tn;
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 AB87A60A261F;
Sat, 31 Oct 2026 22:52:23 +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=wk/kgJ5L;
dkim=pass (2048-bit key, unprotected) header.d=uniroma2.it header.i=@uniroma2.it header.a=rsa-sha256 header.s=rsa201904 header.b=QQf0V8tn
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=1793487142;
b=d2kMmZWeK2YT630b3gGAVayZljrBFY7mTXZFgfhRns2GSyZYa6zljlJbH1zRdZ0RmkCg
EhKs4K192IANp4QEjlaA8G+zN1ypGlnrNYb+IaSCmfNT+baLDkKYLLAPIMA+hbYJnUJDo
CoeU2Yel6iSlEsFefOn+pzII6MIXokMm+v8xx9GRsqIU8ATjqZWHxDUu8Q8VJqv/TNaab
C9R5OdteAwGcw7EIduravbkMmvqgDFkJVaKoQG2mPHdiZaZJmGnwLX1n5FghM+pcn2XRA
SuN9vhrDea4KFZwqUEVz4zrbqNrNyeVkghhg+DXLRau8ApSDM9hDsPYSQpSLi34MEsw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793487142;
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=lY5rZikPuT99XWMY8+HAaXAbjrVFlbn2PfEKSg7534A=;
b=uvG6j5fBuqqRhvb3yQyUONpiRY0zaDiIWfqEO4RpmHOARe7QlBMXhOSWzn2/36XyEVyu
CIHcn01XL9KthY4ICGd0QS5M13CC2ThhpWySJvpynro5w75YJeis1cyk7nC8xL4tz3vEZ
vazC1DTb+CxXacJ91SnvVzioj+JNi44JNMaE22/r4Jicfy8rrVxvKQ2L67wSZXAirF57V
M950+ASZOrCWaI7iFltGtw7rhdHvMVRPY1MDk4QRfu4OM2Sri37MDSrR0Je7yGXzvglPY
J2XgBC3gj/Do94OKFpOqYOfAI/wIWCgQCzmy502AfW2retfmpjUnFoaZhNaNJj5T22Q==
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="wk/kgJ5L";
dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=rsa-sha256 header.s=rsa201904 header.b=QQf0V8tn;
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 33B48606A320;
Sat, 31 Oct 2026 22:52:20 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 33B48606A320
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.uniroma2.it [160.80.5.46])
by smtp-2015.uniroma2.it (8.14.4/8.14.4/Debian-8) with ESMTP id 69VMpGEY021943;
Sat, 31 Oct 2026 23:51:21 +0100
X-Received: from localhost.localdomain (unknown [160.80.105.87])
by smtpauth-2019-1.uniroma2.it (Postfix) with ESMTPSA id BFEE5122930;
Sat, 31 Oct 2026 23:51:11 +0100 (CET)
X-DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=uniroma2.it;
s=ed201904; t=1793487071; 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=lY5rZikPuT99XWMY8+HAaXAbjrVFlbn2PfEKSg7534A=;
b=wk/kgJ5Lfa99YS1CGkBrbF29C18xo0epH2XHFb4Z0kWP6JNVUNpyPziqYWTpjqVGqEmPsF
XEn1tK4JshccOKAQ==
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uniroma2.it; s=rsa201904;
t=1793487071; 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=lY5rZikPuT99XWMY8+HAaXAbjrVFlbn2PfEKSg7534A=;
b=QQf0V8tn4PqQ89cc/HfsFAOC69VKLW3naWTIqTX+kKmQbMQFwqtu/G5WDluI0inSxrnUHx
fStit+e4IhTu0xa3xTyXw970AHOLO0jZ/UUgZn0K8/YvL7Y42nuNEv3vw0C0F74XSYd7Sr
8IkPwOFFbDf0jJR0KgSw6nAnPkaCEwmOTkQ8N7Oo8+SgZkJ0x6iNZSZvw/3LVNvx1bEG0D
nzsxujt4wORkoMnWq7xmicz5GygJFL54droOyOS6siUJp8dKXIf/MvD6kaEmpIbKyh+g/M
zZ3AWXphEq2CUBWjKetmtZU76vbAUtnm5xnRVmnJNAHDsBBotK9Ij0VyrcbEvQ==
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