summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2015-01-23 20:39:15 +0100
committerLubomir Rintel <lkundrak@v3.sk>2015-02-27 16:48:28 +0100
commit7c52d094ed33a2c1a9549a6b4917a68845cab251 (patch)
tree877514ff6420671eed7909dc86efee46b0c9de28
parent72cefd5162e53b071dd781c3ac54cfd4034a0328 (diff)
downloadNetworkManager-7c52d094ed33a2c1a9549a6b4917a68845cab251.tar.gz
route-manager: normalize ipv6 route metrics during comparison
IPv6 metric of zero is equal to 1024.
-rw-r--r--src/nm-route-manager.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/nm-route-manager.c b/src/nm-route-manager.c
index bd393c3b95..a1fae89575 100644
--- a/src/nm-route-manager.c
+++ b/src/nm-route-manager.c
@@ -25,6 +25,8 @@
#include "nm-platform.h"
#include "nm-logging.h"
+#include "NetworkManagerUtils.h"
+
G_DEFINE_TYPE (NMRouteManager, nm_route_manager, G_TYPE_OBJECT)
static NMRouteManager *_instance;
@@ -56,11 +58,13 @@ array_contains_ip6_route (const GArray *routes, const NMPlatformIP6Route *route)
for (i = 0; i < len; i++) {
NMPlatformIP6Route *c = &g_array_index (routes, NMPlatformIP6Route, i);
+ int route_metric = nm_utils_ip6_route_metric_normalize (route->metric);
+ int c_metric = nm_utils_ip6_route_metric_normalize (c->metric);
if (IN6_ARE_ADDR_EQUAL (&route->network, &c->network) &&
route->plen == c->plen &&
IN6_ARE_ADDR_EQUAL (&route->gateway, &c->gateway) &&
- route->metric == c->metric)
+ route_metric == c_metric)
return TRUE;
}