mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
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>
This commit is contained in:
parent
5943634fc5
commit
710ab6c031
2 changed files with 3 additions and 6 deletions
|
@ -794,6 +794,8 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
|
||||||
val = nla_get_u32(nla);
|
val = nla_get_u32(nla);
|
||||||
if (type == RTAX_ADVMSS && val > 65535 - 40)
|
if (type == RTAX_ADVMSS && val > 65535 - 40)
|
||||||
val = 65535 - 40;
|
val = 65535 - 40;
|
||||||
|
if (type == RTAX_MTU && val > 65535 - 15)
|
||||||
|
val = 65535 - 15;
|
||||||
fi->fib_metrics[type - 1] = val;
|
fi->fib_metrics[type - 1] = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1763,21 +1763,16 @@ static void rt_set_nexthop(struct rtable *rt, const struct flowi4 *fl4,
|
||||||
const struct fib_result *res,
|
const struct fib_result *res,
|
||||||
struct fib_info *fi, u16 type, u32 itag)
|
struct fib_info *fi, u16 type, u32 itag)
|
||||||
{
|
{
|
||||||
struct dst_entry *dst = &rt->dst;
|
|
||||||
|
|
||||||
if (fi) {
|
if (fi) {
|
||||||
if (FIB_RES_GW(*res) &&
|
if (FIB_RES_GW(*res) &&
|
||||||
FIB_RES_NH(*res).nh_scope == RT_SCOPE_LINK)
|
FIB_RES_NH(*res).nh_scope == RT_SCOPE_LINK)
|
||||||
rt->rt_gateway = FIB_RES_GW(*res);
|
rt->rt_gateway = FIB_RES_GW(*res);
|
||||||
rt_init_metrics(rt, fl4, fi);
|
rt_init_metrics(rt, fl4, fi);
|
||||||
#ifdef CONFIG_IP_ROUTE_CLASSID
|
#ifdef CONFIG_IP_ROUTE_CLASSID
|
||||||
dst->tclassid = FIB_RES_NH(*res).nh_tclassid;
|
rt->dst.tclassid = FIB_RES_NH(*res).nh_tclassid;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dst_mtu(dst) > IP_MAX_MTU)
|
|
||||||
dst_metric_set(dst, RTAX_MTU, IP_MAX_MTU);
|
|
||||||
|
|
||||||
#ifdef CONFIG_IP_ROUTE_CLASSID
|
#ifdef CONFIG_IP_ROUTE_CLASSID
|
||||||
#ifdef CONFIG_IP_MULTIPLE_TABLES
|
#ifdef CONFIG_IP_MULTIPLE_TABLES
|
||||||
set_class_tag(rt, fib_rules_tclass(res));
|
set_class_tag(rt, fib_rules_tclass(res));
|
||||||
|
|
Loading…
Add table
Reference in a new issue