diff options
-rw-r--r-- | interface-ip.c | 5 | ||||
-rw-r--r-- | interface-ip.h | 3 | ||||
-rw-r--r-- | system-linux.c | 1 |
3 files changed, 9 insertions, 0 deletions
diff --git a/interface-ip.c b/interface-ip.c index 33b5d43..bd6f164 100644 --- a/interface-ip.c +++ b/interface-ip.c @@ -38,6 +38,7 @@ enum { ROUTE_VALID, ROUTE_TABLE, ROUTE_SOURCE, + ROUTE_ONLINK, __ROUTE_MAX }; @@ -51,6 +52,7 @@ static const struct blobmsg_policy route_attr[__ROUTE_MAX] = { [ROUTE_TABLE] = { .name = "table", .type = BLOBMSG_TYPE_STRING }, [ROUTE_VALID] = { .name = "valid", .type = BLOBMSG_TYPE_INT32 }, [ROUTE_SOURCE] = { .name = "source", .type = BLOBMSG_TYPE_STRING }, + [ROUTE_ONLINK] = { .name = "onlink", .type = BLOBMSG_TYPE_BOOL }, }; const struct uci_blob_param_list route_attr_list = { @@ -347,6 +349,9 @@ interface_ip_add_route(struct interface *iface, struct blob_attr *attr, bool v6) route->sourcemask = (mask) ? atoi(mask) : ((af == AF_INET6) ? 128 : 32); } + if ((cur = tb[ROUTE_ONLINK]) != NULL && blobmsg_get_bool(cur)) + route->flags |= DEVROUTE_ONLINK; + if (is_proto_route) { route->table = (v6) ? iface->ip6table : iface->ip4table; route->flags |= DEVROUTE_SRCTABLE; diff --git a/interface-ip.h b/interface-ip.h index de8343d..93d55ee 100644 --- a/interface-ip.h +++ b/interface-ip.h @@ -42,6 +42,9 @@ enum device_addr_flags { /* route resides in default source-route table */ DEVROUTE_SRCTABLE = (1 << 8), + + /* route is on-link */ + DEVROUTE_ONLINK = (1 << 9), }; union if_addr { diff --git a/system-linux.c b/system-linux.c index 06226ef..7447422 100644 --- a/system-linux.c +++ b/system-linux.c @@ -1221,6 +1221,7 @@ static int system_rt(struct device *dev, struct device_route *route, int cmd) .rtm_protocol = (route->flags & DEVADDR_KERNEL) ? RTPROT_KERNEL : RTPROT_STATIC, .rtm_scope = scope, .rtm_type = (cmd == RTM_DELROUTE) ? 0: RTN_UNICAST, + .rtm_flags = (route->flags & DEVROUTE_ONLINK) ? RTNH_F_ONLINK : 0, }; struct nl_msg *msg; |