]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ipv4: Cap ADVMSS metric in the FIB rather than the routing cache.
authorDavid S. Miller <davem@davemloft.net>
Mon, 18 Jun 2012 02:47:34 +0000 (19:47 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 18 Jun 2012 02:47:34 +0000 (19:47 -0700)
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>
net/ipv4/fib_semantics.c
net/ipv4/route.c

index e5b7182fa099e683ee0484b3772c9aa58eba0d2f..415f8230fc88a3ca8bc89e54b550998bfb4321e8 100644 (file)
@@ -779,9 +779,14 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
                        int type = nla_type(nla);
 
                        if (type) {
+                               u32 val;
+
                                if (type > RTAX_MAX)
                                        goto err_inval;
-                               fi->fib_metrics[type - 1] = nla_get_u32(nla);
+                               val = nla_get_u32(nla);
+                               if (type == RTAX_ADVMSS && val > 65535 - 40)
+                                       val = 65535 - 40;
+                               fi->fib_metrics[type - 1] = val;
                        }
                }
        }
index 41df5297a412e9f2ad722f1f28846d609bbe4ea6..a91f6d33804cd706f8a8037314951ea34ec7ef00 100644 (file)
@@ -1951,8 +1951,6 @@ static void rt_set_nexthop(struct rtable *rt, const struct flowi4 *fl4,
 
        if (dst_mtu(dst) > IP_MAX_MTU)
                dst_metric_set(dst, RTAX_MTU, IP_MAX_MTU);
-       if (dst_metric_raw(dst, RTAX_ADVMSS) > 65535 - 40)
-               dst_metric_set(dst, RTAX_ADVMSS, 65535 - 40);
 
 #ifdef CONFIG_IP_ROUTE_CLASSID
 #ifdef CONFIG_IP_MULTIPLE_TABLES