summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2014-10-24 13:48:46 -0400
committerDan Winship <danw@gnome.org>2014-10-29 09:14:03 -0400
commitace746df4e2936ab50224d9fbef88025b69d2379 (patch)
tree21c7b733aeb4dc55edf5c0b7d4b0361adeb899a5
parent9f739d0c61c303ae2bb72afc86a74583773ed6a5 (diff)
downloadNetworkManager-ace746df4e2936ab50224d9fbef88025b69d2379.tar.gz
platform: deal with default route being passed to route_sync() (bgo 735325)
NMIP4Configs and NMIP6Configs are never supposed to contain a default route, and thus nm_platform_ip6_route_sync() should never have to deal with one. Unfortunately, if it *does* get passed a default route, it will add it even if it was already there. This will result in an RTM_NEWROUTE notification, which will cause NMPlatform to emit ip6-route-changed, which will result in NMDevice doing some work and then calling nm_ip6_config_commit(), which will result in NMIP6Config passing the same list of routes to nm_platform_ip6_route_sync() again, including the default route, which will cause NMPlatform to add the route again... (Something eventually causes this cycle to get broken, but it starts up again the next time NM receives an RA.) Fix this by having the route_sync() functions never add/modify the default route (They were already not deleting it.)
-rw-r--r--src/platform/nm-platform.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index 75e6448d2b..5d478e87d4 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -2014,6 +2014,9 @@ array_contains_ip6_route (const GArray *routes, const NMPlatformIP6Route *route)
* with the least possible disturbance. It simply removes routes that are
* not listed and adds routes that are.
*
+ * @known_routes should not contain a default route; if it does, it will be
+ * ignored.
+ *
* Returns: %TRUE on success.
*/
gboolean
@@ -2044,6 +2047,9 @@ nm_platform_ip4_route_sync (int ifindex, const GArray *known_routes)
for (i = 0; i < known_routes->len && success; i++) {
known_route = &g_array_index (known_routes, NMPlatformIP4Route, i);
+ if (NM_PLATFORM_IP_ROUTE_IS_DEFAULT (known_route))
+ continue;
+
if ((known_route->gateway == 0) ^ (i_type != 0)) {
/* Make two runs over the list of routes. On the first, only add
* device routes, on the second the others (gateway routes). */
@@ -2081,6 +2087,9 @@ nm_platform_ip4_route_sync (int ifindex, const GArray *known_routes)
* with the least possible disturbance. It simply removes routes that are
* not listed and adds routes that are.
*
+ * @known_routes should not contain a default route; if it does, it will be
+ * ignored.
+ *
* Returns: %TRUE on success.
*/
gboolean
@@ -2112,6 +2121,9 @@ nm_platform_ip6_route_sync (int ifindex, const GArray *known_routes)
for (i = 0; i < known_routes->len && success; i++) {
known_route = &g_array_index (known_routes, NMPlatformIP6Route, i);
+ if (NM_PLATFORM_IP_ROUTE_IS_DEFAULT (known_route))
+ continue;
+
if (IN6_IS_ADDR_UNSPECIFIED (&known_route->gateway) ^ (i_type != 0)) {
/* Make two runs over the list of routes. On the first, only add
* device routes, on the second the others (gateway routes). */