merge: branch 'bg/sleep-unmanaged-rh1855563'

https://bugzilla.redhat.com/show_bug.cgi?id=1855563
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/580

(cherry picked from commit 116c49fceb)

(cherry picked from commit 90cb61f8fd)

(cherry picked from commit 2dae6833ad)

(cherry picked from commit 3c960a9f2b)

(cherry picked from commit f8f2326715)
This commit is contained in:
Beniamino Galvani 2020-07-21 09:01:09 +02:00 committed by Thomas Haller
commit aa150c7bfb
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
2 changed files with 27 additions and 9 deletions

View file

@ -5904,8 +5904,9 @@ do_sleep_wake (NMManager *self, gboolean sleeping_changed)
} else {
_LOGD (LOGD_SUSPEND, "sleep: %s...", waking_from_suspend ? "waking up" : "re-enabling");
sleep_devices_clear (self);
if (waking_from_suspend) {
sleep_devices_clear (self);
c_list_for_each_entry (device, &priv->devices_lst_head, devices_lst) {
if (nm_device_is_software (device))
continue;

View file

@ -1807,7 +1807,7 @@ device_state_changed (NMDevice *device,
if ( sett_conn
&& old_state >= NM_DEVICE_STATE_PREPARE
&& old_state <= NM_DEVICE_STATE_ACTIVATED) {
gboolean block_no_secrets = FALSE;
gboolean blocked = FALSE;
int tries;
guint64 con_v;
@ -1827,15 +1827,32 @@ device_state_changed (NMDevice *device,
*/
con_v = nm_settings_connection_get_last_secret_agent_version_id (sett_conn);
if ( con_v == 0
|| con_v == nm_agent_manager_get_agent_version_id (priv->agent_mgr))
block_no_secrets = TRUE;
|| con_v == nm_agent_manager_get_agent_version_id (priv->agent_mgr)) {
_LOGD (LOGD_DEVICE, "connection '%s' now blocked from autoconnect due to no secrets",
nm_settings_connection_get_id (sett_conn));
nm_settings_connection_autoconnect_blocked_reason_set (sett_conn,
NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_NO_SECRETS,
TRUE);
blocked = TRUE;
}
} else if (nm_device_state_reason_check (reason) == NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED) {
/* A connection that fails due to dependency-failed is not
* able to reconnect until the master connection activates
* again; when this happens, the master clears the blocked
* reason for all its slaves in activate_slave_connections()
* and tries to reconnect them. For this to work, the slave
* should be marked as blocked when it fails with
* dependency-failed.
*/
_LOGD (LOGD_DEVICE, "connection '%s' now blocked from autoconnect due to failed dependency",
nm_settings_connection_get_id (sett_conn));
nm_settings_connection_autoconnect_blocked_reason_set (sett_conn,
NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_FAILED,
TRUE);
blocked = TRUE;
}
if (block_no_secrets) {
_LOGD (LOGD_DEVICE, "connection '%s' now blocked from autoconnect due to no secrets",
nm_settings_connection_get_id (sett_conn));
nm_settings_connection_autoconnect_blocked_reason_set (sett_conn, NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_NO_SECRETS, TRUE);
} else {
if (!blocked) {
tries = nm_settings_connection_autoconnect_retries_get (sett_conn);
if (tries > 0) {
_LOGD (LOGD_DEVICE, "connection '%s' failed to autoconnect; %d tries left",