Article View: linux.kernel.netdev
Article #26898[PATCH nf-next] ipvs: use the forwarding path MTU for forwarded packets
From: James Sawyer via B4 Relay
Date: Fri, 04 Dec 2026 11:08
Date: Fri, 04 Dec 2026 11:08
129 lines
16294 bytes
16294 bytes
From: James Sawyer <james@jamessawyer.co.uk>
IPVS checks the MTU toward the real server with dst_mtu(), which returns
a path MTU learned from ICMP. Any host that can send ICMP to the
director can create such an exception: udp_err() and udpv6_err() create
it before socket matching (4c3499f79f8c, ac76cab50e89), and for IPv4 an
ICMP quoting an Echo Reply did the same before that. One forged
"fragmentation needed" or "packet too big" quoting a made-up UDP
datagram to a real server's address makes ensure_mtu_is_adequate()
reject clients' DF packets above the forged value. The real server may
be on a directly connected network, because the ICMP does not have to
come from the path to it.
Use ip_dst_mtu_maybe_forward(dst, true) and
ip6_dst_mtu_maybe_forward(dst, true) instead, as the MTU checks in
ip_forward() and ip6_forward() do, for all forwarding methods. A learned
PMTU is then ignored by the check unless net.ipv4.ip_forward_use_pmtu is
set or the route MTU is locked, and a real PMTU problem is reported by
the next router on the path. For IPv6 the check also ignores an
unlocked route MTU, as the ip6_forward() check does; "mtu lock" keeps
one.
The learned PMTU and an unlocked IPv6 route MTU still apply on output.
IPVS sets ignore_df, so a packet that passes the check but is larger
than that MTU is now fragmented by the director instead of rejected.
This includes IPv4 packets with DF set.
Tested on 7.0 with the director in NAT and in IPIP mode, client on the
director's LAN, real server behind a router, DF UDP to the VIP:
NAT, forged MTU 1000 (IPv4) / 1300 (IPv6): 0/3 before, 3/3 after
(fragmented by the director)
IPIP, forged MTU 1000: 0/6 before, 6/6 after (outer packet fragmented)
IPv4 route "mtu 1100", IPv6 route "mtu lock 1300": still enforced
IPv6 route "mtu 1300" (unlocked): no longer enforced, packets above it
are fragmented
A forged IPv4 value below min_pmtu is stored as a locked exception and
is still honoured after this change. The separate netdev patch "ipv4: do
not trust ICMP-locked PMTU while forwarding" closes that case for both
ip_forward() and IPVS.
This was found and tested with the help of an AI coding assistant
(Claude). The measurements ran on the author's lab machines.
Suggested-by: Julian Anastasov <ja@ssi.bg>
Link: https://lore.kernel.org/all/085110d4-7f27-7105-ce7a-86c807123bd6@ssi.bg/
Signed-off-by: James Sawyer <james@jamessawyer.co.uk>
---
The change you suggested in the thread linked above.
On rp_filter: with rp_filter=1 on the director, the forged ICMP still
sets the exception. The check applies to the ICMP's own source, and
here that is the sender's real, routable address.
Packets that now pass the check are fragmented by the director when the
learned PMTU is lower, because of ignore_df. Plain ip_forward() on the
same director sent them whole, because IPSKB_FORWARDED makes
ip_skb_dst_mtu() use the forwarding MTU on output too. If you prefer
that for IPVS, I can look at it.
With IPIP and a real 1400-byte link behind the director, clients were
told 1380 before, by the MTU check once the director had learned the
PMTU. After the change they kept sending 1450-byte DF datagrams, and
the director fragmented the outer packets. A route MTU on the director
gives the old result. The ip_vs_core.c hunk made no difference to what
the client was sent in this test, so it is build-tested only (W=1, no
new warnings). DR and the GUE and GRE tunnels are not tested.
I used nf-next because this changes behaviour for tunnels and for
unlocked IPv6 route MTUs. I can resend for nf if you prefer.
---
net/netfilter/ipvs/ip_vs_core.c | 3 ++-
net/netfilter/ipvs/ip_vs_xmit.c | 10 ++++++----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index f3eb72e95024..d8985a7ab4c3 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -1945,7 +1945,8 @@ ip_vs_in_icmp(struct netns_ipvs *ipvs, struct sk_buff *skb, int *related,
dest_dst = rcu_dereference(dest->dest_dst);
if (dest_dst)
- mtu = dst_mtu(dest_dst->dst_cache);
+ mtu = ip_dst_mtu_maybe_forward(dest_dst->dst_cache,
+ true);
}
if (mtu > 68 + hlen_ipip + ulen)
mtu -= hlen_ipip + ulen;
diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c
index ebc6b697ae51..c6c75c9799a2 100644
--- a/net/netfilter/ipvs/ip_vs_xmit.c
+++ b/net/netfilter/ipvs/ip_vs_xmit.c
@@ -395,9 +395,10 @@ __ip_vs_get_out_rt(struct netns_ipvs *ipvs, int skb_af, struct sk_buff *skb,
goto err_put;
if (likely(!(rt_mode & IP_VS_RT_MODE_TUNNEL))) {
- mtu = dst_mtu(&rt->dst);
+ mtu = ip_dst_mtu_maybe_forward(&rt->dst, true);
} else {
- mtu = dst_mtu(&rt->dst) - sizeof(struct iphdr);
+ mtu = ip_dst_mtu_maybe_forward(&rt->dst, true) -
+ sizeof(struct iphdr);
if (!dest)
goto err_put;
if (dest->tun_type == IP_VS_CONN_F_TUNNEL_TYPE_GUE) {
@@ -573,9 +574,10 @@ __ip_vs_get_out_rt_v6(struct netns_ipvs *ipvs, int skb_af, struct sk_buff *skb,
/* MTU checking */
if (likely(!(rt_mode & IP_VS_RT_MODE_TUNNEL)))
- mtu = dst_mtu(&rt->dst);
+ mtu = ip6_dst_mtu_maybe_forward(&rt->dst, true);
else {
- mtu = dst_mtu(&rt->dst) - sizeof(struct ipv6hdr);
+ mtu = ip6_dst_mtu_maybe_forward(&rt->dst, true) -
+ sizeof(struct ipv6hdr);
if (!dest)
goto err_put;
if (dest->tun_type == IP_VS_CONN_F_TUNNEL_TYPE_GUE) {
---
base-commit: 693c2e04e3f1d4c59af236e1211b7b8cb165a790
change-id: 20261204-ipvs-forwarding-mtu-412810cdcf2b
Best regards,
--
James Sawyer <james@jamessawyer.co.uk>
Technical Details
Message-ID:
<20261204-ipvs-forwarding-mtu-v1-1-14146b72e2e5@jamessawyer.co.uk>Path:
mbox-mo1.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!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-377294-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!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-377294-linux-kernel-netdev=dewy.ru From: devnull+james.jamessawyer.co.uk@kernel.org (James Sawyer via B4 Relay) Newsgroups: linux.kernel.netdev Subject: [PATCH nf-next] ipvs: use the forwarding path MTU for forwarded packets Date: Fri, 04 Dec 2026 11:08:43 +0000 Organization: Usenet Network Message-ID: <20261204-ipvs-forwarding-mtu-v1-1-14146b72e2e5@jamessawyer.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="2748122"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:5zobdxK8abzbAVBFSuKnX6Zbtdk= sha256:o3JZp3MlNj0h/yx1Zi93LFZWbCt/VIzmUtWgcBWjLN4= sha1:dWjy3N8t8tBpE1NpSdCT5uTocls= sha256:4iGPIm5NGbDGzE2WixEC9E9OEpHqhDfeEz79wz1lrRk= 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 1459A117BC0; Fri, 4 Dec 2026 14:09:51 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.542 X-Spam-Status: No, score=-3.542 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.142, 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 EGEfH575LLsR; Fri, 4 Dec 2026 14:09:48 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-377294-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 9C134117AF9; Fri, 4 Dec 2026 14:09:39 +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 9F1F23574E; Fri, 4 Dec 2026 11:08:57 +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=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796382537; b=d/ul1HFX3MUCTaETtiyV1BEn6g/WGcLH3/jugxBQs8Pj1Gf3xYDjehrLZhPQEVqZoDcB B07fkh7KBvz4FcWMtB9gd+BW2ZKj6WsGofWMa73U4gRJPXEFi1HfnQwduVn8EgKmiBpL/ g8p4sVMgoQwGgLpM8UVT+8VYkHuD8tOiHry75z8yl0Z/4YPAItX/UEAM24NaOyf1ZYixe OksKtx7sGmaC9YLGVJGjZ2sWeSWZP3VJsV2i1zyCireTXVdI4ss7cdOzQ8F2yZFDjrrFY Ycem4EVgpc8fsBgg+SYzbHCe5tENOudkLVRzW4PBVUJ6j/7GoazDoKRoX0ICZpkEXSw== X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382537; h=X-Original-To:Received:Received:DKIM-Signature:Received:From:Date: Subject:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type: Message-Id:X-B4-Tracking:X-Change-ID:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=wseKnjrU2XLurt9ZCNzj1Yi+Fh6U0/IrQQfvgaak5T4=; b=GaZO57E/LX94l/KNGGBUscfOkhWGfE7qE8h/Gw0oJSP5xGDsS7vz7pmNxkBv2lRLGn2p OzCxHvDlGJsfB+mNCzyz0He9vCoR6zhGat8NNjK/MMnVLWhD+8cC8n0Nl2yAys7JnyJgd LqMYSR/uSx/MhRQrbxo0WUpf/W8s4SxqBPeQW9G6A5cSUHTKmPrs495a0Kb/nZ/rpbMjg cpKs6vHghp4wrcJINRVOXezXqbPWThC3KPC8Z3DuHSMWearzx1vIagfSfng3VZSxZleMz GAayJk83gXQisZSbRepaAuUWVLHAHqLnqN/RoQMty/YREET7RUPhlcyhwM2STskByPw== X-ARC-Authentication-Results: i=3; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=E374yshj; 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 77979606A334; Fri, 4 Dec 2026 11:08:57 +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=E374yshj X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796382531; b=Mmwvq7wl9GIr2y3Ve54v6YmSFoOXJzYXKsv17N7Zmj7nV8YGz6ojcMwjcsxJUc23MVr4 BKOgJDoya+4h6NSHd3Cjs680LO2Py4S/L1FPMJqK+WeH0LTbbuCtiMmvfpZ/MublLXA02 1BCklzC8mafRbvMVFgxRz6DrYhadAnLYlpknCQNW8utGiTy9S2L8HOd4Mt+WeBE0hXTuf wveJqn3fzomOz8R7VfYEqIYs4Q38FRV4YceMGYBnizYVok0dAFTswOSQf5OF5igcE+6/S q8PY/a9sA5Sp9Ff2mmBF9rqD31GIZndqhlxK6P/XXMAMUMCxW0M/CpmyNyA2awEFGaA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382531; h=Received:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Message-Id:X-B4-Tracking:X-Change-ID:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=wseKnjrU2XLurt9ZCNzj1Yi+Fh6U0/IrQQfvgaak5T4=; b=n9OcMtN58kh785s8/mzERvyySaHjBbGOR4QAuNNK4P4GTY22asYhIR8a9tuiTF2j/bT2 h3FZ3XSpWTTFDho2/JybRF8ocBOznRXqGVlRPNZJ/8wnRc5qE6o2PrQkgppPRtcbICmIC hFhD3GtEXYbqQFZibUQBgqAzg3YmF2xjJ726+TX2U3sN1eLZsk3D3S5ciEh+e/gqupEvP ++uxIjpmhVFj+eWtYQ8MGJwJJhfXJ7J1TS/NNO8k+Lyft1HgHZ4IQGgffgmrjRoROa5jT FmjOS6+yFchzoXANWkgWhYWebtkTjgPPa0z2ctt2mMl0UeSXOzFw3R2CCQ/EZB4XUrg== 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=E374yshj; arc=pass header.oldest-pass=0 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 923BB606A322; Fri, 4 Dec 2026 11:08:51 +0000 (UTC) X-Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 X-ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none; t=1796382531; b=iMRt4JiMmL91Sa+FLcS+IH4f6owbrTOWb/l/DYCPjXILbYmwMfDNW5irIQk5+WNpox8N 0WdBDa608U0vonNRvsrpwb34x+dFC64JkUOjYQiI/u9movdoxdobawEiVGcgX8EgHYglB 0sP//gCixJUpKGYRbh4oDy/SGEV7gkdziHgpuItY+v3oe++GrhD6kbje4eD3hZZoMxD4T Z2feF5YrIPdsbTDcn4CCAmy7vJbg3pQbpJviHLdZ1usDmkSk+iID+793+n5ypjS/f/giS /ARTapKLAm9Mnl/dgzGmIJpUjtIO+BRVw3TkqYKcyHfRBkn7KM0oV6IRS9ANtpp3oMg== X-ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1796382531; h=DKIM-Signature:Received:From:Date:Subject:MIME-Version:Content-Type: Message-Id:X-B4-Tracking:X-Change-ID:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=wseKnjrU2XLurt9ZCNzj1Yi+Fh6U0/IrQQfvgaak5T4=; b=N65X9CbIUmqa06kDoW5fgpeaSaaBRv7f8x8ElXkXrRlfhmlJYlKu3IgTVYw2bxsxLyMX yf3YrYVOknuwSg8Xdw3ACjg1Nnk3VIMbz87FUbzCmfBllPJh9QbgpzvkxDE4a3Kl35ocq zsiwYIfSszXSTTfFFUhKMzvefzX1M25To1TXDSV9qJje3A6CVvIRy5Y9xQBRg9RgDzV68 tjLjVao4qTi1fYl/GYIeUFivHLO4h9S2NDb9lqCMtMMhTx0YUdH9VZ2Zh4WQqJ0+0SyJe Oo536EFaOCBbfd1WHiH+QKcnoGivY0sQgSCo3tfT6WHLR8SPBCKs1jvugNycN+7K/Xg== X-ARC-Authentication-Results: i=1; smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 X-Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id B4A931F00897; Fri, 4 Dec 2026 11:08:50 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796382531; bh=wseKnjrU2XLurt9ZCNzj1Yi+Fh6U0/IrQQfvgaak5T4=; h=From:Date:Subject:To:Cc:Reply-To; b=E374yshjwVsufyDT92zlxAkTTOLmAlcx+qiizYbTUhrONPrKifzVUrWtvbvutiUxL yeuBStMhpM60TcAULQYPJghmJhu+aCLJ5GyZk19Nm8gjHvhGbFK/Q/zVfitioAfKoO bYBzmS9C0ruKdYXMVHIBupkjexuGeYNUqmcslGjKizreLxwdhQONi87eFi5qHPcAxU zYLwCzNdO4ddlzzheRLeJI4ypAWmXoe9bfYBjAGQvITLYS8xVJKSUfSy/sDE2QrLA2 AIGVIJvtZGoOvz8PZ4Jcu1JQjanrRhR1Ul/Eg3Kmq7O9qgALmZxAHACiJRpHcLKOD3 ry7425jjEMNtg== X-Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id 130CC4DA42; Fri, 4 Dec 2026 11:08:50 +0000 (UTC) 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 X-B4-Tracking: v=1; b=H4sIAAAAAAAC/yWM0QqDMAwAf0XyvEBbZIz9ytiDtqlmsChJdYL47 +vm43Hc7WCkTAb3ZgellY0nqeAvDcSxk4GQU2UILlx9cC3yvBrmST+dJpYB32XB1oebdzHFHHq o5ayUeftfHyAZhbYCz1PY0r8olt8TjuMLw7XZDoAAAAA= X-Change-ID: 20261204-ipvs-forwarding-mtu-412810cdcf2b X-Cc: Simon Horman <horms@kernel.org>, netdev@vger.kernel.org, lvs-devel@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, James Sawyer <james@jamessawyer.co.uk> X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796382529; l=5707; i=james@jamessawyer.co.uk; s=20261203; h=from:subject:message-id; bh=nMNzm9DqgNp+q8KGTS5U7fCHIzjydYCGY9Umee2JZyU=; b=ft+BX/IwGuo3/8R/tb0f470Wuimjjffr4VhAyVWxzyyCFpboqj3OWW1o43DANJ2yxNd+9yMmq 1HMVBShr1njBCt9aA2TNlT4IYsShc+DgqcSTNcnE004CSZ4pO4vTmfS X-Developer-Key: i=james@jamessawyer.co.uk; a=ed25519; pk=97d0xHacZOmlJXs5Pj8Vv8mVWW2CBNhqBLMVT3VQjis= X-Endpoint-Received: by B4 Relay for james@jamessawyer.co.uk/20261203 with auth_id=1733 X-Original-From: James Sawyer <james@jamessawyer.co.uk> X-Reply-To: james@jamessawyer.co.uk