add a flag to keep track of route metric overrides
authorFelix Fietkau <nbd@openwrt.org>
Mon, 19 Mar 2012 22:10:54 +0000 (23:10 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 19 Mar 2012 22:10:54 +0000 (23:10 +0100)
interface-ip.c
interface-ip.h

index 170b03b089d7b8214513bfe9362b24d333d468c6..56f3c0ce6468c7ff62808207eed70b0f40501504 100644 (file)
@@ -86,8 +86,10 @@ interface_ip_add_route(struct interface *iface, struct blob_attr *attr, bool v6)
                }
        }
 
-       if ((cur = tb[ROUTE_METRIC]) != NULL)
+       if ((cur = tb[ROUTE_METRIC]) != NULL) {
                route->metric = blobmsg_get_u32(cur);
+               route->flags |= DEVROUTE_METRIC;
+       }
 
        if ((cur = tb[ROUTE_MTU]) != NULL)
                route->mtu = blobmsg_get_u32(cur);
index 0ce94dfb7cdecb9762b8f5f0427096c236aa1d45..68bfdf647360a4aba319653f2ecc3adf9ec3437a 100644 (file)
@@ -11,6 +11,9 @@ enum device_addr_flags {
 
        /* externally added address */
        DEVADDR_EXTERNAL        = (1 << 2),
+
+       /* route overrides the default interface metric */
+       DEVROUTE_METRIC         = (1 << 3)
 };
 
 union if_addr {