struct nl_msg *msg;
- dev = addr->device;
- if (dev) {
- if (!dev->ifindex)
- return -1;
-
- ifa.ifa_index = dev->ifindex;
- }
-
msg = nlmsg_alloc_simple(cmd, 0);
if (!msg)
return -1;
if (cmd == RTM_NEWROUTE)
flags |= NLM_F_CREATE | NLM_F_REPLACE;
- dev = route->device;
- if (dev) {
- if (!dev->ifindex)
- return -1;
-
- ifindex = dev->ifindex;
- }
-
msg = nlmsg_alloc_simple(cmd, flags);
if (!msg)
return -1;
if (route->mask)
nla_put(msg, RTA_DST, alen, &route->addr);
+ if (route->metric >= 0)
+ nla_put_u32(msg, RTA_PRIORITY, route->metric);
+
if (have_gw)
nla_put(msg, RTA_GATEWAY, alen, &route->nexthop);