Blob Blame History Raw
From 9a98bc74462c11e7906195d359644ca853377170 Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@gnome.org>
Date: Tue, 29 Apr 2014 11:06:53 -0400
Subject: [PATCH] core: fix connection matching with IPv6 routes (rh #1086237)

An IPv6 router may have sent us arbitrary routes, so don't consider
them when comparing two method=auto connections.

(A better fix would be to look at the route lifetime, to see if it's
dynamic or static, but we don't currently have that information.)

https://bugzilla.gnome.org/show_bug.cgi?id=729203
---
 src/nm-ip6-config.c | 4 ++++
 1 file changed, 4 insertions(+)

diff -up NetworkManager-0.9.9.1/src/nm-ip6-config.c.ipv6 NetworkManager-0.9.9.1/src/nm-ip6-config.c
--- NetworkManager-0.9.9.1/src/nm-ip6-config.c.ipv6	2014-05-12 08:02:40.862188963 -0400
+++ NetworkManager-0.9.9.1/src/nm-ip6-config.c	2014-05-12 08:04:36.251198172 -0400
@@ -430,7 +430,7 @@ nm_ip6_config_update_setting (const NMIP
 	/* Routes */
 	for (i = 0; i < nroutes; i++) {
 		const NMPlatformIP6Route *route = nm_ip6_config_get_route (config, i);
-		NMIP6Route *s_route = nm_ip6_route_new ();
+		NMIP6Route *s_route;
 
 		/* Ignore link-local route. */
 		if (IN6_IS_ADDR_LINKLOCAL (&route->network))
@@ -440,6 +440,11 @@ nm_ip6_config_update_setting (const NMIP
 		if (!route->plen)
 			continue;
 
+		/* Assume all routes on 'auto' connections came from the router. */
+		if (!g_strcmp0 (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO))
+			continue;
+
+		s_route = nm_ip6_route_new ();
 		nm_ip6_route_set_dest (s_route, &route->network);
 		nm_ip6_route_set_prefix (s_route, route->plen);
 		if (!IN6_IS_ADDR_UNSPECIFIED (&route->network))
@@ -447,6 +452,7 @@ nm_ip6_config_update_setting (const NMIP
 		nm_ip6_route_set_metric (s_route, route->metric);
 
 		nm_setting_ip6_config_add_route (setting, s_route);
+		nm_ip6_route_unref (s_route);
 	}
 
 	/* DNS */