diff options
author | David S. Miller <davem@davemloft.net> | 2012-07-10 10:02:09 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-11 01:40:15 -0400 |
commit | 710ab6c03122cf464510f8c86eb0a179e80b2d61 (patch) | |
tree | 062da3050c7a81c0c88a622caf302fe07e109647 /net | |
parent | 5943634fc5592037db0693b261f7f4bea6bb9457 (diff) |
ipv4: Enforce max MTU metric at route insertion time.
Rather than at every struct rtable creation.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/fib_semantics.c | 2 | ||||
-rw-r--r-- | net/ipv4/route.c | 7 |
2 files changed, 3 insertions, 6 deletions
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index ae301c897a19..d71bfbdc0bf4 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
@@ -794,6 +794,8 @@ struct fib_info *fib_create_info(struct fib_config *cfg) | |||
794 | val = nla_get_u32(nla); | 794 | val = nla_get_u32(nla); |
795 | if (type == RTAX_ADVMSS && val > 65535 - 40) | 795 | if (type == RTAX_ADVMSS && val > 65535 - 40) |
796 | val = 65535 - 40; | 796 | val = 65535 - 40; |
797 | if (type == RTAX_MTU && val > 65535 - 15) | ||
798 | val = 65535 - 15; | ||
797 | fi->fib_metrics[type - 1] = val; | 799 | fi->fib_metrics[type - 1] = val; |
798 | } | 800 | } |
799 | } | 801 | } |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 677d65253e4c..1678b575165b 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1763,21 +1763,16 @@ static void rt_set_nexthop(struct rtable *rt, const struct flowi4 *fl4, | |||
1763 | const struct fib_result *res, | 1763 | const struct fib_result *res, |
1764 | struct fib_info *fi, u16 type, u32 itag) | 1764 | struct fib_info *fi, u16 type, u32 itag) |
1765 | { | 1765 | { |
1766 | struct dst_entry *dst = &rt->dst; | ||
1767 | |||
1768 | if (fi) { | 1766 | if (fi) { |
1769 | if (FIB_RES_GW(*res) && | 1767 | if (FIB_RES_GW(*res) && |
1770 | FIB_RES_NH(*res).nh_scope == RT_SCOPE_LINK) | 1768 | FIB_RES_NH(*res).nh_scope == RT_SCOPE_LINK) |
1771 | rt->rt_gateway = FIB_RES_GW(*res); | 1769 | rt->rt_gateway = FIB_RES_GW(*res); |
1772 | rt_init_metrics(rt, fl4, fi); | 1770 | rt_init_metrics(rt, fl4, fi); |
1773 | #ifdef CONFIG_IP_ROUTE_CLASSID | 1771 | #ifdef CONFIG_IP_ROUTE_CLASSID |
1774 | dst->tclassid = FIB_RES_NH(*res).nh_tclassid; | 1772 | rt->dst.tclassid = FIB_RES_NH(*res).nh_tclassid; |
1775 | #endif | 1773 | #endif |
1776 | } | 1774 | } |
1777 | 1775 | ||
1778 | if (dst_mtu(dst) > IP_MAX_MTU) | ||
1779 | dst_metric_set(dst, RTAX_MTU, IP_MAX_MTU); | ||
1780 | |||
1781 | #ifdef CONFIG_IP_ROUTE_CLASSID | 1776 | #ifdef CONFIG_IP_ROUTE_CLASSID |
1782 | #ifdef CONFIG_IP_MULTIPLE_TABLES | 1777 | #ifdef CONFIG_IP_MULTIPLE_TABLES |
1783 | set_class_tag(rt, fib_rules_tclass(res)); | 1778 | set_class_tag(rt, fib_rules_tclass(res)); |