Article View: linux.kernel.netdev
Article #12627Re: [PATCH net v2 1/2] xfrm: fix IPv6 first-fragment protocol decode
From: netdev-bot+sashiko
Date: Sun, 08 Nov 2026 02:11
Date: Sun, 08 Nov 2026 02:11
103 lines
11533 bytes
11533 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The commit message describes the bug only as an IPv6 atomic
fragment followed by extension headers that is mis-classified on theβ¦
--
xfrm: fix IPv6 first-fragment protocol decode
This commit makes __xfrm_decode_session() pass
FLOW_DISSECTOR_F_PARSE_1ST_FRAG to the flow dissector for IPv6. With that
flag, first fragments are walked through to the upper-layer protocol. It
also keeps the port, ICMPv6 and GRE selector fields in decode_session6()
zero for all fragments.
> diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
> index cea6842e6454d..4f6a5b81e3b5a 100644
> --- a/net/xfrm/xfrm_policy.c
> +++ b/net/xfrm/xfrm_policy.c
[ ... ]
> @@ -3511,10 +3517,13 @@ int __xfrm_decode_session(struct net *net, struct sk_buff *skb, struct flowi *fl
> unsigned int family, int reverse)
> {
> struct xfrm_flow_keys flkeys;
> + unsigned int flags = FLOW_DISSECTOR_F_STOP_AT_ENCAP;
>
> memset(&flkeys, 0, sizeof(flkeys));
> + if (family == AF_INET6)
> + flags |= FLOW_DISSECTOR_F_PARSE_1ST_FRAG;
> __skb_flow_dissect(net, skb, &xfrm_session_dissector, &flkeys,
> - NULL, 0, 0, 0, FLOW_DISSECTOR_F_STOP_AT_ENCAP);
> + NULL, 0, 0, 0, flags);
[Severity: Low]
This isn't a bug, but does the commit message describe a narrower scope
than the code change? The message says:
For an atomic fragment followed by extension headers, inbound policy
lookup can therefore see the header after Fragment instead of the
actual upper-layer protocol and miss protocol selectors.
The flag is set for every AF_INET6 decode. That means the change covers
all IPv6 first fragments (offset 0, with or without MF) in every policy
direction, not only inbound atomic fragments.
On a router without nf_defrag_ipv6, fragments reach ip6_forward() without
being reassembled. Both of these lookups go through
__xfrm_decode_session():
ip6_forward()
xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)
xfrm6_route_forward(skb)
A non-atomic first fragment is now classified by its real L4 protocol
(for example UDP). Non-first fragments still stop early in
__skb_flow_dissect():
net/core/flow_dissector.c:__skb_flow_dissect() {
...
case NEXTHDR_FRAGMENT: {
...
ip_proto = fh->nexthdr;
if (!(fh->frag_off & htons(IP6_OFFSET))) {
key_control->flags |= FLOW_DIS_FIRST_FRAG;
if (flags & FLOW_DISSECTOR_F_PARSE_1ST_FRAG) {
fdret = FLOW_DISSECT_RET_IPPROTO_AGAIN;
break;
}
}
fdret = FLOW_DISSECT_RET_OUT_GOOD;
...
}
So the first fragment of a forwarded datagram can now be matched against
FWD and OUT policies with a different protocol than its later fragments.
With a destination options header after Fragment, the first fragment
uses 17 and the later ones use 60. Before this patch, all of them used
60.
This is close to how the decoder behaved before 7a0207094f1b, so it is
not a functional regression. Could the commit message mention the
forward path and non-atomic first fragments? Stable backporters with
protocol-specific tunnel or required policies on gateways will see a
change in how forwarded fragmented traffic is handled.
Could the message also say plainly that missing protocol selectors means
plaintext traffic can bypass IPsec enforcement when the default policy
accepts?
The following patch, "xfrm: fix selector matching for IPv6 atomic
fragments", does not change this.
--
Sashiko AI review Β· https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261103225842.3204446-2-Jeremy.Jean%40oss.cyber.gouv.fr
Technical Details
Message-ID:
<179410387761.994134.6172658851496311106@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-358576-linux-kernel-netdev=dewy.ruReferences:
<20261103225842.3204446-3-Jeremy.Jean@oss.cyber.gouv.fr>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-358576-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v2 1/2] xfrm: fix IPv6 first-fragment protocol decode Date: Sun, 08 Nov 2026 02:11:17 +0000 Organization: Usenet Network Message-ID: <179410387761.994134.6172658851496311106@kernel.org> References: <20261103225842.3204446-3-Jeremy.Jean@oss.cyber.gouv.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="45205"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:wMZsB1htrEW6nON61hoRmKq68oA= sha256:aFbTxeqqWRwIf/XDc+rAE6S4MPEZPDGK8q4fEH6B5hE= sha1:NLBDbzaL3l0sOPe+F5OzheNvsyg= sha256:QvW3YaUiLxCV78sSPoN7R8IqJumLAYxfZXV67ghRHQY= 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 66F42113502; Sun, 8 Nov 2026 05:12:16 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, 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=pass (2048-bit key) header.d=kernel.org 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 uR_Mp-qE38ZJ; Sun, 8 Nov 2026 05:12:12 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-358576-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 28159113391; Sun, 8 Nov 2026 05:12:04 +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 03A9B3F6FE; Sun, 8 Nov 2026 02:11:36 +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=1794103895; b=2DKKiZTTLKjgyqu1J3sCHphFrZevGJcc42nRE5VERtHXatm/vFRLdLLprquUqeEfg0eg 1RIgYYfhsb56fYtH3LDxhtrfT7/CuRuohv/Dlws3PdLBCPJpdZMknABXqDJd+cBCYlfik B9vmDcnbrjb2xk0e/6Ej9vXEoWl8K1jcX9Y61kxlnqbK8+Of8bLLIDiZZX/kCBmPSq47E Rdrq2ZFjArHop/pBL0I2jF7ooS8WA1gUVv5y0pmp+2hLbx2uZ2ZSpyUdA13oiNP6WmGF7 1/acqd1+BNnxjfYSyQXsJhY8mlXThZlQbMBhErnsgmxMPmGU6YXXjn5sCT1vMrIbgYg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794103895; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=mo/Ifisr6uF13jyRhb7Rytvceb6bZ3F1oSnHvoqB9LY=; b=d204UcIKprnG3efvFfTrHC+rbK4RBoTRnJnzUWW3r7w7k+hpcz2p5Np1oSiL/wjWqDJa wnbgSHUU0jzzK1FqbMtrFRmZIT19i+o8iSghqu4a49z0otGIQf2KPKsJgT6TxY9DVNWgq 898wOFIa454VLhqRQX507n+B7MDkEjbTDENiEr0N/gFRPcsNaYViWIVmWsojs97FBl4sh SZWcwpse0hO1ch37tOTuK7rMao8XlYx/X3a/kvDVYATUl1u21558/x3PIe4ZndOIeHJTI 7UL9TmQqzJvR8XR550gvNWbJXcIS27LiseDFAmBge7IKCATtuCrdk+AAcU6iPN3+CfQ== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DoB3E8wr; 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 CEE92606A323; Sun, 8 Nov 2026 02:11:35 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DoB3E8wr X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794103879; b=DuPYKntAt0DaqFQ6sIS/Vw6Avvm8Kbq6OJnF2Tik9MlM9D6LaLy2n4QSWc+Wp2Go52IJ Ov6cCUhfp0v7r+T+ZHUNiWfo+0IPVdl6fCWDBm/dvD51MjRrR7nHi7ghfnOHtL/j34Tbi 7nm2Aea9JV3pXdjSyDhUaMeBIYWN2PykQjK24g/H6K4IIMGU/rFT2BnaCXT0PDLKfqOhZ 0mYb+6K5raQ9gYvLE5Kh87d3GUD4T8M2J1LaaOUFhNd2QO0TaEC4CWscMfL4bIDL0ah+a QNMhdFCZ2A3DMRAXF4bZoDoZQeINzqDcXmnJDrxP7Vm5XPqka0k2iHRWqrEVldpUE5w== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794103879; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=mo/Ifisr6uF13jyRhb7Rytvceb6bZ3F1oSnHvoqB9LY=; b=4hncIeP35PDZNsHVhl9Oe55N8gRAzSpH9o8FiQ1OKVrHicNgQkPbxmztzHbg6cfj3u86 l+PBE+0OU/su8w379kI+k6o9WdvPlXjHIwq3xcqt7iHrDmBl96E62hwsQNYtPujAMSpGD OLGD8ZFLiU5XzgM6FPpucYL0x6Tdohn3aGZUijO+VrYrrhYLtaqaixlOQA9Kddp8/Y5hk sYCUUaWfsAciPI0BkI2WWQkBgylTnz0SgrG3y1JwtJ1UKLRuTLggFOa3QPSXYtiDiDVv3 UIcijC1rJU+pyBrQBysm/5REassHJrgIjaTTNYqM8ZiyZdsE+39L6bTsMii+sP8RJLw== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DoB3E8wr; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E96CA606A31C; Sun, 8 Nov 2026 02:11:18 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 154651F0089F; Sun, 8 Nov 2026 02:11:18 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794103878; bh=mo/Ifisr6uF13jyRhb7Rytvceb6bZ3F1oSnHvoqB9LY=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=DoB3E8wrWqNr+Z/dTJDg0FRgdJNgxXTKfwYt2uKSppCvWIyo4TY2TLqdwLAV9Fqp9 H+NJm67lqgjDRWjeGriben+oOuj0tnTySkxDr0NguxJvJqkeE+sAbirkjCPTGWy4Lx YgWKgxNb1LnhI5jrsfTkzsdM+G11Kc91Yc3b+PHG17KVSWfsFyD5z7B4tBMta5rAMP 1eWAh3SK7ylhZLYWkaDxw4TCvo4nRE0m1BJBU3nL0IAL/Dre+I55KV1/unXQ0HUBlG I6OGxn1u5ItJwBWbPoHUuPCtMw0c2c5cKSz/6PKnhPFepTx4kDSPxZn9j1mt15tZ8B 6V+yVMzn5RjyQ== X-Cc: steffen.klassert@secunet.com, herbert@gondor.apana.org.au, davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, kuba@kernel.org X-In-Reply-To: <20261103225842.3204446-3-Jeremy.Jean@oss.cyber.gouv.fr> X-sashiko-severity: Low 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