summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2015-01-23 20:39:15 +0100
committerLubomir Rintel <lkundrak@v3.sk>2015-01-26 13:30:51 +0100
commit644547db904554bc665d8cf76dc8e432d92e2ad9 (patch)
treeaaa6c63b9be3845c1bdbaf69c88e6fd1c8b77a63
parent816c5c980828663ae7b6ceddb0a1a3afebca1d6f (diff)
downloadNetworkManager-644547db904554bc665d8cf76dc8e432d92e2ad9.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;
}