netifd: Effectively apply configured route mtu
authorHans Dedecker <dedeckeh@gmail.com>
Wed, 7 May 2014 09:19:07 +0000 (09:19 +0000)
committerSteven Barth <steven@midlink.org>
Fri, 9 May 2014 13:50:33 +0000 (15:50 +0200)
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
interface-ip.c
system-linux.c

index a82d8e70f2acfcbce85ee78ac09f0da6470f2c3f..33b5d4326d3b3ecf20026201f8382533577bf65b 100644 (file)
@@ -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)
index 8f46705d5f63670fa9c0eb9de2fa792c141e9dd1..b513948cd7d4df4056acb08d0fe2b1cccaa8d599 100644 (file)
@@ -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)