diff options
author | Thomas Haller <thaller@redhat.com> | 2017-11-07 16:26:58 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-11-10 12:59:43 +0100 |
commit | c566138d300fddcd553a723f98ecabff704729f4 (patch) | |
tree | fe7cbdac2e75fbb80d5aa944d42c51dcf74d7aa6 | |
parent | 16de730fac402797eb82216bfd29778699af45ce (diff) | |
download | NetworkManager-c566138d300fddcd553a723f98ecabff704729f4.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.c | 4 | ||||
-rw-r--r-- | src/platform/nm-platform.c | 9 | ||||
-rw-r--r-- | src/platform/nm-platform.h | 3 |
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; \ |