Article View: linux.kernel.netdev
Article #16876Re: [PATCH net v5 2/4] net: gso: count the inner UDP header of encapsulated UDP GSO packets
From: netdev-bot+sashiko
Date: Mon, 16 Nov 2026 00:47
Date: Mon, 16 Nov 2026 00:47
107 lines
12382 bytes
12382 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · 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).
- [High] The new encapsulated SKB_GSO_UDP_L4 case in
skb_gso_transport_seglen() (net/core/gso.c) adds sizeof(struct udphdr)…
--
net: gso: count the inner UDP header of encapsulated UDP GSO packets
This commit changes skb_gso_transport_seglen() so that it adds
sizeof(struct udphdr) for encapsulated SKB_GSO_UDP_L4 packets, the same
way the unencapsulated branch does. Without it, each segment of a
tunnelled UDP GSO packet is counted 8 bytes short. As a result,
ip_forward() and ip_finish_output_gso() let DF segments that are slightly
too large leave without being fragmented.
> diff --git a/net/core/gso.c b/net/core/gso.c
> index b5bd269e56e4e..eb95c9d2819b1 100644
> --- a/net/core/gso.c
> +++ b/net/core/gso.c
> @@ -156,6 +156,8 @@ static unsigned int skb_gso_transport_seglen(const struct sk_buff *skb)
>
> if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)))
> thlen += inner_tcp_hdrlen(skb);
> + else if (shinfo->gso_type & SKB_GSO_UDP_L4)
> + thlen += sizeof(struct udphdr);
[Severity: High]
Does this cover encapsulated UDP GSO skbs that fraglist GRO builds?
The encapsulated branch computes its base as:
thlen = skb_inner_transport_header(skb) -
skb_transport_header(skb);
That only works if inner_transport_header has been set. On the UDP GRO
side, the only code that sets it is udp_gro_complete_segment():
net/ipv4/udp_offload.c:udp_gro_complete_segment() {
...
if (skb->encapsulation)
skb->inner_transport_header = skb->transport_header;
...
}
Take a receive device with NETIF_F_GRO_FRAGLIST and a UDP tunnel socket
such as VXLAN. The inner flow usually finds no socket in
udp_gro_receive(), so it is marked for fraglist:
if (skb->dev->features & NETIF_F_GRO_FRAGLIST)
NAPI_GRO_CB(skb)->is_flist = sk ? !udp_test_bit(GRO_ENABLED, sk) : 1;
On completion, the outer udp_gro_complete() clears encap_mark, sets
skb->encapsulation = 1 and calls the tunnel's gro_complete. The inner
udp4_gro_complete() then takes the fraglist branch and returns early:
if (NAPI_GRO_CB(skb)->is_flist && !NAPI_GRO_CB(skb)->encap_mark) {
udp_set_len(uh, skb->len - nhoff);
skb_shinfo(skb)->gso_type |= (SKB_GSO_FRAGLIST|SKB_GSO_UDP_L4);
skb_shinfo(skb)->gso_segs = NAPI_GRO_CB(skb)->count;
...
return 0;
}
udp6_gro_complete() has the same branch. Neither of them reaches
udp_gro_complete_segment(). inet_gro_complete() and eth_gro_complete()
only set the inner network and mac offsets.
The resulting skb has encapsulation set, and its gso_type is
SKB_GSO_UDP_TUNNEL[_CSUM] | SKB_GSO_FRAGLIST | SKB_GSO_UDP_L4. Its
inner_transport_header is still 0, and transport_header points at the
outer UDP header.
Doesn't the subtraction above then wrap to (unsigned)(-T), where T is the
offset of the outer UDP header from skb->head?
With a normal gso_size, the network seglen would come out more than 100
bytes below the real value. ip_exceeds_mtu() in ip_forward() and
ip_finish_output_gso() would then still pass oversized DF segments.
If gso_size is smaller than T - 28, the value wraps to nearly 4G instead.
Valid packets would then get ICMP frag-needed or be dropped.
The commit message says segments "built by UDP GRO behind a tunnel
socket" are miscounted. The fraglist variant of that same setup still
gets the wrong length, so the added 8 bytes make no difference there. No
later patch in the series seems to touch net/core/gso.c or the udp
offload files.
Would it make sense to also set inner_transport_header in the fraglist
branches of udp4_gro_complete() and udp6_gro_complete() when
skb->encapsulation is set? At that point skb->transport_header should
point at the inner UDP header.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1794151759.git.julius%40bairaktaris.de
Technical Details
Message-ID:
<179479004897.3136.15562972698220894623@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363966-linux-kernel-netdev=dewy.ruReferences:
<e2348827189e5c00ec1bab50aa5e8fe5b8bc3b2a.1794151759.git.julius@bairaktaris.de>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!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363966-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v5 2/4] net: gso: count the inner UDP header of encapsulated UDP GSO packets Date: Mon, 16 Nov 2026 00:47:28 +0000 Organization: Usenet Network Message-ID: <179479004897.3136.15562972698220894623@kernel.org> References: <e2348827189e5c00ec1bab50aa5e8fe5b8bc3b2a.1794151759.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="1945784"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:BQDIZiUya6b/UIX+IqeLN+zCaJY= sha256:XQuD+5ewRjSZ/Y4gYAGN/5VSaNYQRqGoXdRhqiai0fg= sha1:0iXthOqDt13lqpLzJPjTJIU8CkY= sha256:addx2JrH92Vz/wCOZO5ZvTlel/Wh4ZX+nnuER7AwAnw= 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 7ED88114AD9; Mon, 16 Nov 2026 03:47:47 +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 LtpBQpPLPx-1; Mon, 16 Nov 2026 03:47:43 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-363966-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 05BDF114AD6; Mon, 16 Nov 2026 03:47:35 +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 4D5E12FF42; Mon, 16 Nov 2026 00:47:32 +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=1794790051; b=bP5cOpgiNUTVXm1gZmxnoeBv6ZyFol6CuWv6zMGNw+47m6ZanrKn5ZyQnFCtNYnO180i 4N0qsz7pTZ8FxPyMUGngLEii4IprhrHP2RVBePh95tUe7yl0hysrukQh1VHuE4IccvwU5 Zaw2fGTOogodXo3U4bobBbu/E6Zg7/sCaPr62aMNzMvj4WMYZikrSKUlZkGbURp6W4y2D OslqcAhbnxwRk4Jj9NliBqJbMEKl64wbFR7Zn+/GRBQbLNyUjnUVdkAn9jYfqhEcBrezy iZPbxQ/vIBf98STNRDWl3X2PNhdDGyrDAMlLtz9aK4ZyVLxB7F/v9ueHCS+aAMyGpyQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794790051; 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=7kg4a3TEnZkxRSVDGnX2wLyGiqAZjqROKr48Wn6zfyw=; b=xBjBe02y8PpT+d2ryQ6QOTc0P19zspHGlAvk5K+GZX6ZkNKOmIPZQgk9MU/LIwu/6ZLD 01m+vx0RbHybs45McqxDTLf+GiJITdnCjIV72lExvkpDe4UYwiNs0vKAFf6tjZc8hbCC+ xv9BpX3GA+TDfXsHmCykOLzO3SPIzaXb4nB0MGVDZ4ndVn6HUO0900VNXXCW+TWuwwCJF hmyJnJl/l86+mDqmROyGq6kVKS1s+FNs69o0s314m87pUIIvZOejIWfC9SgpKdVFi418u cEdpWISHTwtTrlWtz/0o8LHPkERi+nnZ61cXolPvVJ8836ItOJPELNWJ5k/F7C2GJ2g== 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=G4CatkWg; 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 957C0606A33F; Mon, 16 Nov 2026 00:47:31 +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=G4CatkWg 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=1794790050; b=4doY5/CC6fvaT4AiDzXWwEBo345+GRcJjy9R/GPfqyyI5XqCg92w0Qytr2fAVfwjXDPn TvNOsvaDX1yNRk8GhYSrIHyzolUB/CQox4fzGlPrdEsg6FEZNqZceBf3hUKrjwkGeUz8C b6oeVGDL0yC6IEJRfZIL1XZUrgElD3iH5416NwsOuxLL79h195jDS9PngTpvuc7Qvw5Td t45fWoGoBhcb+5m5TAnr/KhDwwjB66aUqZH9x7MbLL+Mz4NPia3ccR7lm3o1IWCf5Ge3y +chJ5+bjDNoF/FK7ytVmaSSbY8Ktv2H+Ulo9eNfiuspa7j6TFLA410U6/guiZ6daSxg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794790050; 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=7kg4a3TEnZkxRSVDGnX2wLyGiqAZjqROKr48Wn6zfyw=; b=NPmlNeFQ8tbbBdic32DgT5lzj+XLDglYT2SM9HKibPi3cHZRfdGpOmMKhtAM3eC4OU5X Gzyav/HtdCtJBpgtgzBZOJEdHD53TW4Fuce3QUIVHSGkDc/GXy7FR9heSN710skRnVHj9 CjLHwcMui04OI5dCZ+1YKaOSK/V3vyqyg8Bsaa4w9KL+JGhFx+jVzdhVoTMez+raGDxS7 0AKmEXGHT+C7m354P9M1mskizLWsvuqjAv4AGVMjpJ4k99FiZGTk9r+giXtZ9TV+snPft L2fSTd2lgikH1WBM/QTWQwQ2aQwZVyySX3v9gNsWEGI2imPUKvDx7p82Rks2uxHYWVQ== 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=G4CatkWg; 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 B3B0D606A32F; Mon, 16 Nov 2026 00:47:30 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 628571F000C4; Mon, 16 Nov 2026 00:47:29 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794790050; bh=7kg4a3TEnZkxRSVDGnX2wLyGiqAZjqROKr48Wn6zfyw=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=G4CatkWg/0ZzjXnKFPFquPsTV1UAdG+TiPtuE3sawb6i3LcbEfNHykTsJXFM4jqqu Qx76BV3JddRMniNcvOT5LaR9oZn1LMjfTA8j2Kbl3vd0itrbez19PhB30bQEmZASLT LShdzv9F4Fp3M/bRxsFnGP6QpQsq8oSXpPOL8PqeD8w/o3ClU3tO39BoCtEvOwAHoP F8LAXIA4afavZTVj1RT5MSnOGyvKjIsEaPJz6gghxZs+E2XKc57IpOMLskkZL4ROG7 OvcKAv2WasiRrptIoSmS6VEmUnNIB6Zm4BDDfcqcGFhgufgPOhnyKTaEK7zw1pKy93 J7uy0NE6jr4PA== X-Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, dsahern@kernel.org, idosch@nvidia.com, willemb@google.com, steffen.klassert@secunet.com, jiayuan.chen@linux.dev, mfleming@cloudflare.com, almasrymina@google.com, bigeasy@linutronix.de, richardbgobert@gmail.com, ecree.xilinx@gmail.com, bsdhenrymartin@gmail.com, linux-kernel@vger.kernel.org X-In-Reply-To: <e2348827189e5c00ec1bab50aa5e8fe5b8bc3b2a.1794151759.git.julius@bairaktaris.de> X-sashiko-severity: High 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