netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH 3/5] netfilter: xt_TCPMSS: Fix violation of RFC879 in absence of MSS option
Date: Mon, 10 Jun 2013 18:07:39 +0200	[thread overview]
Message-ID: <1370880461-4265-4-git-send-email-pablo@netfilter.org> (raw)
In-Reply-To: <1370880461-4265-1-git-send-email-pablo@netfilter.org>

From: Phil Oester <kernel@linuxace.com>

The clamp-mss-to-pmtu option of the xt_TCPMSS target can cause issues
connecting to websites if there was no MSS option present in the
original SYN packet from the client. In these cases, it may add a
MSS higher than the default specified in RFC879. Fix this by never
setting a value > 536 if no MSS option was specified by the client.

This closes netfilter's bugzilla #662.

Signed-off-by: Phil Oester <kernel@linuxace.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/xt_TCPMSS.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/netfilter/xt_TCPMSS.c b/net/netfilter/xt_TCPMSS.c
index a75240f..afaebc7 100644
--- a/net/netfilter/xt_TCPMSS.c
+++ b/net/netfilter/xt_TCPMSS.c
@@ -125,6 +125,12 @@ tcpmss_mangle_packet(struct sk_buff *skb,
 
 	skb_put(skb, TCPOLEN_MSS);
 
+	/* RFC 879 states that the default MSS is 536 without specific
+	 * knowledge that the destination host is prepared to accept larger.
+	 * Since no MSS was provided, we MUST NOT set a value > 536.
+	 */
+	newmss = min(newmss, (u16)536);
+
 	opt = (u_int8_t *)tcph + sizeof(struct tcphdr);
 	memmove(opt + TCPOLEN_MSS, opt, tcplen - sizeof(struct tcphdr));
 
-- 
1.7.10.4

  parent reply	other threads:[~2013-06-10 16:07 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-10 16:07 [PATCH 0/5] netfilter fixes for 3.10-rc5 Pablo Neira Ayuso
2013-06-10 16:07 ` [PATCH 1/5] netfilter: nfnetlink_acct: fix incomplete dumping of objects Pablo Neira Ayuso
2013-06-10 16:07 ` [PATCH 2/5] netfilter: nfnetlink_cttimeout: " Pablo Neira Ayuso
2013-06-10 16:07 ` Pablo Neira Ayuso [this message]
2013-06-11  8:43   ` [PATCH 3/5] netfilter: xt_TCPMSS: Fix violation of RFC879 in absence of MSS option David Laight
2013-06-10  7:19     ` Phil Oester
2013-06-11 15:00       ` David Laight
2013-06-10  8:27         ` Phil Oester
2013-06-11 16:09           ` David Laight
2013-06-11 16:25             ` Pablo Neira Ayuso
2013-06-11 18:00               ` Jeff Haran
2013-06-11 18:14                 ` Rick Jones
2013-06-11 18:31                   ` Jeff Haran
2013-06-21  8:27                     ` Jan Engelhardt
2013-06-11 18:36   ` John Heffner
2013-06-10 16:07 ` [PATCH 4/5] netfilter: nfnetlink_queue: fix missing HW protocol Pablo Neira Ayuso
2013-06-10 16:07 ` [PATCH 5/5] ipvs: info leak in __ip_vs_get_dest_entries() Pablo Neira Ayuso
2013-06-10 20:32 ` [PATCH 0/5] netfilter fixes for 3.10-rc5 David Miller

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=1370880461-4265-4-git-send-email-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --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).