Article View: linux.kernel.netdev
Article #2001[PATCH net-next 1/5] seg6: handle a Fragment or AH header before the SRH consistently in PSP
From: Andrea Mayer
Date: Sun, 11 Oct 2026 19:23
Date: Sun, 11 Oct 2026 19:23
71 lines
9760 bytes
9760 bytes
seg6_pop_srh() already fails when a Fragment or AH header comes before
the SRH with other headers in between, and the packet is dropped ("we
expect SRH before FRAG and AUTH" in the code). But when the SRH directly
follows the Fragment or AH header, it is removed:
(a) IPv6 | FRAG/AH | DOPT | SRH | ... the packet is dropped
(b) IPv6 | FRAG/AH | SRH | ... the SRH is removed
In both packets the Fragment or AH header comes before the SRH.
Align the two cases: check first whether a header is a Fragment or AH
header, and only then look at its Next Header field. In this way, the
packet is dropped also when the Fragment or AH header comes directly
before the SRH. A Fragment or AH header before the SRH, with or without
other headers in between, does not follow RFC 8200 and RFC 4302: a
Fragment header must not come before the Routing header, as the
Per-Fragment headers must include the Routing header [1], and AH should
not come before the routing and fragmentation headers [2].
At the penultimate segment, End with the PSP flavor alone today drops
(a) and forwards (b) with the SRH removed. Packets with the Fragment or
AH header after the SRH are not affected: seg6_pop_srh() does not look
at the headers after the SRH.
Found by manual code inspection and reproduced in a VM without kernel
changes or error injection, by sending to End with PSP the packets
shown in the diagram, both with a Fragment header and with AH. With this
change, the packets are dropped in both cases, all tests in
srv6_end_flavors_test.sh pass, and KASAN reports no error. With the
whole series, all the srv6_*.sh selftests pass.
[1] - https://datatracker.ietf.org/doc/html/rfc8200#section-4.5
[2] - https://datatracker.ietf.org/doc/html/rfc4302#section-3.1.1
Fixes: bdf3c0b9c10b ("seg6: add PSP flavor support for SRv6 End behavior")
Signed-off-by: Andrea Mayer <andrea.mayer@uniroma2.it>
---
net/ipv6/seg6_local.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c
index 0c3d1be7f129..da8225591fe3 100644
--- a/net/ipv6/seg6_local.c
+++ b/net/ipv6/seg6_local.c
@@ -796,11 +796,6 @@ static bool seg6_pop_srh(struct sk_buff *skb, int srhoff)
if (unlikely(!hp))
return false;
- if (hp->nexthdr == NEXTHDR_ROUTING) {
- hp->nexthdr = srh_nexthdr;
- break;
- }
-
switch (nexthdr) {
case NEXTHDR_FRAGMENT:
fallthrough;
@@ -812,6 +807,11 @@ static bool seg6_pop_srh(struct sk_buff *skb, int srhoff)
break;
}
+ if (hp->nexthdr == NEXTHDR_ROUTING) {
+ hp->nexthdr = srh_nexthdr;
+ break;
+ }
+
nexthdr = hp->nexthdr;
}
}
--
2.43.0
Technical Details
Message-ID:
<20261011192310.55-2-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-344587-linux-kernel-netdev=dewy.ruReferences:
<20261011192310.55-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-344587-linux-kernel-netdev=dewy.ru
From: andrea.mayer@uniroma2.it (Andrea Mayer)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next 1/5] seg6: handle a Fragment or AH header before the SRH consistently in PSP
Date: Sun, 11 Oct 2026 21:23:06 +0200
Organization: Usenet Network
Message-ID: <20261011192310.55-2-andrea.mayer@uniroma2.it>
References: <20261011192310.55-1-andrea.mayer@uniroma2.it>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="1603322"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:w8hzSZIJNTbuy0uuaVKFjYuldvo= sha256:xCRHNbj/+j1/1CCjcu4CtSQmMic9njUqnPBb7FAkD/U=
sha1:gtY3Befm5mbE5MVz+pieHniCq2I= sha256:SaZfQLbiQgB0yy8qebltLgJ0uKAcH5JWIkre7GYJzh8=
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 492FB10FA57; Sun, 11 Oct 2026 22:25:30 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -0.75
X-Spam-Status: No, score=-0.75 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
URIBL_BLOCKED=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=FdUinSsU; dkim=pass (2048-bit key)
header.d=uniroma2.it header.b=bXrTWA4n
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 pAiRt4z_RTAG;
Sun, 11 Oct 2026 22:25: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-344587-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 97DBB10FA16; Sun, 11 Oct 2026 22:25:23 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
by sea.lore.kernel.org (Postfix) with ESMTP id 403FE2C74D; Sun, 11 Oct 2026 19:24:29 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 17E49457E74;
Sun, 11 Oct 2026 19:24:27 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=permerror (0-bit key) header.d=uniroma2.it header.i=@uniroma2.it header.b="FdUinSsU";
dkim=pass (2048-bit key) header.d=uniroma2.it header.i=@uniroma2.it header.b="bXrTWA4n"
X-Received: from smtp.uniroma2.it (smtp-2015.uniroma2.it [160.80.4.37])
by smtp.subspace.kernel.org (Postfix) with ESMTP id AFA3E26656D;
Sun, 11 Oct 2026 19:24:22 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=160.80.4.37
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1791746667; cv=none; b=ea/3vy/d5B+Puk5nh6MFZO1vvZBGxcSEG3tNiIZd1hz/TuC3xeOlkE+C77s4GmFlryboAiLxocqwaAkP9FoI9tY22UDDizVd6D/g+FoB3UKG8SXhWBOrjoSBhyW4xknvpLacUe42oIHFhGR0PA51WRxqSo/toZWYzccZed0dupQ=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1791746667; c=relaxed/simple;
bh=QwOM6hFMt4hkwQeemfy+63vYTFj8AuI6bmv+YuyF/Jw=;
h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:
MIME-Version; b=k8j6y1CcEnICixkSthruwf8mY4lqjiotR3yTbod+9BlM8P3clZccL6YCWTdKbTE7ZmGeubd0ofQRonx5TGaDUPnq9WZ6zKv4NtXP+unDCnc7v3hIpOUNLd9qEA2gCwGbARAhhIjaFtiqqfUyf1vwF27UgqfHiUIAVDVVXZrCqN4=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uniroma2.it; spf=pass smtp.mailfrom=uniroma2.it; dkim=permerror (0-bit key) header.d=uniroma2.it header.i=@uniroma2.it header.b=FdUinSsU; dkim=pass (2048-bit key) header.d=uniroma2.it header.i=@uniroma2.it header.b=bXrTWA4n; arc=none smtp.client-ip=160.80.4.37
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 69BJNbSX010946;
Sun, 11 Oct 2026 21:23:42 +0200
X-Received: from localhost.localdomain (unknown [160.80.105.87])
by smtpauth-2019-1.uniroma2.it (Postfix) with ESMTPSA id AA5621228D8;
Sun, 11 Oct 2026 21:23:32 +0200 (CEST)
X-DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=uniroma2.it;
s=ed201904; t=1791746612; 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=JBKsRlvMdblf5D1683fF488/D5zTQsvt3iQZRP+rwxw=;
b=FdUinSsU4LxC7PX9sNho/+xqepny4rpwCJmdFOngY9/NXmpivC4La+UgDRDpyT1PSJf+V8
jlWFb3/sonAvZcCw==
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uniroma2.it; s=rsa201904;
t=1791746612; 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=JBKsRlvMdblf5D1683fF488/D5zTQsvt3iQZRP+rwxw=;
b=bXrTWA4nOwBBMl9M9P83TrXNLpLOTM02GIBm6QroFygxI2LzIEfB4pO0OKoUQN2CAmsfPY
RDWw4MAXOjgt+48Zpqzy7EEvXQB/hPCaexJDrQbg9zY73hiWWT4WvBJMsbhqcbt0nOaxfJ
H8dOIShMCETF23jydd6jgzxYqoCPRBlumzLmMNZFtP807hj8b62BPvk9ZODe203S3s9BGx
3Sagne8aTUb4jCk5YfZjHyUYNIAALOuZDycCOTFdcv1C3noVlUuQW3qYbiO/HIZi3ZItA+
YmSfShWtSCGE5iXbNanfUwRBn5h4P4yOkA8En/Bf6F6LB/WClqyJ4ef4oP1U4Q==
X-Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, Shuah Khan <shuah@kernel.org>,
Hangbin Liu <hangbin.liu@linux.dev>,
Justin Iurman <justin.iurman@gmail.com>,
Nicolas Dichtel <nicolas.dichtel@6wind.com>,
Ahmed Abdelsalam <ahabdels@cisco.com>,
Stefano Salsano <stefano.salsano@uniroma2.it>,
Andrea Mayer <andrea.mayer@uniroma2.it>
X-Mailer: git-send-email 2.39.5
X-In-Reply-To: <20261011192310.55-1-andrea.mayer@uniroma2.it>
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-Virus-Scanned: clamav-milter 0.100.0 at smtp-2015
X-Virus-Status: Clean