mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-04 20:20:17 +01:00
settings: let invisible connection not autoconnect according to is_blocked() function
Previously, NMPolicy would explicitly check whether the connection is not visible,
to skip autoconnect.
We have nm_settings_connection_autoconnect_is_blocked() function, that can do that.
The advantage is, that at various places we call nm_settings_connection_autoconnect_is_blocked()
to determine whether autoconnect is blocked. By declaring invisible connections
as blocked from autoconnect as well, we short-cut various autoconnection attempts,
that previoulsy only failed later during auto_activate_device().
(cherry picked from commit ccc93639a0)
This commit is contained in:
parent
ab24d5356c
commit
446c86f4be
2 changed files with 23 additions and 10 deletions
|
|
@ -1224,9 +1224,7 @@ auto_activate_device (NMPolicy *self,
|
|||
NMSettingConnection *s_con;
|
||||
const char *permission;
|
||||
|
||||
if ( !NM_FLAGS_HAS (nm_settings_connection_get_flags (candidate),
|
||||
NM_SETTINGS_CONNECTION_FLAGS_VISIBLE)
|
||||
|| nm_settings_connection_autoconnect_is_blocked (candidate))
|
||||
if (nm_settings_connection_autoconnect_is_blocked (candidate))
|
||||
continue;
|
||||
|
||||
s_con = nm_connection_get_setting_connection (NM_CONNECTION (candidate));
|
||||
|
|
@ -2384,9 +2382,10 @@ connection_flags_changed (NMSettings *settings,
|
|||
NMPolicy *self = _PRIV_TO_SELF (priv);
|
||||
|
||||
if (NM_FLAGS_HAS (nm_settings_connection_get_flags (connection),
|
||||
NM_SETTINGS_CONNECTION_FLAGS_VISIBLE))
|
||||
schedule_activate_all (self);
|
||||
else
|
||||
NM_SETTINGS_CONNECTION_FLAGS_VISIBLE)) {
|
||||
if (!nm_settings_connection_autoconnect_is_blocked (connection))
|
||||
schedule_activate_all (self);
|
||||
} else
|
||||
_deactivate_if_active (self, connection);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2734,11 +2734,25 @@ nm_settings_connection_autoconnect_blocked_reason_set_full (NMSettingsConnection
|
|||
gboolean
|
||||
nm_settings_connection_autoconnect_is_blocked (NMSettingsConnection *self)
|
||||
{
|
||||
NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
|
||||
NMSettingsConnectionPrivate *priv;
|
||||
NMSettingsConnectionFlags flags;
|
||||
|
||||
return priv->autoconnect_blocked_reason != NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_NONE
|
||||
|| priv->autoconnect_retries == 0
|
||||
|| NM_FLAGS_HAS (nm_settings_connection_get_flags (self), NM_SETTINGS_CONNECTION_FLAGS_VOLATILE);
|
||||
g_return_val_if_fail (NM_IS_SETTINGS_CONNECTION (self), TRUE);
|
||||
|
||||
priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
|
||||
|
||||
if (priv->autoconnect_blocked_reason != NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_NONE)
|
||||
return TRUE;
|
||||
if (priv->autoconnect_retries == 0)
|
||||
return TRUE;
|
||||
|
||||
flags = priv->flags;
|
||||
if (NM_FLAGS_HAS (flags, NM_SETTINGS_CONNECTION_FLAGS_VOLATILE))
|
||||
return TRUE;
|
||||
if (!NM_FLAGS_HAS (flags, NM_SETTINGS_CONNECTION_FLAGS_VISIBLE))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue