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-13 11:35:44 +0100
commit88a40f960c5d1546f1966ff2223d28f87e2f054b (patch)
tree3fd5de7c2d6a503c6eb7b5095653653224a185a0
parent81778f59f2f11fad74fce355561618e6da129939 (diff)
downloadNetworkManager-88a40f960c5d1546f1966ff2223d28f87e2f054b.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.c9
-rw-r--r--src/platform/nm-platform.h3
3 files changed, 11 insertions, 5 deletions
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index 66ca9dc3ac..46b7bd209e 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 076bc409d5..f94d93e257 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -5574,6 +5574,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,
@@ -5599,7 +5600,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,
@@ -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, initrwnd);
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_cwnd);
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, 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 47421318c8..3336642b8b 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; \