make route metrics default to 0
authorFelix Fietkau <nbd@openwrt.org>
Fri, 9 Mar 2012 09:58:07 +0000 (10:58 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Fri, 9 Mar 2012 09:58:07 +0000 (10:58 +0100)
interface-ip.c
system-linux.c

index 612fd5f..51612fa 100644 (file)
@@ -89,8 +89,6 @@ 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);
 
        if ((cur = tb[ROUTE_METRIC]) != NULL)
                route->metric = blobmsg_get_u32(cur);
-       else
-               route->metric = -1;
 
        if ((cur = tb[ROUTE_MTU]) != NULL)
                route->mtu = blobmsg_get_u32(cur);
 
        if ((cur = tb[ROUTE_MTU]) != NULL)
                route->mtu = blobmsg_get_u32(cur);
index 6345b7f..4a8c03d 100644 (file)
@@ -888,7 +888,7 @@ static int system_rt(struct device *dev, struct device_route *route, int cmd)
        if (route->mask)
                nla_put(msg, RTA_DST, alen, &route->addr);
 
        if (route->mask)
                nla_put(msg, RTA_DST, alen, &route->addr);
 
-       if (route->metric >= 0)
+       if (route->metric > 0)
                nla_put_u32(msg, RTA_PRIORITY, route->metric);
 
        if (have_gw)
                nla_put_u32(msg, RTA_PRIORITY, route->metric);
 
        if (have_gw)