Article View: linux.kernel.netdev
Article #22624Re: [PATCH net v3 1/2] net: keep the TCP fixed-ID flags on the header they describe
From: netdev-bot+sashiko
Date: Wed, 25 Nov 2026 15:27
Date: Wed, 25 Nov 2026 15:27
145 lines
14127 bytes
14127 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 (1) · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] In xfrm_output(), the new FIXEDID->OUTER copy only runs for
TRANSPORT/BEET mode, but skb->encapsulation = 1 is set for every…
Pre-existing issues:
- [Medium] tcp6_gro_complete() (net/ipv6/tcpv6_offload.c:81-102) ignores
NAPI_GRO_CB(skb)->ip_fixedid.
--
net: keep the TCP fixed-ID flags on the header they describe
This patch goes back to SKB_GSO_TCP_FIXEDID describing the innermost IPv4
header. It replaces SKB_GSO_TCP_FIXEDID_INNER with
SKB_GSO_TCP_FIXEDID_OUTER for the outermost header of an encapsulated
packet. The outer flag is cleared where tunnel and BPF paths add or remove
a header, xfrm_output() sets it for ESP transport and BEET offload, and the
mlx5 and sfc drivers are converted.
> diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c
> index b84fcd07c7230..da0d8ba70c0cc 100644
> --- a/net/ipv4/tcp_offload.c
> +++ b/net/ipv4/tcp_offload.c
[ ... ]
> @@ -473,9 +475,10 @@ INDIRECT_CALLABLE_SCOPE int tcp4_gro_complete(struct sk_buff *skb, int thoff)
> th->check = ~tcp_v4_check(skb->len - thoff, iph->saddr,
> iph->daddr, 0);
>
> - BUILD_BUG_ON(SKB_GSO_TCP_FIXEDID << 1 != SKB_GSO_TCP_FIXEDID_INNER);
> + /* Bit 0 of ip_fixedid is the outermost header, bit 1 the inner one. */
> skb_shinfo(skb)->gso_type |= SKB_GSO_TCPV4 |
> - (NAPI_GRO_CB(skb)->ip_fixedid * SKB_GSO_TCP_FIXEDID);
> + (((fixedid >> encap) & 1) * SKB_GSO_TCP_FIXEDID) |
> + ((fixedid & encap) * SKB_GSO_TCP_FIXEDID_OUTER);
[Severity: Medium]
This is a pre-existing issue and this patch did not introduce it. Does the
IPv6 counterpart need the same mapping?
Take an IPv4 outer header over an IPv6 inner TCP flow, such as 6in4/SIT or
VXLAN over IPv4 carrying IPv6. For the outer IPv4 header,
gro_receive_network_flush() calls inet_gro_flush() with inner=false, which
records:
include/net/gro.h:inet_gro_flush() {
...
NAPI_GRO_CB(p)->ip_fixedid |= 1 << inner;
...
}
The flow is then merged as fixed-ID. tcp4_gro_complete() now maps that bit
to SKB_GSO_TCP_FIXEDID_OUTER, but tcp6_gro_complete() never looks at
ip_fixedid:
net/ipv6/tcpv6_offload.c:tcp6_gro_complete() {
...
th->check = ~tcp_v6_check(skb->len - thoff, &iph->saddr,
&iph->daddr, 0);
skb_shinfo(skb)->gso_type |= SKB_GSO_TCPV6;
...
}
So the outermost IPv4 header of such a packet never gets
SKB_GSO_TCP_FIXEDID_OUTER. When the packet is forwarded and resegmented,
inet_gso_segment() rewrites the fixed outer IDs as incrementing ones.
Should tcp6_gro_complete() set SKB_GSO_TCP_FIXEDID_OUTER from bit 0 when
skb->encapsulation is set?
>
> tcp_gro_complete(skb);
> return 0;
> diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
> index f1f612cd7b438..927e1535c47d7 100644
> --- a/net/xfrm/xfrm_output.c
> +++ b/net/xfrm/xfrm_output.c
> @@ -805,6 +805,16 @@ int xfrm_output(struct sock *sk, struct sk_buff *skb)
> xfrm_state_hold(x);
>
> xfrm_get_inner_ipproto(skb, x);
> + /*
> + * Transport and BEET mode keep the IPv4 header and its ID, so
> + * the header that SKB_GSO_TCP_FIXEDID describes is the outer
> + * one as well.
> + */
> + if (!skb->encapsulation &&
> + (x->props.mode == XFRM_MODE_TRANSPORT ||
> + x->props.mode == XFRM_MODE_BEET) &&
> + (skb_shinfo(skb)->gso_type & SKB_GSO_TCP_FIXEDID))
> + skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_FIXEDID_OUTER;
> skb->encapsulation = 1;
>
> if (skb_is_gso(skb)) {
[Severity: Medium]
Can a tunnel mode SA still lose the fixed IDs of the packet's only IPv4
header?
skb->encapsulation = 1 is set for every crypto offloaded SA, but the copy
to SKB_GSO_TCP_FIXEDID_OUTER is skipped for tunnel mode.
A GSO packet that was decapsulated earlier keeps a stale non-zero
skb->inner_protocol. inet_gro_complete() sets it for encapsulated GRO, and
neither iptunnel_pull_offloads() nor skb_scrub_packet() resets it. After
decap, such a packet has encapsulation=0 and SKB_GSO_TCP_FIXEDID set, and
SKB_GSO_TCP_FIXEDID_OUTER has been cleared.
If the packet is forwarded into a tunnel mode SA with offload, this check
just below fires:
if (skb->inner_protocol && x->props.mode == XFRM_MODE_TUNNEL)
return xfrm_output_gso(net, sk, skb);
Then xfrm_output_gso()->skb_gso_segment(skb, 0)->inet_gso_segment() runs at
encap_level 0, sees skb->encapsulation == 1, and takes the new else branch:
} else {
fixedid = !!(skb_shinfo(skb)->gso_type &
SKB_GSO_TCP_FIXEDID_OUTER);
}
That reads 0 for the only IPv4 header, even though SKB_GSO_TCP_FIXEDID is
the flag that describes it. The segments get incrementing IDs although GRO
recorded fixed ones.
The baseline code was also wrong here, because it read the stale flag of
the removed header. Is this a remaining variant of the "forwarded into an
ESP tunnel mode SA with crypto offload" case that the commit message says
is fixed?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1795284858.git.julius%40bairaktaris.de
Technical Details
Message-ID:
<179562047069.3135.2008249679354171410@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.endofthelinebbs.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371477-linux-kernel-netdev=dewy.ruReferences:
<7c74b2076dc7dee1d481d39a135e0946d5e04145.1795284858.git.julius@bairaktaris.de>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.endofthelinebbs.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371477-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v3 1/2] net: keep the TCP fixed-ID flags on the header they describe Date: Wed, 25 Nov 2026 15:27:50 +0000 Organization: Usenet Network Message-ID: <179562047069.3135.2008249679354171410@kernel.org> References: <7c74b2076dc7dee1d481d39a135e0946d5e04145.1795284858.git.julius@bairaktaris.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="241522"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:mdo8Aj02zXESlCiZP6vte40ot+k= sha256:fnMhihpJuALAv+Bifc4yPoelKYkJLYx62kwhUcC+RBY= sha1:v5hpkxunEF+MRKbWPA4wiwhS9H8= sha256:5LiUkO/WGIgPiGvTWCWM9ndJ7wYIp0Z6oICzzpZVPaQ= 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 23741125E7B; Wed, 25 Nov 2026 18:28:21 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.501 X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31 tests=[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] 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 HLAIoC3I4JSN; Wed, 25 Nov 2026 18:28:17 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-371477-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 29433125E7A; Wed, 25 Nov 2026 18:28:08 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 2B2663AA4A; Wed, 25 Nov 2026 15:28:07 +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=1795620484; b=nd/9Q4CrTEinePeosHtHnzAZOa3InMl9I5G4DmTZWMVEzMi7Om1BpnjWlhfEARMPQJFo v6fQ6lGDez++PEkbH39aVwMHpwdoiR0HJU7XE3YGPtSB8v+9nF+IjAEssECLRIKmd3VU0 zXCt4ztiNXzbpwioQoUM/jNUfl9YoQ7yoGQ6DusneGaM3ro71U1zevzfZJAqylWxLHMSU rUgdbeDha8eHF+C7Qf5RVd0WMJtsYclQ4ag6kRXvm9m3Jwqeox7dr1GxnlhLnmNRh1jPV YPiRz+H9OpasFazzEtuOeCdu0WnMLgJ00w6mKmEeDl2RG2yvIeFkDXF2VLHEpfHeWxQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795620484; 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=TQMJOKB5egHcGgynmGG4EwUuLrxBDUpZJMqON6XcyvA=; b=kRAYqbpUH2Fo7LoHkyI6K7YUXxenzD64GI+ki6GjnD/t0HhLjnx5+iAexVvMijmZ+a4+ ktLcdwqmuPPfmk2QjA+3fyLLaSM1zpVtjdKWoPvZBN1pNLoHSlq3dw5/eMGcorHzcwLC3 1TRXDXAbTP4R1ePIORDKdFpRgTdbtsiGxbcyJlNqNMX9tgSX7svNYoAx2YDsW3L+O5JTS 0hYv7BzTKjXGMxgZLbxmEfpsXR+V4vN8C/HLIbyrKQGRXYi7wZa8CJVQ9kaNeTZChaBdD fAEh3MIzR86YMluOIMOQB01JZTOoedCJOQesuJjfIwI0IsUtNHHvJcX4E6/4CoRNR2Q== 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=ijdrdMAR; 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 9EAD8606A321; Wed, 25 Nov 2026 15:28:04 +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=ijdrdMAR 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=1795620473; b=W+Lx2MuN5uQHJLmvFRgVY9J6g0QjiIBoVAycQzemh0aZP6dvf1DHfOXRAAwz1m0LUupV LenbzJk0FSNLBJ5CZtYgvXtE5XltEwMYXQeYdd/fC+9Tga1YNwDgM0hNM2rhQ8tcYN2yc v67roxtm/Oxz16TPoVSRRFn1iauE3COrdI1knb5UCtYGvefFLajHub9GW3/o8MmbsNUgf MKQJskXeQyWC8ZJdqHML+ixC5VOkF5pVSaktJnoS9R/r2kD7AIGDkfnow5VssjY/0WQoI 27WMkSG0Wu/gfZUP/Ld7/ifEjrt7ltpDgfxqSKaqbKZJpb5VAJl2Q3/TmqyZq1OjuRw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795620473; 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=TQMJOKB5egHcGgynmGG4EwUuLrxBDUpZJMqON6XcyvA=; b=IJw3WNArco4bptSiq5jLsedLU/q6LH7m+Isi0o6csT+e7jwcxdReZY1DYHK9kaQjR5cD S893zhRgEPJCsG8FTrwJ7AhjiMusS48Lve3Q+IQgdUZ/bZFGz4sgA2b+FQUfS3/sTuKes zVf4pQMUWOQ7XqVnnremNKVpDCUGbibxwQLXiCQ9MhqwLmN/XVgwYjED8vREGXB7TVmDU yXP3+FBLYvTgxHpYC/i/hcHjbWhczR4FOvm//Awo7SmGpTsgs3IA5TZN9s75y+Xg9663I qULdHmjfDtjkofw+YxDkUJbmzhkbeIl0AByKQwEGboxl2fN5KLemF9EBmTDX7hbDj6w== 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=ijdrdMAR; 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 B82BD606A31E; Wed, 25 Nov 2026 15:27:53 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 291211F000C4; Wed, 25 Nov 2026 15:27:51 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795620473; bh=TQMJOKB5egHcGgynmGG4EwUuLrxBDUpZJMqON6XcyvA=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=ijdrdMARWt/P79rA/nv7dZGn4nIuZmRVHXrvsJd/KKUvyH/YKVN81Q21S58X0OyKn +VtdgAu4eTUaN/mnx2oB5zfHvyOVBMQobpiDswecyA98lyaMR4NvwDQajZp4W69MHg wJcqwbMRVkCQyyUaL89ECAwn0lPhtMpu/VIv5qpHvvzsU/JanDNGW6BHfG+zsXfge7 XHdQv5GB8N99m+2j6jWcE6tPZkhu46lBdN4FF9/Es1Cg66RdHuASowVOC6VOSyutRK jao7Qf5J7ineiK1N5YgrKcfUD9rw2ki9B01JwgCJNFG1Gq3eS6wn74jHr66eCxsAxd ZfutpYoiEGAkQ== X-Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, willemb@google.com, horms@kernel.org, andrew+netdev@lunn.ch, dsahern@kernel.org, idosch@nvidia.com, ncardwell@google.com, kuniyu@google.com, steffen.klassert@secunet.com, herbert@gondor.apana.org.au, richardbgobert@gmail.com, ecree.xilinx@gmail.com, andy.moreton@amd.com, alex.austin@amd.com, linux-net-drivers@amd.com, saeedm@nvidia.com, tariqt@nvidia.com, mbloch@nvidia.com, leon@kernel.org, linux-rdma@vger.kernel.org, alexei.starovoitov@gmail.com, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, eddyz87@gmail.com, memxor@gmail.com, martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev, jolsa@kernel.org, emil@etsalapatis.com, ihor.solodrai@linux.dev, john.fastabend@gmail.com, sdf@fomichev.me, izaiahsun@gmail.com, corbet@lwn.net, skhan@linuxfoundation.org, rdunlap@infradead.org, shuah@kernel.org, bpf@vger.kernel.org, ipsec@lists.linux.dev, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org X-In-Reply-To: <7c74b2076dc7dee1d481d39a135e0946d5e04145.1795284858.git.julius@bairaktaris.de> X-sashiko-severity: Medium 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