Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipv4: Cap ADVMSS metric in the FIB rather than the routing cache.

It makes no sense to execute this limit test every time we create a
routing cache entry.

We can't simply error out on these things since we've silently
accepted and truncated them forever.

Signed-off-by: David S. Miller <davem@davemloft.net>

+6 -3
+6 -1
net/ipv4/fib_semantics.c
··· 779 779 int type = nla_type(nla); 780 780 781 781 if (type) { 782 + u32 val; 783 + 782 784 if (type > RTAX_MAX) 783 785 goto err_inval; 784 - fi->fib_metrics[type - 1] = nla_get_u32(nla); 786 + val = nla_get_u32(nla); 787 + if (type == RTAX_ADVMSS && val > 65535 - 40) 788 + val = 65535 - 40; 789 + fi->fib_metrics[type - 1] = val; 785 790 } 786 791 } 787 792 }
-2
net/ipv4/route.c
··· 1951 1951 1952 1952 if (dst_mtu(dst) > IP_MAX_MTU) 1953 1953 dst_metric_set(dst, RTAX_MTU, IP_MAX_MTU); 1954 - if (dst_metric_raw(dst, RTAX_ADVMSS) > 65535 - 40) 1955 - dst_metric_set(dst, RTAX_ADVMSS, 65535 - 40); 1956 1954 1957 1955 #ifdef CONFIG_IP_ROUTE_CLASSID 1958 1956 #ifdef CONFIG_IP_MULTIPLE_TABLES