From b278b2cd72ca176af2c4d56c65508ef3c862013c Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Wed, 15 Mar 2017 16:22:55 +0100 Subject: [PATCH] device: ethernet: fix handling of autoconnect retries for non-802.1x Commit 4a6fd0e83ec0 ("device: honor the connection.autoconnect-retries for 802.1X") added a reset of the autoconnect retries when the device changes state, because the retry logic for 802.1x is implemented in NMDeviceEthernet. For other connections, we should not reset the retries as NMPolicy handles them. Fixes: 4a6fd0e83ec0d83547b1f3a1a916f85e9f450d8c --- src/devices/nm-device-ethernet.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/devices/nm-device-ethernet.c b/src/devices/nm-device-ethernet.c index 55867516f2..9b39e2ad11 100644 --- a/src/devices/nm-device-ethernet.c +++ b/src/devices/nm-device-ethernet.c @@ -256,13 +256,14 @@ _update_s390_subchannels (NMDeviceEthernet *self) } static void -reset_autoconnect_retries (NMDevice *device) +reset_8021x_autoconnect_retries (NMDevice *device) { NMActRequest *req; NMSettingsConnection *connection; req = nm_device_get_act_request (device); - if (req) { + if ( req + && nm_device_get_applied_setting (device, NM_TYPE_SETTING_802_1X)) { connection = nm_act_request_get_settings_connection (req); g_return_if_fail (connection); /* Reset autoconnect retries on success, failure, or when deactivating */ @@ -279,10 +280,11 @@ device_state_changed (NMDevice *device, if (new_state > NM_DEVICE_STATE_ACTIVATED) wired_secrets_cancel (NM_DEVICE_ETHERNET (device)); - if ( new_state == NM_DEVICE_STATE_ACTIVATED - || new_state == NM_DEVICE_STATE_FAILED - || new_state == NM_DEVICE_STATE_DISCONNECTED) - reset_autoconnect_retries (device); + if (NM_IN_SET (new_state, + NM_DEVICE_STATE_ACTIVATED, + NM_DEVICE_STATE_FAILED, + NM_DEVICE_STATE_DISCONNECTED)) + reset_8021x_autoconnect_retries (device); } static void @@ -1367,7 +1369,7 @@ deactivate (NMDevice *device) GError *error = NULL; /* Clear wired secrets tries when deactivating */ - reset_autoconnect_retries (device); + reset_8021x_autoconnect_retries (device); nm_clear_g_source (&priv->pppoe_wait_id);