Article View: linux.kernel.netdev
Article #15048Re: [PATCH net-next v2 5/6] eth: mpnic: IPv4 and IPv6 in IPv6 tunnel segmentation
From: netdev-bot+sashiko
Date: Thu, 12 Nov 2026 10:08
Date: Thu, 12 Nov 2026 10:08
146 lines
13230 bytes
13230 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 ยท High: 0 ยท Medium: 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] mpnic_ipxip6_gso_ok() only checks the outer IPv6 header chain.
--
eth: mpnic: IPv4 and IPv6 in IPv6 tunnel segmentation
This patch turns on NETIF_F_GSO_IPXIP6 for mpnic. The device can segment
4-in-6 and 6-in-6 packets. The patch adds the outer L3 header length and
two new L3 types to the Tx descriptor, and adds
mpnic_features_check_encap_gso() to reject skbs the hardware cannot
handle.
> diff --git a/drivers/net/ethernet/meta/mpnic/mpnic_txrx.c b/drivers/net/ethernet/meta/mpnic/mpnic_txrx.c
> index 2a0560b7dd19e..839feb4716b60 100644
> --- a/drivers/net/ethernet/meta/mpnic/mpnic_txrx.c
> +++ b/drivers/net/ethernet/meta/mpnic/mpnic_txrx.c
[ ... ]
> @@ -228,9 +232,17 @@ static void mpnic_tx_fill_hdrs(struct sk_buff *skb, struct mpnic_tx_hdrs *hdrs)
> else
> hdrs->l4_type = MPNIC_TWD_L4_TYPE_UDP;
>
> - hdrs->i3len = skb_transport_offset(skb) - skb_network_offset(skb);
> - hdrs->l3_type = ip_hdr(skb)->version == 4 ?
> - MPNIC_TWD_L3_TYPE_IPV4 : MPNIC_TWD_L3_TYPE_IPV6;
> + if (!skb->encapsulation) {
> + hdrs->i3len = skb_transport_offset(skb) - net_off;
> + hdrs->l3_type = ip_hdr(skb)->version == 4 ?
> + MPNIC_TWD_L3_TYPE_IPV4 : MPNIC_TWD_L3_TYPE_IPV6;
> + } else {
> + inner_off = skb_inner_network_offset(skb);
> + hdrs->o3len = inner_off - net_off;
> + hdrs->i3len = skb_checksum_start_offset(skb) - inner_off;
> + hdrs->l3_type = inner_ip_hdr(skb)->version == 4 ?
> + MPNIC_TWD_L3_TYPE_V6V4 : MPNIC_TWD_L3_TYPE_V6V6;
> + }
> }
[ ... ]
> @@ -362,6 +375,35 @@ netdev_tx_t mpnic_xmit_frame(struct sk_buff *skb, struct net_device *dev)
> return mpnic_xmit_frame_ring(skb, mpn->tx[skb_get_queue_mapping(skb)]);
> }
>
> +static bool mpnic_ipxip6_gso_ok(struct sk_buff *skb)
> +{
> + struct ipv6hdr *ip6h;
> + __be16 frag_off;
> + u8 nexthdr;
> + int start;
> +
> + ip6h = ipv6_hdr(skb);
> + if (ip6h->version != 6)
> + return false;
> +
> + nexthdr = ip6h->nexthdr;
> + start = skb_network_offset(skb) + sizeof(*ip6h);
> + start = ipv6_skip_exthdr(skb, start, &nexthdr, &frag_off);
> +
> + return !frag_off && start == skb_inner_network_offset(skb) &&
> + (nexthdr == IPPROTO_IPV6 || nexthdr == IPPROTO_IPIP);
> +}
[Severity: Medium]
Can a nested tunnel still get past this check?
mpnic_ipxip6_gso_ok() validates only the outer IPv6 header chain up to
skb_inner_network_offset(). It never checks that the inner L3 header
leads straight to the L4 header at csum_start.
Some paths reset the inner headers on an skb that is already
encapsulated. One is bpf_lwt_push_ip_encap() in net/core/lwt_bpf.c:
skb_reset_inner_headers(skb);
skb_reset_inner_mac_header(skb); /* mac header is not yet set */
skb_set_inner_protocol(skb, skb->protocol);
skb->encapsulation = 1;
For an IPv6 outer header with nexthdr IPV6, handle_gso_encap() then adds
SKB_GSO_IPXIP6. BPF_LWT_ENCAP_SEG6 via bpf_push_seg6_encap() looks
similar.
One way to reach this is an ip6_tnl device whose underlay route has an
LWT BPF xmit program that pushes another IPv6 header:
ip6_tnl xmit (encapsulation=1, SKB_GSO_IPXIP6)
ip6_finish_output2()->lwtunnel_xmit()->bpf_xmit()
bpf_lwt_push_ip_encap() (inner headers reset)
The packet then looks like this:
outer IPv6 -> middle IPv6 -> innermost IPv4/IPv6 -> TCP
Here inner_network_header points at the middle header. So
mpnic_ipxip6_gso_ok() sees an outer v6 header, nexthdr IPV6, and
start == inner offset, and it returns true.
The skb is DODGY, so validate_xmit_skb() runs software GSO validation. That
recursion ends in tcp_gso_segment(), where skb_gso_ok() succeeds against
hw_enc_features and NULL is returned. The skb then reaches
mpnic_xmit_frame() unsegmented.
mpnic_tx_fill_hdrs() would then program o3len = 40, i3len = 80 (or 60 for
an IPv4 innermost header), and L3_TYPE taken from the middle header's
version.
The descriptor only carries OHLEN and IHLEN. Would the hardware then
skip the per-segment fixups on the innermost header, i.e. IPv6
payload_len, or IPv4 tot_len/ID/checksum? That would put malformed
segments on the wire where software GSO would have produced correct
ones.
The v2 changelog says nested tunnels under an IPv4 outer are now
rejected, but this layout still has an IPv6 outer.
Should mpnic_ipxip6_gso_ok() also check that the inner L3 header ends
exactly at skb_checksum_start_offset() with TCP or UDP as its protocol?
For IPv4 that is ihl * 4. For IPv6 that is the header plus any extension
headers.
> +
> +static netdev_features_t
> +mpnic_features_check_encap_gso(struct sk_buff *skb, netdev_features_t features)
> +{
> + if (skb_shinfo(skb)->gso_type & SKB_GSO_IPXIP6 &&
> + mpnic_ipxip6_gso_ok(skb))
> + return features;
> +
> + return features & ~NETIF_F_GSO_IPXIP6;
> +}
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261110-mpnic-lso-v2-0-ccd37b051d08%40gmail.com
Technical Details
Message-ID:
<179447813848.2199510.18299256518114707021@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361697-linux-kernel-netdev=dewy.ruReferences:
<20261110-mpnic-lso-v2-5-ccd37b051d08@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361697-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v2 5/6] eth: mpnic: IPv4 and IPv6 in IPv6 tunnel segmentation Date: Thu, 12 Nov 2026 10:08:58 +0000 Organization: Usenet Network Message-ID: <179447813848.2199510.18299256518114707021@kernel.org> References: <20261110-mpnic-lso-v2-5-ccd37b051d08@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1061511"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:V676fqRTXgexNxFZ0Gbds+23Zm8= sha256:s8qf8nBYvnPn8RGXrbQtwfRziXO6ma3oy0tIN+K3hJc= sha1:8nJ1TC/aDhe9zt0Y0sHaDuQNPQo= sha256:5oHDH52SEM+wAYxh2Lbeq7yTW+B1IMExvyIql/073vU= 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 B6C5A1141C0; Thu, 12 Nov 2026 13:36:19 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 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] 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 TbR3aXbAv9o2; Thu, 12 Nov 2026 13:36:15 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-361697-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id 1221F1141B2; Thu, 12 Nov 2026 13:36:06 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id D58C7881C8; Thu, 12 Nov 2026 10:09:18 +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=1794478140; b=MXIo6XdDQBx8pqEbcXpGhDqukq0yi9Oykum/JPDc9uagzAIs/EMxNxVQ2t06mXVnTEQM PvRxWeub51nh1uU47cUf9PMe99tiJ5G3My5YloAmf0o5yCAQeanUlIVgnZl6DKI7Ktbk+ y0qXna57Qju1j71paAyl8Y9epXJkQx6ZOYyWdn5hYFxYhCg5pkC8fZ5zkyXSdNNS7I6Pb CyDxT8E8Gu+XootwtpfpNV81OLyDsvF70C4j0CLVilRrKM4OLa9fLzV4gwjrX3xySNqjS QUZogPwZm58io+3fSxD1Cq2+viMO/idNxK0lbw9Yqrz8G4b29Xofij0nKhMc3sM7S4A== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794478140; 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=DVX5Cp+lWjYczys85N/ZZVBZp73FiLIgRZwjBBoiswU=; b=prRuQEGkHxabE1P2Djvx5FLuNAshULzmy+85Tuiy4fmU6l2pNvH12BdIgPvaOCtJ468c 9DZ0mWryXlctFZSrKH8zygFYkTu3WE1DxMelg8whi1dkSIM46NTw16c5Wzx75kZWJXQ94 3tz+to1QlBLlf4EE/pxoG7q2UB5E/a5M8ibTGSroI64imuCAcjXx53e+5kC7uCTyzVHUS y3Fw1dMsRijzcjZK4AWXSqMgAn3B01cPGWbR6bnQNYUN43BjWbiPRRaVvg3qAIwKaU+Av wnZZ9MZQqU6sz4QTedFpK/qFKFiwRoP/DuBqa60hh7MC2EKY5gGn6LDbyNBleR/1SMg== 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=ob0RMCbf; 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 93FF8606A8AB; Thu, 12 Nov 2026 10:09:00 +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=ob0RMCbf 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=1794478139; b=qWITNXqOcJEX7XC8QqxM2S1sMjlsghKDjasIZJd3eb7Jad6Cb/PSBFvYf3uVjF+hjTFM qMNde2BxsG68Tk6Fvscrk5J1Zf+Ia3PynNqxDBgUjN7TGN5w4h6ky2GuzTt2ROZygL+Ba d530QlO3DypFQQVl9KZ4K0OadqroIJvFxAr5rBgp3KNN6FxWItklzrKa8kbClbag1DyVD I/9PCPr/6SdfIZ6K6lykn+F622EgtfgqUBlcCA9Wor/3ym0Av56onb1k6mQ+a0eJMU3aD HvBmL9gk0YurVv9zVjsLCW0+swMuglNfDW6O1i0QoqDjT4aUu1xM3ROdHw0o3RjdEvQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794478139; 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=DVX5Cp+lWjYczys85N/ZZVBZp73FiLIgRZwjBBoiswU=; b=I6j8rsBuTRY5ouKFYBUBrz/IsGzBMc/7NgifeCbK0r8jrWMg1Co5EVd7GtqY2rKN5ZAE 1MKp+QN2fWzKPDVSLqkuxhlGa2f6MO/eA6/U1tJ+6kFo8Rx4KajhU0Vs45Mo64wyUQZPH lT0HtMQdWNB4+v08B5EdKc1INQTF+eNEp1pEbv7jWuCmaY8jomiIKJPPOUE32lMNbm3I2 ylkxor8a/qtbVaf110QKDpLC5QPX7gAWBMYmbTN7pvCs9blINM+khI72CKLJ0qLtL4SJB Yf3rif3DdcZHiHxylkdOEBIZLr/vkkC7BwixptFNzIgbvMGaw8/NJmva2SSU9EQP0ag== 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=ob0RMCbf; 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 B4D0B606A89C; Thu, 12 Nov 2026 10:08:59 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6A6E1F00A08; Thu, 12 Nov 2026 10:08:58 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794478139; bh=DVX5Cp+lWjYczys85N/ZZVBZp73FiLIgRZwjBBoiswU=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=ob0RMCbf8jwbdDMZFdtYvTt2qMFCt8SpLgJpbNg983WtVDXQmJphTm+wpZqanHCZO ddpwIYizpO6ZTO6onCoFR3wqwxy69EacvIMyKOgSfVGZ7X1FhdrDw9pc0s99WfRCHi UplxUdskbdcrNdK0psyG5fIf53Ybxw/+L1IXv1N5i8S1Hv0Kj/RMFZmHUV0NW1TSzR fcPW5a2QQlIaEVezYKgRBtL7CvJDixHlsMSkVCQyoA2DV+9xJ+PjiDVTbN+K9dpHxo 8J6cMgvqOGj8s0PEMgQe94D0N7uv3xz3iE5sYvAGU9WIgs6fTSXVRuQ7/AuVRHzxcT CUIrwm5wRzwzw== X-Cc: alexanderduyck@fb.com, kuba@kernel.org, kernel-team@meta.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, pabeni@redhat.com, dimitri.daskalakis1@gmail.com, mohsin.bashr@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org X-In-Reply-To: <20261110-mpnic-lso-v2-5-ccd37b051d08@gmail.com> 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