summaryrefslogtreecommitdiff
path: root/src/platform/nm-platform.h
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-07-19 13:03:28 +0200
committerThomas Haller <thaller@redhat.com>2017-08-03 18:32:59 +0200
commita041e431dac5ddcdb5946634082cb626f3c67340 (patch)
treeefe3cab0fc9e40a059005c701ddad9aeb14fd3b3 /src/platform/nm-platform.h
parent5a422af0d1a128989313727d787b585afb2451c4 (diff)
downloadNetworkManager-a041e431dac5ddcdb5946634082cb626f3c67340.tar.gz
platform: use correct scope for deleting IPv4 route
Refactor _nl_msg_new_route() to obtain the route scope (rtm_scope) from the NMPObject, instead of a separate argument. That way, when deleting an IPv4 route, we don't pick the first route that matches (RT_SCOPE_NOWHERE), but use the actual scope of the route that we want to delete. That matters, if there are more then one otherwise identical routes that only differ by their scope. For kernel, the scope of IPv6 routes is always global (RT_SCOPE_UNIVERSE). Also, during ip4_route_add() initialize the intermediate @obj to have the values as we expect them after adding the route. That is necessary to use it in _nl_msg_new_route(). But also nicer for consistency. Also, move the scope_inv field in NMPlatformIP4Route to let the other in_addr_t fields life side by side.
Diffstat (limited to 'src/platform/nm-platform.h')
-rw-r--r--src/platform/nm-platform.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h
index 7f14626d8f..326abcdf21 100644
--- a/src/platform/nm-platform.h
+++ b/src/platform/nm-platform.h
@@ -379,13 +379,22 @@ struct _NMPlatformIP4Route {
in_addr_t network;
in_addr_t gateway;
- /* The bitwise inverse of the route scope. It is inverted so that the
- * default value (RT_SCOPE_NOWHERE) is nul. */
- guint8 scope_inv;
-
/* RTA_PREFSRC/rtnl_route_get_pref_src(). A value of zero means that
* no pref-src is set. */
in_addr_t pref_src;
+
+ /* The bitwise inverse of the route scope rtm_scope. It is inverted so that the
+ * default value (RT_SCOPE_NOWHERE) is zero. Use nm_platform_route_scope_inv()
+ * to convert back and forth between the inverese representation and the
+ * real value.
+ *
+ * rtm_scope is part of the primary key for IPv4 routes. When deleting a route,
+ * the scope must match, unless it is left at RT_SCOPE_NOWHERE, in which case the first
+ * matching route is deleted.
+ *
+ * For IPv6 routes, the scope is ignored and kernel always assumes global scope.
+ * Hence, this field is only in NMPlatformIP4Route. */
+ guint8 scope_inv;
};
struct _NMPlatformIP6Route {