From eebaf181d5d18a7e53415532ee6acde2c1a44e07 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Fri, 25 May 2018 02:31:59 +0200 Subject: [PATCH] policy: don't block connection if device is gone If the active connection is deactivated because the device is gone, don't block autoconnection. Otherwise, whenever the device comes back (e.g. maybe it was reset in the middle of a connection attempt), the autoconnection logic won't be triggered, as the settings are still blocked. I'm able to reproduce this by performing a WWAN modem reset in the middle of a connection attempt. https://github.com/NetworkManager/NetworkManager/pull/121 (cherry picked from commit d97eab6c5a809a114cdd1cc54e447503ad253835) --- src/nm-policy.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/nm-policy.c b/src/nm-policy.c index 2bf25d5044..54b3595d76 100644 --- a/src/nm-policy.c +++ b/src/nm-policy.c @@ -1172,9 +1172,11 @@ pending_ac_state_changed (NMActiveConnection *ac, guint state, guint reason, NMP * device, but block the current connection to avoid an activation * loop. */ - con = nm_active_connection_get_settings_connection (ac); - nm_settings_connection_autoconnect_blocked_reason_set (con, NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_FAILED, TRUE); - schedule_activate_check (self, nm_active_connection_get_device (ac)); + if (reason != NM_ACTIVE_CONNECTION_STATE_REASON_DEVICE_DISCONNECTED) { + con = nm_active_connection_get_settings_connection (ac); + nm_settings_connection_autoconnect_blocked_reason_set (con, NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_FAILED, TRUE); + schedule_activate_check (self, nm_active_connection_get_device (ac)); + } /* Cleanup */ g_signal_handlers_disconnect_by_func (ac, pending_ac_state_changed, self);