mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-25 22:20:08 +01:00
platform: add optional @metric argument to route_add() function
Allow overwriting the route metric.
This commit is contained in:
parent
635eea60cf
commit
09fdf58f4d
3 changed files with 7 additions and 7 deletions
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue