Commit 08629354 authored by Florian Westphal's avatar Florian Westphal Committed by David S. Miller

tcp: syncookies: reduce mss table to four values

Halve mss table size to make blind cookie guessing more difficult.
This is sad since the tables were already small, but there
is little alternative except perhaps adding more precise mss information
in the tcp timestamp.  Timestamps are unfortunately not ubiquitous.

Guessing all possible cookie values still has 8-in 2**32 chance.
Reported-by: default avatarJakob Lell <jakob@jakoblell.com>
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8c27bd75
...@@ -136,22 +136,22 @@ static __u32 check_tcp_syn_cookie(__u32 cookie, __be32 saddr, __be32 daddr, ...@@ -136,22 +136,22 @@ static __u32 check_tcp_syn_cookie(__u32 cookie, __be32 saddr, __be32 daddr,
} }
/* /*
* MSS Values are taken from the 2009 paper * MSS Values are chosen based on the 2011 paper
* 'Measuring TCP Maximum Segment Size' by S. Alcock and R. Nelson: * 'An Analysis of TCP Maximum Segement Sizes' by S. Alcock and R. Nelson.
* - values 1440 to 1460 accounted for 80% of observed mss values * Values ..
* - values outside the 536-1460 range are rare (<0.2%). * .. lower than 536 are rare (< 0.2%)
* .. between 537 and 1299 account for less than < 1.5% of observed values
* .. in the 1300-1349 range account for about 15 to 20% of observed mss values
* .. exceeding 1460 are very rare (< 0.04%)
* *
* Table must be sorted. * 1460 is the single most frequently announced mss value (30 to 46% depending
* on monitor location). Table must be sorted.
*/ */
static __u16 const msstab[] = { static __u16 const msstab[] = {
64,
512,
536, 536,
1024, 1300,
1440, 1440, /* 1440, 1452: PPPoE */
1460, 1460,
4312,
8960,
}; };
/* /*
......
...@@ -24,15 +24,18 @@ ...@@ -24,15 +24,18 @@
#define COOKIEBITS 24 /* Upper bits store count */ #define COOKIEBITS 24 /* Upper bits store count */
#define COOKIEMASK (((__u32)1 << COOKIEBITS) - 1) #define COOKIEMASK (((__u32)1 << COOKIEBITS) - 1)
/* Table must be sorted. */ /* RFC 2460, Section 8.3:
* [ipv6 tcp] MSS must be computed as the maximum packet size minus 60 [..]
*
* Due to IPV6_MIN_MTU=1280 the lowest possible MSS is 1220, which allows
* using higher values than ipv4 tcp syncookies.
* The other values are chosen based on ethernet (1500 and 9k MTU), plus
* one that accounts for common encap (PPPoe) overhead. Table must be sorted.
*/
static __u16 const msstab[] = { static __u16 const msstab[] = {
64, 1280 - 60, /* IPV6_MIN_MTU - 60 */
512,
536,
1280 - 60,
1480 - 60, 1480 - 60,
1500 - 60, 1500 - 60,
4460 - 60,
9000 - 60, 9000 - 60,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment