store a pointer to the active interface as part of the device route
[project/netifd.git] / interface-ip.c
index bbf2ccf..c0ba381 100644 (file)
@@ -94,7 +94,8 @@ interface_ip_add_route(struct interface *iface, struct blob_attr *attr, bool v6)
        if ((cur = tb[ROUTE_MTU]) != NULL)
                route->mtu = blobmsg_get_u32(cur);
 
-       vlist_add(&ip->route, &route->node, &route->mask);
+       route->iface = ip->iface;
+       vlist_add(&ip->route, &route->node, &route->flags);
        return;
 
 error:
@@ -105,14 +106,14 @@ static int
 addr_cmp(const void *k1, const void *k2, void *ptr)
 {
        return memcmp(k1, k2, sizeof(struct device_addr) -
-                     offsetof(struct device_addr, mask));
+                     offsetof(struct device_addr, flags));
 }
 
 static int
 route_cmp(const void *k1, const void *k2, void *ptr)
 {
        return memcmp(k1, k2, sizeof(struct device_route) -
-                     offsetof(struct device_route, mask));
+                     offsetof(struct device_route, flags));
 }
 
 static void
@@ -177,7 +178,7 @@ enable_route(struct interface_ip_settings *ip, struct device_route *route)
        if (ip->no_defaultroute && !route->mask)
                return false;
 
-       return true;
+       return ip->enabled;
 }
 
 static void