aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin LaHaise <bcrl@kvack.org>2007-12-18 01:27:36 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:58:50 -0500
commit170080645dac61816455afad807ffeb326ce79e8 (patch)
treeaef9353bf06a21384fead3cd2592a48e1e5acdbe
parentd6a2ba07c31b0497fc82a8c175400ea8747da2ef (diff)
[NETFILTER]: xt_TCPMSS: don't allow netfilter --setmss to increase mss
When terminating DSL connections for an assortment of random customers, I've found it necessary to use iptables to clamp the MSS used for connections to work around the various ICMP blackholes in the greater net. Unfortunately, the current behaviour in Linux is imperfect and actually make things worse, so I'm proposing the following: increasing the MSS in a packet can never be a good thing, so make --set-mss only lower the MSS in a packet. Yes, I am aware of --clamp-mss-to-pmtu, but it doesn't work for outgoing connections from clients (ie web traffic), as it only looks at the PMTU on the destination route, not the source of the packet (the DSL interfaces in question have a 1442 byte MTU while the destination ethernet interface is 1500 -- there are problematic hosts which use a 1300 byte MTU). Reworking that is probably a good idea at some point, but it's more work than this is. Signed-off-by: Benjamin LaHaise <bcrl@kvack.org> Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/netfilter/xt_TCPMSS.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/net/netfilter/xt_TCPMSS.c b/net/netfilter/xt_TCPMSS.c
index e4ee4bc81ff3..a1bc77fcd681 100644
--- a/net/netfilter/xt_TCPMSS.c
+++ b/net/netfilter/xt_TCPMSS.c
@@ -88,8 +88,11 @@ tcpmss_mangle_packet(struct sk_buff *skb,
88 88
89 oldmss = (opt[i+2] << 8) | opt[i+3]; 89 oldmss = (opt[i+2] << 8) | opt[i+3];
90 90
91 if (info->mss == XT_TCPMSS_CLAMP_PMTU && 91 /* Never increase MSS, even when setting it, as
92 oldmss <= newmss) 92 * doing so results in problems for hosts that rely
93 * on MSS being set correctly.
94 */
95 if (oldmss <= newmss)
93 return 0; 96 return 0;
94 97
95 opt[i+2] = (newmss & 0xff00) >> 8; 98 opt[i+2] = (newmss & 0xff00) >> 8;