From 3d8839927ebd12f69c729b33f1b602ce999def65 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Thu, 30 Jun 2016 14:13:19 +0200 Subject: [PATCH] policy: reset slaves' retry counter only for explicit activations A infinite activation loop can arise when the master repeatedly fails activating: slave's _internal_activate_device() calls ensure_master_active_connection() to activate the master connection and during master activation activate_slave_connections() resets the retry counter of slaves. The autoconnect retry counter of a slave should only be reset for explicit master activations, not for auto-activations. https://bugzilla.redhat.com/show_bug.cgi?id=1270814 --- src/nm-policy.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/nm-policy.c b/src/nm-policy.c index 0c63b1cba6..0af67425ed 100644 --- a/src/nm-policy.c +++ b/src/nm-policy.c @@ -1023,8 +1023,10 @@ activate_slave_connections (NMPolicy *self, NMDevice *device) { NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE (self); const char *master_device, *master_uuid_settings = NULL, *master_uuid_applied = NULL; - GSList *connections, *iter; + gs_free_slist GSList *connections = NULL; + GSList *iter; NMActRequest *req; + gboolean internal_activation = FALSE; master_device = nm_device_get_iface (device); g_assert (master_device); @@ -1032,6 +1034,7 @@ activate_slave_connections (NMPolicy *self, NMDevice *device) req = nm_device_get_act_request (device); if (req) { NMConnection *con; + NMAuthSubject *subject; con = nm_active_connection_get_applied_connection (NM_ACTIVE_CONNECTION (req)); if (con) @@ -1042,9 +1045,14 @@ activate_slave_connections (NMPolicy *self, NMDevice *device) if (!g_strcmp0 (master_uuid_settings, master_uuid_applied)) master_uuid_settings = NULL; } + + subject = nm_active_connection_get_subject (NM_ACTIVE_CONNECTION (req)); + internal_activation = subject && nm_auth_subject_is_internal (subject); } - connections = nm_settings_get_connections_sorted (priv->settings); + if (!internal_activation) + connections = nm_settings_get_connections_sorted (priv->settings); + for (iter = connections; iter; iter = g_slist_next (iter)) { NMConnection *slave; NMSettingConnection *s_slave_con; @@ -1065,8 +1073,6 @@ activate_slave_connections (NMPolicy *self, NMDevice *device) nm_settings_connection_reset_autoconnect_retries (NM_SETTINGS_CONNECTION (slave)); } - g_slist_free (connections); - schedule_activate_all (self); }