Commit 5976aed8 authored by Eric Dumazet's avatar Eric Dumazet Committed by Ben Hutchings

ipv6: Limit mtu to 65575 bytes

[ Upstream commit 30f78d8e ]

Francois reported that setting big mtu on loopback device could prevent
tcp sessions making progress.

We do not support (yet ?) IPv6 Jumbograms and cook corrupted packets.

We must limit the IPv6 MTU to (65535 + 40) bytes in theory.

Tested:

ifconfig lo mtu 70000
netperf -H ::1

Before patch : Throughput :   0.05 Mbits

After patch : Throughput : 35484 Mbits
Reported-by: default avatarFrancois WELLENREITER <f.wellenreiter@gmail.com>
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Acked-by: default avatarYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Acked-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent b14b1404
...@@ -34,6 +34,11 @@ struct route_info { ...@@ -34,6 +34,11 @@ struct route_info {
#define RT6_LOOKUP_F_SRCPREF_PUBLIC 0x00000010 #define RT6_LOOKUP_F_SRCPREF_PUBLIC 0x00000010
#define RT6_LOOKUP_F_SRCPREF_COA 0x00000020 #define RT6_LOOKUP_F_SRCPREF_COA 0x00000020
/* We do not (yet ?) support IPv6 jumbograms (RFC 2675)
* Unlike IPv4, hdr->seg_len doesn't include the IPv6 header
*/
#define IP6_MAX_MTU (0xFFFF + sizeof(struct ipv6hdr))
/* /*
* rt6_srcprefs2flags() and rt6_flags2srcprefs() translate * rt6_srcprefs2flags() and rt6_flags2srcprefs() translate
* between IPV6_ADDR_PREFERENCES socket option values * between IPV6_ADDR_PREFERENCES socket option values
......
...@@ -1056,7 +1056,7 @@ static unsigned int ip6_mtu(const struct dst_entry *dst) ...@@ -1056,7 +1056,7 @@ static unsigned int ip6_mtu(const struct dst_entry *dst)
unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); unsigned int mtu = dst_metric_raw(dst, RTAX_MTU);
if (mtu) if (mtu)
return mtu; goto out;
mtu = IPV6_MIN_MTU; mtu = IPV6_MIN_MTU;
...@@ -1066,7 +1066,8 @@ static unsigned int ip6_mtu(const struct dst_entry *dst) ...@@ -1066,7 +1066,8 @@ static unsigned int ip6_mtu(const struct dst_entry *dst)
mtu = idev->cnf.mtu6; mtu = idev->cnf.mtu6;
rcu_read_unlock(); rcu_read_unlock();
return mtu; out:
return min_t(unsigned int, mtu, IP6_MAX_MTU);
} }
static struct dst_entry *icmp6_dst_gc_list; static struct dst_entry *icmp6_dst_gc_list;
......
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