summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-08-23 14:43:15 +0200
committerThomas Haller <thaller@redhat.com>2017-08-24 11:03:45 +0200
commite470e1392242a088573c4fc317b7b5ffaca4df19 (patch)
treecc91238f4118590014986138ecc726e6e4dffe95
parent10ac675299cb3d734ae9bb720919dff1d4f1abbf (diff)
downloadNetworkManager-th/platform-route-pt3.tar.gz
core: don't suppress host route to gateway in ip-config caputureth/platform-route-pt3
Why would we do this? The route is there, so, add it. This revises commit 4fba2260f3e14a13f37499bd46ffcb220fdc5a4c which added this check for matching generated connections. I don't think this is still necessary, and if it is, then the matching should be relaxed instead. It's bad to hide routes from NMIP4Config/NMIP6Config, because those routes are also exported via D-Bus.
-rw-r--r--src/nm-ip4-config.c15
-rw-r--r--src/nm-ip6-config.c14
2 files changed, 10 insertions, 19 deletions
diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c
index cd3b9a8c14..ca35d5b92a 100644
--- a/src/nm-ip4-config.c
+++ b/src/nm-ip4-config.c
@@ -681,16 +681,6 @@ nm_ip4_config_capture (NMDedupMultiIndex *multi_idx, NMPlatform *platform, int i
continue;
if (NM_PLATFORM_IP_ROUTE_IS_DEFAULT (route))
continue;
-
- if ( priv->has_gateway
- && route->plen == 32
- && route->network == priv->gateway
- && route->gateway == 0) {
- /* If there is a host route to the gateway, ignore that route. It is
- * automatically added by NetworkManager when needed.
- */
- continue;
- }
_add_route (self, plobj, NULL);
}
@@ -928,6 +918,11 @@ nm_ip4_config_merge_setting (NMIP4Config *self, NMSettingIPConfig *setting, guin
NMIPRoute *s_route = nm_setting_ip_config_get_route (setting, i);
NMPlatformIP4Route route;
+ if (nm_ip_route_get_family (s_route) != AF_INET) {
+ nm_assert_not_reached ();
+ continue;
+ }
+
memset (&route, 0, sizeof (route));
nm_ip_route_get_dest_binary (s_route, &route.network);
diff --git a/src/nm-ip6-config.c b/src/nm-ip6-config.c
index d95398f6bb..b2eccf3767 100644
--- a/src/nm-ip6-config.c
+++ b/src/nm-ip6-config.c
@@ -483,15 +483,6 @@ nm_ip6_config_capture (NMDedupMultiIndex *multi_idx, NMPlatform *platform, int i
if (NM_PLATFORM_IP_ROUTE_IS_DEFAULT (route))
continue;
- if ( has_gateway
- && route->plen == 128
- && IN6_ARE_ADDR_EQUAL (&route->network, &priv->gateway)
- && IN6_IS_ADDR_UNSPECIFIED (&route->gateway)) {
- /* If there is a host route to the gateway, ignore that route. It is
- * automatically added by NetworkManager when needed.
- */
- continue;
- }
_add_route (self, plobj, NULL);
}
@@ -656,6 +647,11 @@ nm_ip6_config_merge_setting (NMIP6Config *self, NMSettingIPConfig *setting, guin
NMIPRoute *s_route = nm_setting_ip_config_get_route (setting, i);
NMPlatformIP6Route route;
+ if (nm_ip_route_get_family (s_route) != AF_INET6) {
+ nm_assert_not_reached ();
+ continue;
+ }
+
memset (&route, 0, sizeof (route));
nm_ip_route_get_dest_binary (s_route, &route.network);