netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Gibson <metalcaedes@gmail.com>
To: netfilter-devel@vger.kernel.org
Subject: TCPMSS clamp-mss-to-pmtu breaks packets that have no MSS set (incl. solution)
Date: Fri, 30 Jul 2010 03:01:21 +0200	[thread overview]
Message-ID: <4C522461.4070000@gmail.com> (raw)

Hi,

clamp-mss-to-pmtu (as used in "iptables -A FORWARD -p tcp --tcp-flags 
SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu") sets a possibly much to high 
MSS (the one it got from PMTU) in packets that had no MSS set before.
RFC 879 says "HOSTS MUST NOT SEND DATAGRAMS LARGER THAN 576 OCTETS 
UNLESS THEY HAVE SPECIFIC KNOWLEDGE THAT THE DESTINATION HOST IS 
PREPARED TO ACCEPT LARGER DATAGRAMS."
That means that if no MSS was set by a server, one must not send packets 
with a MSS > 536 to that server.
clamp-mss-to-pmtu however ignores this and, if no MSS was set in a 
packet, sets the MSS determined by PMTU, often something like 1452, so 
much to big packets are sent to the host that conforms to the RFC but, 
braindead as it is, blocks "ICMP Fragmentation needed" packets.
So the connection times out after some retries that are all dropped on 
the remote firewall or whatever because the packets are to big.
By the way, this bug seems to be present since kernel 2.4.3 (when TCPMSS 
was introduced).

The solution: If no MSS was set in the packet and "newmss", as 
determined by PMTU, is > 536, set "newmss" to 536 before applying it to 
the packet.
I think this is the only sane fix:
* Leaving it as it is now obviously breaks the RFC
* I realized that not setting a MSS for a packet that had none set 
before (or always setting 536) might cause trouble if the MSS determined 
by PMTU is (for whatever reason) < 536.

See http://bugzilla.netfilter.org/show_bug.cgi?id=662 for further 
information and a (really simple) patch.

Cheers,
- Daniel

PS: The bugreport mentions that http://research.microsoft.com doesn't 
work because of this bug - it seem like Microsoft has fixed this 
recently. They still don't send a MSS, but they accept larger packets now.

             reply	other threads:[~2010-07-30  1:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-30  1:01 Daniel Gibson [this message]
2010-08-02 15:16 ` TCPMSS clamp-mss-to-pmtu breaks packets that have no MSS set (incl. solution) Jan Engelhardt
2010-08-03  7:29   ` Nepenthes Development Team
2010-08-23  1:45     ` Daniel Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C522461.4070000@gmail.com \
    --to=metalcaedes@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).