aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2014-04-11 00:23:36 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-05-31 00:52:14 -0400
commit132da31a0b0143cac11799dafa961c1969ee122c (patch)
treecaf992b272e64c80eef10d82b5c564c93ee01391 /net
parent4902599654b2e606529241d06c5748c48ed6dc87 (diff)
ipv6: Limit mtu to 65575 bytes
[ Upstream commit 30f78d8ebf7f514801e71b88a10c948275168518 ] 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: Francois WELLENREITER <f.wellenreiter@gmail.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/ipv6/route.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 3fde3e977862..b2614b22622b 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1236,7 +1236,7 @@ static unsigned int ip6_mtu(const struct dst_entry *dst)
1236 unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); 1236 unsigned int mtu = dst_metric_raw(dst, RTAX_MTU);
1237 1237
1238 if (mtu) 1238 if (mtu)
1239 return mtu; 1239 goto out;
1240 1240
1241 mtu = IPV6_MIN_MTU; 1241 mtu = IPV6_MIN_MTU;
1242 1242
@@ -1246,7 +1246,8 @@ static unsigned int ip6_mtu(const struct dst_entry *dst)
1246 mtu = idev->cnf.mtu6; 1246 mtu = idev->cnf.mtu6;
1247 rcu_read_unlock(); 1247 rcu_read_unlock();
1248 1248
1249 return mtu; 1249out:
1250 return min_t(unsigned int, mtu, IP6_MAX_MTU);
1250} 1251}
1251 1252
1252static struct dst_entry *icmp6_dst_gc_list; 1253static struct dst_entry *icmp6_dst_gc_list;