{"id":2223694,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2223694/?format=json","web_url":"http://patchwork.ozlabs.org/project/netfilter-devel/patch/20260416013101.221555-11-pablo@netfilter.org/","project":{"id":26,"url":"http://patchwork.ozlabs.org/api/1.1/projects/26/?format=json","name":"Netfilter Development","link_name":"netfilter-devel","list_id":"netfilter-devel.vger.kernel.org","list_email":"netfilter-devel@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<20260416013101.221555-11-pablo@netfilter.org>","date":"2026-04-16T01:30:57","name":"[net,10/14] ipvs: fix MTU check for GSO packets in tunnel mode","commit_ref":null,"pull_url":null,"state":"superseded","archived":true,"hash":"c82809ed53d9933502506ec6d601874ebab2232b","submitter":{"id":1315,"url":"http://patchwork.ozlabs.org/api/1.1/people/1315/?format=json","name":"Pablo Neira Ayuso","email":"pablo@netfilter.org"},"delegate":{"id":11902,"url":"http://patchwork.ozlabs.org/api/1.1/users/11902/?format=json","username":"strlen","first_name":"Florian","last_name":"Westphal","email":"fw@strlen.de"},"mbox":"http://patchwork.ozlabs.org/project/netfilter-devel/patch/20260416013101.221555-11-pablo@netfilter.org/mbox/","series":[{"id":500063,"url":"http://patchwork.ozlabs.org/api/1.1/series/500063/?format=json","web_url":"http://patchwork.ozlabs.org/project/netfilter-devel/list/?series=500063","date":"2026-04-16T01:30:47","name":"[net,01/14] netfilter: nft_fwd_netdev: use recursion counter in neigh egress path","version":1,"mbox":"http://patchwork.ozlabs.org/series/500063/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2223694/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2223694/checks/","tags":{},"headers":{"Return-Path":"\n <netfilter-devel+bounces-11956-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","netfilter-devel@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=netfilter.org header.i=@netfilter.org\n header.a=rsa-sha256 header.s=2025 header.b=SHywLh60;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=netfilter-devel+bounces-11956-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=netfilter.org header.i=@netfilter.org\n header.b=\"SHywLh60\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=217.70.190.124","smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=netfilter.org","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=netfilter.org"],"Received":["from tor.lore.kernel.org (tor.lore.kernel.org\n [IPv6:2600:3c04:e001:36c::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fx0sJ6tQWz1yG9\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 16 Apr 2026 11:33:40 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id A0CE63149ABC\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 16 Apr 2026 01:31:45 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id D3F0D23C516;\n\tThu, 16 Apr 2026 01:31:24 +0000 (UTC)","from mail.netfilter.org (mail.netfilter.org [217.70.190.124])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 1EE2C2309B2;\n\tThu, 16 Apr 2026 01:31:22 +0000 (UTC)","from localhost.localdomain (mail-agni [217.70.190.124])\n\tby mail.netfilter.org (Postfix) with ESMTPSA id EF69560255;\n\tThu, 16 Apr 2026 03:31:20 +0200 (CEST)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776303084; cv=none;\n b=iUGhujup+DvDrNgp5+lSeKABdA6UX1B/4/lmFGB4wGm1Mgx1Sa1QoUZWcQkwwUL/EwuVr3HCJiC4Suang90LMMcJwrw2Pjf28uONg0f/JEEJyGKBc4PGy3PHgVWfH+Yi4AF31DDd8KxSWOOnXhtVq6Fz1+Mz8H7wuNlLBAK8lpM=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776303084; c=relaxed/simple;\n\tbh=K3jCvsals8BPY7qGgU/izMTL7eFMYcpuqpfYf5bWk6I=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=X22rsENb0ZWnPu6Z2PiKpEQmziFt5j55+0LV41L1PrY3seHYDGYQGAcqKWOs8+G+QRdjtDQYvHIbHe4fEg8rdRCp3O8eYctMr13U2c6ZGkyYRY1BvwDPxA9MY0LCllP4FECjTMCQ4dhzlKgakUtdooFriFjLk0ABmv+UOaZq8ZA=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=netfilter.org;\n spf=pass smtp.mailfrom=netfilter.org;\n dkim=pass (2048-bit key) header.d=netfilter.org header.i=@netfilter.org\n header.b=SHywLh60; arc=none smtp.client-ip=217.70.190.124","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=netfilter.org;\n\ts=2025; t=1776303081;\n\tbh=fkRYP2uZVZjeOQ1Q6YgYeZAja49M92t1g5wZ2mqC/nQ=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=SHywLh60d+luiiu6dx4tIKRjHW9wgD9hbmqDxWotIEqe4gbTJFoiPX6dfxXUtEaR+\n\t mVnaAnBJkxCXWJoQFsDBmJsl92C73uJMU1qj0DaX3Zu3WStyuVeWI+q2TboHoeHuU9\n\t fd19MY6M7Qn+m9lF6Nm9kQVUhZwb9gZYuHS7+1vEfeq4MPLsO8gm+vULab5gzd5EP4\n\t EEME+bF1iDsbKv5T0o1YSCFLWIj/Lex809UMkltWJ/HuiLnh44DNxMtr5FRd1FTYCy\n\t UKosC5NurUHOUKJJwwa93HywTnqUk3+8Wckv2ztMdKHcdZelpZRcIRC6y4FQpoKNre\n\t x1MoSjOHkUolQ==","From":"Pablo Neira Ayuso <pablo@netfilter.org>","To":"netfilter-devel@vger.kernel.org","Cc":"davem@davemloft.net,\n\tnetdev@vger.kernel.org,\n\tkuba@kernel.org,\n\tpabeni@redhat.com,\n\tedumazet@google.com,\n\tfw@strlen.de,\n\thorms@kernel.org","Subject":"[PATCH net 10/14] ipvs: fix MTU check for GSO packets in tunnel mode","Date":"Thu, 16 Apr 2026 03:30:57 +0200","Message-ID":"<20260416013101.221555-11-pablo@netfilter.org>","X-Mailer":"git-send-email 2.47.3","In-Reply-To":"<20260416013101.221555-1-pablo@netfilter.org>","References":"<20260416013101.221555-1-pablo@netfilter.org>","Precedence":"bulk","X-Mailing-List":"netfilter-devel@vger.kernel.org","List-Id":"<netfilter-devel.vger.kernel.org>","List-Subscribe":"<mailto:netfilter-devel+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:netfilter-devel+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit"},"content":"From: Yingnan Zhang <342144303@qq.com>\n\nCurrently, IPVS skips MTU checks for GSO packets by excluding them with\nthe !skb_is_gso(skb) condition. This creates problems when IPVS tunnel\nmode encapsulates GSO packets with IPIP headers.\n\nThe issue manifests in two ways:\n\n1. MTU violation after encapsulation:\n   When a GSO packet passes through IPVS tunnel mode, the original MTU\n   check is bypassed. After adding the IPIP tunnel header, the packet\n   size may exceed the outgoing interface MTU, leading to unexpected\n   fragmentation at the IP layer.\n\n2. Fragmentation with problematic IP IDs:\n   When net.ipv4.vs.pmtu_disc=1 and a GSO packet with multiple segments\n   is fragmented after encapsulation, each segment gets a sequentially\n   incremented IP ID (0, 1, 2, ...). This happens because:\n\n   a) The GSO packet bypasses MTU check and gets encapsulated\n   b) At __ip_finish_output, the oversized GSO packet is split into\n      separate SKBs (one per segment), with IP IDs incrementing\n   c) Each SKB is then fragmented again based on the actual MTU\n\n   This sequential IP ID allocation differs from the expected behavior\n   and can cause issues with fragment reassembly and packet tracking.\n\nFix this by properly validating GSO packets using\nskb_gso_validate_network_len(). This function correctly validates\nwhether the GSO segments will fit within the MTU after segmentation. If\nvalidation fails, send an ICMP Fragmentation Needed message to enable\nproper PMTU discovery.\n\nFixes: 4cdd34084d53 (\"netfilter: nf_conntrack_ipv6: improve fragmentation handling\")\nSigned-off-by: Yingnan Zhang <342144303@qq.com>\nAcked-by: Julian Anastasov <ja@ssi.bg>\nSigned-off-by: Pablo Neira Ayuso <pablo@netfilter.org>\n---\n net/netfilter/ipvs/ip_vs_xmit.c | 19 +++++++++++++++----\n 1 file changed, 15 insertions(+), 4 deletions(-)","diff":"diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c\nindex 3601eb86d025..7c570f48ade2 100644\n--- a/net/netfilter/ipvs/ip_vs_xmit.c\n+++ b/net/netfilter/ipvs/ip_vs_xmit.c\n@@ -102,6 +102,18 @@ __ip_vs_dst_check(struct ip_vs_dest *dest)\n \treturn dest_dst;\n }\n \n+/* Based on ip_exceeds_mtu(). */\n+static bool ip_vs_exceeds_mtu(const struct sk_buff *skb, unsigned int mtu)\n+{\n+\tif (skb->len <= mtu)\n+\t\treturn false;\n+\n+\tif (skb_is_gso(skb) && skb_gso_validate_network_len(skb, mtu))\n+\t\treturn false;\n+\n+\treturn true;\n+}\n+\n static inline bool\n __mtu_check_toobig_v6(const struct sk_buff *skb, u32 mtu)\n {\n@@ -111,10 +123,9 @@ __mtu_check_toobig_v6(const struct sk_buff *skb, u32 mtu)\n \t\t */\n \t\tif (IP6CB(skb)->frag_max_size > mtu)\n \t\t\treturn true; /* largest fragment violate MTU */\n-\t}\n-\telse if (skb->len > mtu && !skb_is_gso(skb)) {\n+\t} else if (ip_vs_exceeds_mtu(skb, mtu))\n \t\treturn true; /* Packet size violate MTU size */\n-\t}\n+\n \treturn false;\n }\n \n@@ -232,7 +243,7 @@ static inline bool ensure_mtu_is_adequate(struct netns_ipvs *ipvs, int skb_af,\n \t\t\treturn true;\n \n \t\tif (unlikely(ip_hdr(skb)->frag_off & htons(IP_DF) &&\n-\t\t\t     skb->len > mtu && !skb_is_gso(skb) &&\n+\t\t\t     ip_vs_exceeds_mtu(skb, mtu) &&\n \t\t\t     !ip_vs_iph_icmp(ipvsh))) {\n \t\t\ticmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,\n \t\t\t\t  htonl(mtu));\n","prefixes":["net","10/14"]}