🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #27349

netfilter: nft_rt / xt_TCPMSS: forwarded MSS clamping bypasses ip_forward_use_pmtu=0

#27349
From: 邓舟彦
Date: Sat, 05 Dec 2026 11:31
29 lines
10754 bytes
Hi,

Linux routers default to net.ipv4.ip_forward_use_pmtu=0 so forged ICMP PMTU messages do not affect forwarded traffic. However, get_tcpmss() in net/netfilter/nft_rt.c and xt_TCPMSS.c call dst_mtu() directly instead of ip_dst_mtu_maybe_forward(dst, true), exposing forwarded TCP flows to any ICMP-learned fnhe PMTU.

One stateless ICMP_FRAG_NEEDED packet sent to a router (quoting an ICMP Echo Reply toward destination D via icmp_err(), with no socket match or IP spoofing) caches the forged PMTU for D (600s default mtu_expires). Because get_tcpmss() calls dst_mtu() on outbound SYNs to D and via reverse lookup to D on inbound SYN/ACKs, the router silently clamps both directions of all new forwarded TCP flows toward D.

We verified this on a Linux v7.3.6 NAT gateway (unchanged in v7.4-rc4) with default sysctls (ip_forward=1, ip_forward_use_pmtu=0), default INPUT ACCEPT policy, and nftables WAN MSS clamping ("tcp flags syn tcp option maxseg size set rt mtu", default in OpenWrt fw4). One stateless ICMP_FRAG_NEEDED with MTU 800 dropped forwarded SYN MSS from 1370 to 760; with MTU 500, both SYN and SYN/ACK MSS were clamped to 512 (~500B payload with timestamps), with zero ICMP frames sent to clients and no route exceptions cached on the clients.

For forwarded packets (while keeping NF_INET_LOCAL_OUT unchanged), get_tcpmss() and xt_TCPMSS should use ip_dst_mtu_maybe_forward(dst, true) (and ip6_dst_mtu_maybe_forward(dst, true) for IPv6). A minimal reproducer is available privately on request, and we are happy to send a patch if this looks right.

Best regards,
Zhouyan Deng
Technical Details
Message-ID: <1a7a9cfa.4388f.1a245f97ee9.Coremail.dengzhouyan@mail.nwpu.edu.cn>
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-377952-linux-kernel-netdev=dewy.ru

Show 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-377952-linux-kernel-netdev=dewy.ru
From: dengzhouyan@mail.nwpu.edu.cn (邓舟彦)
Newsgroups: linux.kernel.netdev
Subject: netfilter: nft_rt / xt_TCPMSS: forwarded MSS clamping bypasses
 ip_forward_use_pmtu=0
