diff --git a/src/nm-route-manager.c b/src/nm-route-manager.c index fbccb2e827..18c0432c38 100644 --- a/src/nm-route-manager.c +++ b/src/nm-route-manager.c @@ -612,7 +612,7 @@ _vx_route_sync (const VTableIP *vtable, NMRouteManager *self, int ifindex, const * device routes, on the second the others (gateway routes). */ continue; } - vtable->vt->route_add (priv->platform, 0, rest_route); + vtable->vt->route_add (priv->platform, 0, rest_route, -1); } } g_array_unref (to_restore_routes); @@ -656,7 +656,7 @@ _vx_route_sync (const VTableIP *vtable, NMRouteManager *self, int ifindex, const || route_id_cmp_result != 0 || !_route_equals_ignoring_ifindex (vtable, cur_plat_route, cur_ipx_route)) { - if (!vtable->vt->route_add (priv->platform, ifindex, cur_ipx_route)) { + if (!vtable->vt->route_add (priv->platform, ifindex, cur_ipx_route, -1)) { if (cur_ipx_route->rx.source < NM_IP_CONFIG_SOURCE_USER) { _LOGD (vtable->vt->addr_family, "ignore error adding IPv%c route to kernel: %s", diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c index ed0d3c4340..b534b273d2 100644 --- a/src/platform/nm-platform.c +++ b/src/platform/nm-platform.c @@ -2947,7 +2947,7 @@ log_ip6_route (NMPlatform *self, NMPObjectType obj_type, int ifindex, NMPlatform /******************************************************************/ static gboolean -_vtr_v4_route_add (NMPlatform *self, int ifindex, const NMPlatformIPXRoute *route) +_vtr_v4_route_add (NMPlatform *self, int ifindex, const NMPlatformIPXRoute *route, gint64 metric) { return nm_platform_ip4_route_add (self, ifindex > 0 ? ifindex : route->rx.ifindex, @@ -2956,12 +2956,12 @@ _vtr_v4_route_add (NMPlatform *self, int ifindex, const NMPlatformIPXRoute *rout route->rx.plen, route->r4.gateway, route->r4.pref_src, - route->rx.metric, + metric >= 0 ? (guint32) metric : route->rx.metric, route->rx.mss); } static gboolean -_vtr_v6_route_add (NMPlatform *self, int ifindex, const NMPlatformIPXRoute *route) +_vtr_v6_route_add (NMPlatform *self, int ifindex, const NMPlatformIPXRoute *route, gint64 metric) { return nm_platform_ip6_route_add (self, ifindex > 0 ? ifindex : route->rx.ifindex, @@ -2969,7 +2969,7 @@ _vtr_v6_route_add (NMPlatform *self, int ifindex, const NMPlatformIPXRoute *rout route->r6.network, route->rx.plen, route->r6.gateway, - route->rx.metric, + metric >= 0 ? (guint32) metric : route->rx.metric, route->rx.mss); } diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h index 9bfb22b1a7..1b5bfb1575 100644 --- a/src/platform/nm-platform.h +++ b/src/platform/nm-platform.h @@ -315,7 +315,7 @@ typedef struct { int (*route_cmp) (const NMPlatformIPXRoute *a, const NMPlatformIPXRoute *b); const char *(*route_to_string) (const NMPlatformIPXRoute *route); GArray *(*route_get_all) (NMPlatform *self, int ifindex, NMPlatformGetRouteFlags flags); - gboolean (*route_add) (NMPlatform *self, int ifindex, const NMPlatformIPXRoute *route); + gboolean (*route_add) (NMPlatform *self, int ifindex, const NMPlatformIPXRoute *route, gint64 metric); gboolean (*route_delete) (NMPlatform *self, int ifindex, const NMPlatformIPXRoute *route); gboolean (*route_delete_default) (NMPlatform *self, int ifindex, guint32 metric); guint32 (*metric_normalize) (guint32 metric);