Article View: linux.kernel.netdev
Article #18595[PATCH net v2 2/6] seg6: update skb checksum when ipv6_srh_rcv() decrements the Hop Limit
From: Andrea Mayer
Date: Wed, 18 Nov 2026 15:02
Date: Wed, 18 Nov 2026 15:02
57 lines
11941 bytes
11941 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)")
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
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 ccc549de3c8a..b8dff6a0bbc4 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:
<20261118150251.65-3-andrea.mayer@uniroma2.it>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366227-linux-kernel-netdev=dewy.ruReferences:
<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!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366227-linux-kernel-netdev=dewy.ru From: andrea.mayer@uniroma2.it (Andrea Mayer) Newsgroups: linux.kernel.netdev Subject: [PATCH net v2 2/6] seg6: update skb checksum when ipv6_srh_rcv() decrements the Hop Limit Date: Wed, 18 Nov 2026 16:02:47 +0100 Organization: Usenet Network Message-ID: <20261118150251.65-3-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="2625529"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:iPNliLqQt2lpaPin7sAf/LzV/UE= sha256:VZcV7vHiS1cxH6DnrqPfSrK4GSEvyiGoA67NBcM+6uQ= sha1:YYXRpGD7PG4m3pQ4xzwAMyv5fHg= sha256:iCpaVnaeXajOpunz6VgFmEg4B8kxDLwxMfGRltpp0Oc= 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 0CEF51152F6; Wed, 18 Nov 2026 18:10:01 +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=AUekIQLc; dkim=pass (2048-bit key) header.d=uniroma2.it header.b=mf0AxqsC 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 i2NyJqtP8Jxe; Wed, 18 Nov 2026 18:09:49 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-366227-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 952D01152ED; Wed, 18 Nov 2026 18:09:36 +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 4386B3D8D3; Wed, 18 Nov 2026 15:08:29 +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=1795014508; b=bEJI7VLikgR3kunEuj/63fFPXa/UiRAMCpdD0Hnz/kQyvYoXQxPH8UWS9s88zSWMzipw JVvug4skHeFahS/3w5X9k3lR7t9rtXq5NjW4Bb73Ub1+fxLMqNe94+vcbRB55MkGCnCeN 0uHWyI/ZshbJd42aVQ5yyxwiKoc8/qMoz6PKzM/JdAUgbF7z0soYzvk/bO++FA10jf8/n 3dwpMJVmt0awpTnrrM7GPRvJTX/bZ3EyRO16SsMDBmPkPYp2zmmEzbH1VajHXtamEZlL7 xoAaIIwGKACjZg5ZuQH7OeNoFVr/0chBGjAoQ7ztKk11BEaZSKgbf91Zs2y6iBu/65A== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795014508; 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=aVn/ArHYS+F32rCgWBSVdfTDPd9m/hfMb2gLFN3Dy0E=; b=pwtJGYwmpdiRIDdgnbJSOqFfZ5Atm1nGjuBoCf3owX2OUsM6mulnRKfrA6JFCMz1bdhI 2Ol9HyJzpE3uzVwEhfGuBsARZeQkT26BdgcifnQ5NX+izz1P1omssM571518/lU9e7Jqc Fq+6oLuhhYpTBYRyM0efHjCpbSPtALfrJ/wf3ugEeFNjrNBNeWLHyVodGIOwfEg/8cek8 ++7JwQ4WfQpCleQN6aE5otaIV0BlC5m+sI6d4gvNbYTUgooTKL1U9AfoiJ2tnTXE2Y76T LsNO6Ki6peZU5E1S/tLb6Nt+nK8UF96xaGc9zZ6uhGDFQafiHQ0MrMR1kd1EaQBA7BA== 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=AUekIQLc; dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=rsa-sha256 header.s=rsa201904 header.b=mf0AxqsC; 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 716A560A2605; Wed, 18 Nov 2026 15:08:28 +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=AUekIQLc; dkim=pass (2048-bit key) header.d=uniroma2.it header.i=@uniroma2.it header.a=rsa-sha256 header.s=rsa201904 header.b=mf0AxqsC 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=1795014507; b=1hZ3YN0y3lxoP1Euchxs7pABYEnBT9ZOVLmwyDctVSGoeMoYyeDATZgaG7Df2Od98kTU Pli5q7x7a2fqd8oK7PBXoRJ9z8lVkHKt4MQXfES5QxgWnJARPdmK5DAwLb/88XjYRt6lT 7UZ7PA+4yusX25mMmtErGgXDTY9wUOjJPvhU5lBNq3Wqlxldt3ZiQXWRs5hB+vnzg/yyD GsoIrE4ibJpHsLrvZXqyqTOSiA2LN+4tztXJcGLsEpmqzWsD1zHse2ifVXuQXlrFh3D7D tp8BmhlFxw0pm1Z2AwFYudnMfQjA3dTSqXR9utUE8XBxcRvISMTxQ3o94Yygqwi4hYA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795014507; 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=aVn/ArHYS+F32rCgWBSVdfTDPd9m/hfMb2gLFN3Dy0E=; b=jKdWKLuS+MzKVUKxET0uxKC+lghjWTcVJdImmXiK5UI2ehAC4+EvWnLlQoGA/L2JZU9l //cTuxRlG66Sfubpn4HJ+Ce6EmQq50vL/8Gf0UVPddf8t24DUHtRinpBVMAYdK7qsmfTr lhEqffZnjBI1eWMtTIfdBbAhUj2V1tWQFfBpFQx5ihs1iOFIyKkMlW0fPtlm/hcZGJE+H HKDsAQGXWclRaIetioDPoyxgJECFIPFJnjy7xd27pX27J8LhAvA9fcRXVn3o+u1X0DIgs rZYiJV9cF/ow9fx6OD5MmoMZDf7unMo+0NzghV6ZsoMf5534X5heV+I5WzbbVqSZa/w== 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=AUekIQLc; dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=rsa-sha256 header.s=rsa201904 header.b=mf0AxqsC; 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 742BE606A32A; Wed, 18 Nov 2026 15:08:26 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 742BE606A32A 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 6AIF7XdA012189; 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 4DC55122956; 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=aVn/ArHYS+F32rCgWBSVdfTDPd9m/hfMb2gLFN3Dy0E=; b=AUekIQLcSJQNBuvoTpqHqmUhJ57RHKMvaRGPm4lCFsIc70ZFz/4zv24iBN8GE2p1IfREXU RKhf194+CQSIY9DQ== 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=aVn/ArHYS+F32rCgWBSVdfTDPd9m/hfMb2gLFN3Dy0E=; b=mf0AxqsCDB9mMSCbbr0uJd9NcqU4zfV7LyxoK70wR+lHtkp6OB7NFYNefKg7SsKMFicnFP g2aYZbc3+fUT+I8O4TpvUQtoS9CdnXQusz8Ie7753lNSmhDzWpc18y4PlWEchWwwNXRzRG BcSbLSVWlLBimhHnnb5HHFW3JYwzYr+GumrTe1xzEJSYLtKIj0C/R/zg3ml/1+zvTc8Yj1 T1XG5szs/iMp4pQ32phxGDaMZB0s5ANs9Ov6yco2U/SIS+QnHuWtTBVB63ACiGrBDw178N z/jkxz4CVbY+yQL0IPBehg2Mf65lg8/oa2GnBBWYhVxr7ivePPQAvhgFMkl14A== 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>, Hangbin Liu <liuhangbin@kylinos.cn> 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