core: unblock failed connections when the master is available

In case the connection is blocked because it failed, the availability
of a master is a good reason to unblock it so that it can be tried
again.

Fixes: a1ea422aad
This commit is contained in:
Beniamino Galvani
2017-09-28 16:43:06 +02:00
parent b80ee4a72c
commit 32efb87d4d

View File

@@ -1586,6 +1586,7 @@ activate_slave_connections (NMPolicy *self, NMDevice *device)
guint i;
NMActRequest *req;
gboolean internal_activation = FALSE;
gs_free NMSettingsConnection **connections = NULL;
master_device = nm_device_get_iface (device);
g_assert (master_device);
@@ -1609,28 +1610,34 @@ activate_slave_connections (NMPolicy *self, NMDevice *device)
internal_activation = subject && nm_auth_subject_is_internal (subject);
}
if (!internal_activation) {
gs_free NMSettingsConnection **connections = NULL;
connections = nm_settings_get_connections_sorted (priv->settings, NULL);
for (i = 0; connections[i]; i++) {
NMConnection *slave;
NMSettingConnection *s_slave_con;
const char *slave_master;
connections = nm_settings_get_connections_sorted (priv->settings, NULL);
slave = NM_CONNECTION (connections[i]);
for (i = 0; connections[i]; i++) {
NMConnection *slave;
NMSettingConnection *s_slave_con;
const char *slave_master;
s_slave_con = nm_connection_get_setting_connection (slave);
g_assert (s_slave_con);
slave_master = nm_setting_connection_get_master (s_slave_con);
if (!slave_master)
continue;
slave = NM_CONNECTION (connections[i]);
if ( nm_streq0 (slave_master, master_device)
|| nm_streq0 (slave_master, master_uuid_applied)
|| nm_streq0 (slave_master, master_uuid_settings)) {
NMSettingsConnection *settings = NM_SETTINGS_CONNECTION (slave);
NMSettingsAutoconnectBlockedReason reason;
s_slave_con = nm_connection_get_setting_connection (slave);
g_assert (s_slave_con);
slave_master = nm_setting_connection_get_master (s_slave_con);
if (!slave_master)
continue;
if (!internal_activation)
nm_settings_connection_reset_autoconnect_retries (settings);
if ( !g_strcmp0 (slave_master, master_device)
|| !g_strcmp0 (slave_master, master_uuid_applied)
|| !g_strcmp0 (slave_master, master_uuid_settings))
nm_settings_connection_reset_autoconnect_retries (NM_SETTINGS_CONNECTION (slave));
reason = nm_settings_connection_get_autoconnect_blocked_reason (settings);
if (reason == NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_FAILED) {
reason = NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_UNBLOCKED;
nm_settings_connection_set_autoconnect_blocked_reason (settings, reason);
}
}
}