netifd: Don't assume routes are always applied in all cases
authorHans Dedecker <dedeckeh@gmail.com>
Wed, 7 May 2014 09:19:05 +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

index 018b657888b5ad3feec7e54e8e308ea764b4aca2..84586667518cf59acbf498b13f4673879addbbba 100644 (file)
@@ -622,8 +622,10 @@ interface_update_host_route(struct vlist_tree *tree,
                free(route_old);
        }
 
-       if (node_new)
-               system_add_route(dev, route_new);
+       if (node_new) {
+               if (system_add_route(dev, route_new))
+                       route_new->failed = true;
+       }
 }
 
 
@@ -1140,7 +1142,8 @@ void interface_ip_set_enabled(struct interface_ip_settings *ip, bool enabled)
                        if (!(route->flags & DEVROUTE_METRIC))
                                route->metric = ip->iface->metric;
 
-                       system_add_route(dev, route);
+                       if (system_add_route(dev, route))
+                               route->failed = true;
                } else
                        system_del_route(dev, route);
                route->enabled = _enabled;