platform: consider RTNH_F_ONLINK onlink flag for IPv4 routes

The "onlink" flag for IPv4 routes is part of the route ID.
Consider it in nm_platform_ip4_route_cmp().

Also, allow configuring the flag when adding a route.

Note that for IPv6, the onlink flag is still ignored.
Pretty much like kernel does.
This commit is contained in:
Thomas Haller
2017-11-07 16:26:58 +01:00
parent 81778f59f2
commit 88a40f960c
3 changed files with 11 additions and 5 deletions

View File

@@ -2690,7 +2690,9 @@ _nl_msg_new_route (int nlmsg_type,
? nm_platform_route_scope_inv (obj->ip4_route.scope_inv)
: RT_SCOPE_NOWHERE,
.rtm_type = RTN_UNICAST,
.rtm_flags = 0,
.rtm_flags = obj->ip_route.r_rtm_flags & (is_v4
? (unsigned) (RTNH_F_ONLINK)
: (unsigned) 0),
.rtm_dst_len = obj->ip_route.plen,
.rtm_src_len = is_v4
? 0