summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-11-07 16:26:58 +0100
committerThomas Haller <thaller@redhat.com>2017-11-07 20:19:28 +0100
commit40182e51f9fcc547214f85e0369344d3f41e68ed (patch)
tree65d6ddb52f66bed762a259e94b938c076ea4f358
parent23e03d8c53976a30749ee2a1421b23d826be5669 (diff)
downloadNetworkManager-40182e51f9fcc547214f85e0369344d3f41e68ed.tar.gz
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.
-rw-r--r--src/platform/nm-linux-platform.c4
-rw-r--r--src/platform/nm-platform.c7
-rw-r--r--src/platform/nm-platform.h3
3 files changed, 9 insertions, 5 deletions
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index 7ad2385fe4..0607fb2555 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -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
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index 8542fdc553..664af69381 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -5570,6 +5570,7 @@ nm_platform_ip4_route_hash_update (const NMPlatformIP4Route *obj, NMPlatformIPRo
obj->initcwnd,
obj->initrwnd,
obj->mtu,
+ obj->r_rtm_flags & (RTNH_F_ONLINK),
NM_HASH_COMBINE_BOOLS (guint8,
obj->lock_window,
obj->lock_cwnd,
@@ -5595,7 +5596,7 @@ nm_platform_ip4_route_hash_update (const NMPlatformIP4Route *obj, NMPlatformIPRo
obj->initcwnd,
obj->initrwnd,
obj->mtu,
- obj->r_rtm_flags & (RTM_F_CLONED),
+ obj->r_rtm_flags & (RTM_F_CLONED | RTNH_F_ONLINK),
NM_HASH_COMBINE_BOOLS (guint8,
obj->lock_window,
obj->lock_cwnd,
@@ -5693,8 +5694,8 @@ nm_platform_ip4_route_cmp (const NMPlatformIP4Route *a, const NMPlatformIP4Route
NM_CMP_FIELD (a, b, mss);
NM_CMP_FIELD (a, b, pref_src);
if (cmp_type == NM_PLATFORM_IP_ROUTE_CMP_TYPE_SEMANTICALLY) {
- NM_CMP_DIRECT (a->r_rtm_flags & (RTM_F_CLONED),
- b->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 | RTNH_F_ONLINK));
} else
NM_CMP_FIELD (a, b, r_rtm_flags);
NM_CMP_FIELD (a, b, tos);
diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h
index 1eea58dd07..3ee636b747 100644
--- a/src/platform/nm-platform.h
+++ b/src/platform/nm-platform.h
@@ -400,7 +400,8 @@ typedef union {
* do not exist from the point-of-view of platform users.
* 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
* in route-cmp. */ \
unsigned r_rtm_flags; \