Date: Sat, 5 Dec 2026 19:31:48 +0800 (GMT+08:00)
Organization: Usenet Network
Message-ID: <1a7a9cfa.4388f.1a245f97ee9.Coremail.dengzhouyan@mail.nwpu.edu.cn>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: base64
Injection-Info: usenet.network;
	logging-data="3016031"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:7iIzNrxK+WpOKCQ8pZ8QEQmmv9M= sha256:42rSdtpZmamc+jZVEAkVa/f2cnR+eD5j5GZIg+ndM94=
	sha1:9te0HnEOMxP2c5zKnjxkQlf6Jug= sha256:Is1BKblaSr84/JZGvrXMHp/hPS2bIJxNA0FAUbgxTak=
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 5D83F117DFB; Sat,  5 Dec 2026 14:32:33 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.199
X-Spam-Status: No, score=-3.199 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.001,
	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-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 EAiS1MCeSDio;
	Sat,  5 Dec 2026 14:32:27 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-377952-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=mail.nwpu.edu.cn
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 9C449117DF4; Sat,  5 Dec 2026 14:32:19 +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 2B36B293BF; Sat,  5 Dec 2026 11:32:13 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=fail;
	t=1796470332;
	b=hDZjzGqnyHBovOKnnx7Mu/w33AdzjSWtoFjAtOjJfS8RA4SI4s2yRc5+cqFF5Ay6QO40
	 R8ZHHTk0Tf/nYuzIy5gfcJNhBubD8GZYoJ2Znjp+kbHhoRiX9jGd62G0CDz7i0Yl9Qkao
	 y1JHpwX3VoAt480+7wWB9vA30X7GFAfALwnuKyD6ZaVwkffBspKw6yWRHZvVryuOUgR2C
	 lZmdChoxpLPFZdFXbrwbraWfVw0dtjQx+F+La+OMYX5I7OugSEHqOrlUdNbkcYlJJPq3D
	 Zvi7oLwXUY33f0mS8AyR+agQQM1IJ8Q5fsjUp36Sej8C4rPNceq83WuF/uYcvRsCpVw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796470332;
	h=X-Original-To:Received:Received:Received:Date:X-CM-HeaderCharset:
	 From:To:Cc:Subject:X-Priority:X-Mailer:Content-Transfer-Encoding:
	 Content-Type:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Message-ID:X-Coremail-Locale:X-CM-TRANSID:X-CM-SenderInfo:
	 X-Coremail-Antispam;
	bh=BuNQt22To09t990f9fOBZif4OfLw2jS4OWiA+ZfKLaY=;
	b=P/P1Lm12qJ3miXRXT+Agtxunlji4DPn0fxi/XG5O6m4nf8XltURvIpnys7n5DrFwi3uR
	 +2mBpmfcHPAM6d3QCUAeStONDIUed2Egp00TXRwteRPhtmqcDx7VRFrZJohD74dyR96z2
	 1XBzJEafY+zFhQJGjTl2ztsloRnyXpZdRlq8/qI1uwxhk2J8cB/CzyUcaCgG00PriMh6V
	 1xuYGH69tFqI9aPH4a6+D1p/9NFK19sLNYM2tsPTh1T2+mMdNKgpnh6i+MD915qimclIQ
	 3nFRWFSW6HDoX/iacD2IeN1c/Pr3JB5bIRWZFE4o5TlA/+QybFho3UymoEG/J4gQQXg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dmarc=permerror header.from=mail.nwpu.edu.cn;
	spf=pass smtp.mailfrom=mail.nwpu.edu.cn;
	arc=fail 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 4CDDE606A338;
	Sat,  5 Dec 2026 11:32:12 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=206.189.79.184
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796470326;
	b=Swj/+gtaiIfOFdUXSW5J9YEGRgImH1TRwHlAk298py7BhaHPk6xx6OGL/EZeE3bUx6yR
	 vjVnD5yDYlBfxvT7CjynTh1Hf1RASOpOehIpoFPcUCB/IZ6oGOEML4qLw7l1gqU3iN157
	 3f51K0XxAwBS7FGreMQkFMUhIaGE+Dz22OnA7st07m5c0OneZDafYBtm9ttcytkRwnjIT
	 ziDFAfhDoBrdyE5vQ77mrZKeZhkD8y6TGoqrs4KT0ktPiQ6bPO7biTu2MFmxb2eOQkX5K
	 Ara1f6d1YZiYPJfnJfejzFFBoKuz1FhZwQ+jU74RsSHVgty2N9ZbZChy1pvWx/56Atw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796470326;
	h=Received:Received:X-Originating-IP:Date:X-CM-HeaderCharset:From:To:
	 Cc:Subject:X-Priority:X-Mailer:Content-Transfer-Encoding:Content-Type:
	 MIME-Version:Message-ID:X-Coremail-Locale:X-CM-TRANSID:
	 X-CM-SenderInfo:X-Coremail-Antispam;
	bh=BuNQt22To09t990f9fOBZif4OfLw2jS4OWiA+ZfKLaY=;
	b=Xv9dZAMDMsbdO4w1jSFYWHPqjejNZjaLYcWiZhCXoPH1ODm7gEdzqnd0kSFPPQAmV3AE
	 HjR1La6hboc7CVijPF/4jPk9gqtqkG5mwOHV2mu5XjRMKifAJpNLdt6CCiD797uxahR9U
	 nFbxSye2Ztj4kvwPFy603Be6uExb3rMzeGT3mV2DcZ5hkJRJxyxBmWA347AdX2OFJMamU
	 fetXZX1/njmF9iUqbSphRQ9BprKCWSpflcJWwkz5DHOjJM0b86OxtSX5FyZMuOt4UTvpJ
	 0jLVMijAcbDqas66eGrRlMLe5Fsxe0ntzMPupeA/CzOPJm4tWlEDDnLbwOjqiuK6ERQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=permerror header.from=mail.nwpu.edu.cn;
	spf=pass smtp.mailfrom=mail.nwpu.edu.cn;
	arc=none smtp.remote-ip=206.189.79.184
X-Received: from zg8tmja2lje4os43os4xodqa.icoremail.net (zg8tmja2lje4os43os4xodqa.icoremail.net [206.189.79.184])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 9288B606A322;
	Sat,  5 Dec 2026 11:32:00 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=permerror header.from=mail.nwpu.edu.cn
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mail.nwpu.edu.cn
X-Received: from nwpu.edu.cn (unknown [10.68.187.103])
	by mtasvr (Coremail) with SMTP id _____wB3b2Il9hNrGtMLAA--.248S3;
	Sat, 05 Dec 2026 19:31:49 +0800 (CST)
X-Received: from dengzhouyan$mail.nwpu.edu.cn ( [10.68.187.103] ) by
 ajax-webmail-app (Coremail) ; Sat, 5 Dec 2026 19:31:48 +0800 (GMT+08:00)
X-CM-HeaderCharset: UTF-8
X-Cc: netdev@vger.kernel.org, netfilter-devel@vger.kernel.org, 
	coreteam@netfilter.org
X-Priority: 3
X-Mailer: Coremail Webmail Server Version 2024.3-cmXT5 build
 20250122(df744233) Copyright (c) 2002-2026 www.mailtech.cn nwpu.edu.cn
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-Coremail-Locale: zh_CN
X-CM-TRANSID: AQGowAAnjowk9hNr4gB7Ag--.3182W
X-CM-SenderInfo: pghqw65krx5t3q6ptxnooq41vxohv3gofq/1tbiAQMKAmsQ4+MBAQ
	AEs1
X-Coremail-Antispam: 1Uk129KBj93XoW7Kr45Ar1DtrWUKr1DGryxXrc_yoW8WFy7pF
	WkArn0yF9aqryqyw18Aa17Arn2kF48Jwn5Kr1Ik398ArW5Wa4UAF1aq3y09anYgrW8J3yx
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