mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 11:19:16 +02:00
route-manager: normalize ipv6 route metrics during comparison
IPv6 metric of zero is equal to 1024.
(cherry picked from commit 7c52d094ed)
This commit is contained in:
parent
af36a41440
commit
3ed98d2a42
1 changed files with 5 additions and 1 deletions
|
|
@ -25,6 +25,8 @@
|
||||||
#include "nm-platform.h"
|
#include "nm-platform.h"
|
||||||
#include "nm-logging.h"
|
#include "nm-logging.h"
|
||||||
|
|
||||||
|
#include "NetworkManagerUtils.h"
|
||||||
|
|
||||||
G_DEFINE_TYPE (NMRouteManager, nm_route_manager, G_TYPE_OBJECT)
|
G_DEFINE_TYPE (NMRouteManager, nm_route_manager, G_TYPE_OBJECT)
|
||||||
|
|
||||||
static NMRouteManager *_instance;
|
static NMRouteManager *_instance;
|
||||||
|
|
@ -56,11 +58,13 @@ array_contains_ip6_route (const GArray *routes, const NMPlatformIP6Route *route)
|
||||||
|
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
NMPlatformIP6Route *c = &g_array_index (routes, NMPlatformIP6Route, 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) &&
|
if (IN6_ARE_ADDR_EQUAL (&route->network, &c->network) &&
|
||||||
route->plen == c->plen &&
|
route->plen == c->plen &&
|
||||||
IN6_ARE_ADDR_EQUAL (&route->gateway, &c->gateway) &&
|
IN6_ARE_ADDR_EQUAL (&route->gateway, &c->gateway) &&
|
||||||
route->metric == c->metric)
|
route_metric == c_metric)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue