aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-06-17 22:47:34 -0400
committerDavid S. Miller <davem@davemloft.net>2012-06-17 22:47:34 -0400
commit6fac262526ee91ee66210b8919a4297dcf7d544e (patch)
treeb013fa21c5a0940523c431cf6041b1d7aa509dfe /net/ipv4
parenta7e2eaadd0edf6d71637c0d99aca404b0da8c1be (diff)
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>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/fib_semantics.c7
-rw-r--r--net/ipv4/route.c2
2 files changed, 6 insertions, 3 deletions
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index e5b7182fa099..415f8230fc88 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -779,9 +779,14 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
779 int type = nla_type(nla); 779 int type = nla_type(nla);
780 780
781 if (type) { 781 if (type) {
782 u32 val;
783
782 if (type > RTAX_MAX) 784 if (type > RTAX_MAX)
783 goto err_inval; 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 }
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 41df5297a412..a91f6d33804c 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1951,8 +1951,6 @@ static void rt_set_nexthop(struct rtable *rt, const struct flowi4 *fl4,
1951 1951
1952 if (dst_mtu(dst) > IP_MAX_MTU) 1952 if (dst_mtu(dst) > IP_MAX_MTU)
1953 dst_metric_set(dst, RTAX_MTU, IP_MAX_MTU); 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#ifdef CONFIG_IP_ROUTE_CLASSID 1955#ifdef CONFIG_IP_ROUTE_CLASSID
1958#ifdef CONFIG_IP_MULTIPLE_TABLES 1956#ifdef CONFIG_IP_MULTIPLE_TABLES