Interface metric needs to be assigned to the route metric parameter at route creation time. Otherwise if the interface metric is different from 0 route_cmp will wrongly conclude the routes are different. In this case the route will be added/deleted and could end up with the route missing in the kernel depending on the add/delete order.
Signed-off-by: Hans Dedecker <[email protected]> --- interface-ip.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/interface-ip.c b/interface-ip.c index b1abbc6..d5a3832 100644 --- a/interface-ip.c +++ b/interface-ip.c @@ -322,7 +322,8 @@ interface_ip_add_route(struct interface *iface, struct blob_attr *attr, bool v6) if ((cur = tb[ROUTE_METRIC]) != NULL) { route->metric = blobmsg_get_u32(cur); route->flags |= DEVROUTE_METRIC; - } + } else + route->metric = iface->metric; if ((cur = tb[ROUTE_MTU]) != NULL) { route->mtu = blobmsg_get_u32(cur); @@ -588,9 +589,6 @@ interface_update_proto_route(struct vlist_tree *tree, if (node_new) { bool _enabled = enable_route(ip, route_new); - if (!(route_new->flags & DEVROUTE_METRIC)) - route_new->metric = iface->metric; - if (!(route_new->flags & DEVADDR_EXTERNAL) && !keep && _enabled) if (system_add_route(dev, route_new)) route_new->failed = true; -- 1.7.1 _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
