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:
@@ -2690,7 +2690,9 @@ _nl_msg_new_route (int nlmsg_type,
|
|||||||
? nm_platform_route_scope_inv (obj->ip4_route.scope_inv)
|
? nm_platform_route_scope_inv (obj->ip4_route.scope_inv)
|
||||||
: RT_SCOPE_NOWHERE,
|
: RT_SCOPE_NOWHERE,
|
||||||
.rtm_type = RTN_UNICAST,
|
.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_dst_len = obj->ip_route.plen,
|
||||||
.rtm_src_len = is_v4
|
.rtm_src_len = is_v4
|
||||||
? 0
|
? 0
|
||||||
|
@@ -5574,6 +5574,7 @@ nm_platform_ip4_route_hash_update (const NMPlatformIP4Route *obj, NMPlatformIPRo
|
|||||||
obj->initcwnd,
|
obj->initcwnd,
|
||||||
obj->initrwnd,
|
obj->initrwnd,
|
||||||
obj->mtu,
|
obj->mtu,
|
||||||
|
obj->r_rtm_flags & RTNH_F_ONLINK,
|
||||||
NM_HASH_COMBINE_BOOLS (guint8,
|
NM_HASH_COMBINE_BOOLS (guint8,
|
||||||
obj->lock_window,
|
obj->lock_window,
|
||||||
obj->lock_cwnd,
|
obj->lock_cwnd,
|
||||||
@@ -5599,7 +5600,7 @@ nm_platform_ip4_route_hash_update (const NMPlatformIP4Route *obj, NMPlatformIPRo
|
|||||||
obj->initcwnd,
|
obj->initcwnd,
|
||||||
obj->initrwnd,
|
obj->initrwnd,
|
||||||
obj->mtu,
|
obj->mtu,
|
||||||
obj->r_rtm_flags & RTM_F_CLONED,
|
obj->r_rtm_flags & (RTM_F_CLONED | RTNH_F_ONLINK),
|
||||||
NM_HASH_COMBINE_BOOLS (guint8,
|
NM_HASH_COMBINE_BOOLS (guint8,
|
||||||
obj->lock_window,
|
obj->lock_window,
|
||||||
obj->lock_cwnd,
|
obj->lock_cwnd,
|
||||||
@@ -5663,6 +5664,8 @@ nm_platform_ip4_route_cmp (const NMPlatformIP4Route *a, const NMPlatformIP4Route
|
|||||||
NM_CMP_FIELD (a, b, initcwnd);
|
NM_CMP_FIELD (a, b, initcwnd);
|
||||||
NM_CMP_FIELD (a, b, initrwnd);
|
NM_CMP_FIELD (a, b, initrwnd);
|
||||||
NM_CMP_FIELD (a, b, mtu);
|
NM_CMP_FIELD (a, b, mtu);
|
||||||
|
NM_CMP_DIRECT (a->r_rtm_flags & RTNH_F_ONLINK,
|
||||||
|
b->r_rtm_flags & RTNH_F_ONLINK);
|
||||||
NM_CMP_FIELD_UNSAFE (a, b, lock_window);
|
NM_CMP_FIELD_UNSAFE (a, b, lock_window);
|
||||||
NM_CMP_FIELD_UNSAFE (a, b, lock_cwnd);
|
NM_CMP_FIELD_UNSAFE (a, b, lock_cwnd);
|
||||||
NM_CMP_FIELD_UNSAFE (a, b, lock_initcwnd);
|
NM_CMP_FIELD_UNSAFE (a, b, lock_initcwnd);
|
||||||
@@ -5697,8 +5700,8 @@ nm_platform_ip4_route_cmp (const NMPlatformIP4Route *a, const NMPlatformIP4Route
|
|||||||
NM_CMP_FIELD (a, b, mss);
|
NM_CMP_FIELD (a, b, mss);
|
||||||
NM_CMP_FIELD (a, b, pref_src);
|
NM_CMP_FIELD (a, b, pref_src);
|
||||||
if (cmp_type == NM_PLATFORM_IP_ROUTE_CMP_TYPE_SEMANTICALLY) {
|
if (cmp_type == NM_PLATFORM_IP_ROUTE_CMP_TYPE_SEMANTICALLY) {
|
||||||
NM_CMP_DIRECT (a->r_rtm_flags & RTM_F_CLONED,
|
NM_CMP_DIRECT (a->r_rtm_flags & (RTM_F_CLONED | RTNH_F_ONLINK),
|
||||||
b->r_rtm_flags & RTM_F_CLONED);
|
b->r_rtm_flags & (RTM_F_CLONED | RTNH_F_ONLINK));
|
||||||
} else
|
} else
|
||||||
NM_CMP_FIELD (a, b, r_rtm_flags);
|
NM_CMP_FIELD (a, b, r_rtm_flags);
|
||||||
NM_CMP_FIELD (a, b, tos);
|
NM_CMP_FIELD (a, b, tos);
|
||||||
|
@@ -400,7 +400,8 @@ typedef union {
|
|||||||
* do not exist from the point-of-view of platform users.
|
* do not exist from the point-of-view of platform users.
|
||||||
* Such a route is not alive, according to nmp_object_is_alive().
|
* Such a route is not alive, according to nmp_object_is_alive().
|
||||||
*
|
*
|
||||||
* XXX: currently we ignore all flags except RTM_F_CLONED.
|
* XXX: currently we ignore all flags except RTM_F_CLONED
|
||||||
|
* and RTNH_F_ONLINK for IPv4.
|
||||||
* We also may not properly consider the flags as part of the ID
|
* We also may not properly consider the flags as part of the ID
|
||||||
* in route-cmp. */ \
|
* in route-cmp. */ \
|
||||||
unsigned r_rtm_flags; \
|
unsigned r_rtm_flags; \
|
||||||
|
Reference in New Issue
Block a user