mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-29 10:20:11 +01:00
device: fix route metric penalty assignment
When a route has the connectivity check enabled and does not have full connectivity, it should have its route metric penalized, this way this route will not be preferred over others. Fixes-test: @per_device_connectivity_check
This commit is contained in:
parent
8995d44a0b
commit
fcfa598fc2
1 changed files with 3 additions and 24 deletions
|
|
@ -564,9 +564,6 @@ typedef struct _NMDevicePrivate {
|
|||
|
||||
bool up : 1; /* IFF_UP */
|
||||
|
||||
bool default_route_metric_penalty_ip4_has : 1;
|
||||
bool default_route_metric_penalty_ip6_has : 1;
|
||||
|
||||
bool v4_route_table_initialized : 1;
|
||||
bool v6_route_table_initialized : 1;
|
||||
|
||||
|
|
@ -4811,31 +4808,16 @@ nm_device_get_route_metric_default(NMDeviceType device_type)
|
|||
return 11000;
|
||||
}
|
||||
|
||||
/* FIXME(l3cfg): we currently never call this function. We need to react
|
||||
* to changes and re-commit the IP configuration with updated penalty. */
|
||||
_nm_unused static gboolean
|
||||
_dev_default_route_metric_penalty_detect(NMDevice *self, int addr_family)
|
||||
static guint32
|
||||
_dev_default_route_metric_penalty_get(NMDevice *self, int addr_family)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self);
|
||||
const int IS_IPv4 = NM_IS_IPv4(addr_family);
|
||||
|
||||
/* currently we don't differentiate between IPv4 and IPv6 when detecting
|
||||
* connectivity. */
|
||||
if (priv->concheck_x[IS_IPv4].state != NM_CONNECTIVITY_FULL
|
||||
&& nm_connectivity_check_enabled(concheck_get_mgr(self)))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static guint32
|
||||
_dev_default_route_metric_penalty_get(NMDevice *self, int addr_family)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self);
|
||||
|
||||
if (NM_IS_IPv4(addr_family) ? priv->default_route_metric_penalty_ip4_has
|
||||
: priv->default_route_metric_penalty_ip6_has)
|
||||
return 20000;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -14944,9 +14926,6 @@ _cleanup_generic_post(NMDevice *self, CleanupType cleanup_type)
|
|||
priv->v4_route_table_all_sync_before = FALSE;
|
||||
priv->v6_route_table_all_sync_before = FALSE;
|
||||
|
||||
priv->default_route_metric_penalty_ip4_has = FALSE;
|
||||
priv->default_route_metric_penalty_ip6_has = FALSE;
|
||||
|
||||
priv->mtu_force_set_done = FALSE;
|
||||
|
||||
priv->needs_ip6_subnet = FALSE;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue