struct blob_attr *tb[__ROUTE_MAX], *cur;
struct device_route *route;
int af = v6 ? AF_INET6 : AF_INET;
+ bool no_device = false;
blobmsg_parse(route_attr, __ROUTE_MAX, tb, blobmsg_data(attr), blobmsg_data_len(attr));
return;
if (!iface) {
- if ((cur = tb[ROUTE_INTERFACE]) == NULL)
- return;
+ if ((cur = tb[ROUTE_INTERFACE]) == NULL) {
+ iface = vlist_find(&interfaces, "loopback", iface, node);
+ no_device = true;
+ } else {
+ iface = vlist_find(&interfaces, blobmsg_data(cur), iface, node);
+ }
- iface = vlist_find(&interfaces, blobmsg_data(cur), iface, node);
if (!iface)
return;
route->flags |= DEVROUTE_PROTO;
}
- interface_set_route_info(iface, route);
+ if (no_device)
+ route->flags |= DEVROUTE_NODEV;
+ else
+ interface_set_route_info(iface, route);
+
vlist_add(&ip->route, &route->node, route);
return;
/* neighbor mac address */
DEVNEIGH_MAC = (1 << 11),
+
+ /* route specifies no device */
+ DEVROUTE_NODEV = (1 << 12),
};
union if_addr {