From: Hans Dedecker Date: Wed, 7 May 2014 09:19:07 +0000 (+0000) Subject: netifd: Effectively apply configured route mtu X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=5dc8988377cccbdd9a520f21000d2cea1fc76f7f;p=project%2Fnetifd.git netifd: Effectively apply configured route mtu Signed-off-by: Hans Dedecker --- diff --git a/interface-ip.c b/interface-ip.c index a82d8e7..33b5d43 100644 --- a/interface-ip.c +++ b/interface-ip.c @@ -581,7 +581,7 @@ interface_update_proto_route(struct vlist_tree *tree, if (node_old && node_new) keep = !memcmp(&route_old->nexthop, &route_new->nexthop, sizeof(route_old->nexthop)) && - !route_old->failed; + (route_old->mtu == route_new->mtu) && !route_old->failed; if (node_old) { if (!(route_old->flags & DEVADDR_EXTERNAL) && route_old->enabled && !keep) diff --git a/system-linux.c b/system-linux.c index 8f46705..b513948 100644 --- a/system-linux.c +++ b/system-linux.c @@ -1260,7 +1260,22 @@ static int system_rt(struct device *dev, struct device_route *route, int cmd) if (table >= 256) nla_put_u32(msg, RTA_TABLE, table); + if (route->flags & DEVROUTE_MTU) { + struct nlattr *metrics; + + if (!(metrics = nla_nest_start(msg, RTA_METRICS))) + goto nla_put_failure; + + nla_put_u32(msg, RTAX_MTU, route->mtu); + + nla_nest_end(msg, metrics); + } + return system_rtnl_call(msg); + +nla_put_failure: + nlmsg_free(msg); + return -ENOMEM; } int system_add_route(struct device *dev, struct device_route *route)