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 d97eab6c5a)
This commit is contained in:
Aleksander Morgado 2018-05-25 02:31:59 +02:00 committed by Thomas Haller
parent 0a69572cae
commit eebaf181d5

View file

@ -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);