mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-12 02:10:19 +01:00
core: properly deactivate active connections that fail early
If a master activation failed early (eg, because the virtual device could not be created), then the slaves were not being notified of the failure. Fix that.
This commit is contained in:
parent
5cac8dad79
commit
072dca8ad0
1 changed files with 21 additions and 10 deletions
|
|
@ -2942,6 +2942,22 @@ _new_active_connection (NMManager *self,
|
|||
device);
|
||||
}
|
||||
|
||||
static void
|
||||
_internal_activation_failed (NMManager *self,
|
||||
NMActiveConnection *active,
|
||||
const char *error_desc)
|
||||
{
|
||||
nm_log_warn (LOGD_CORE, "Failed to activate '%s': %s",
|
||||
nm_connection_get_id (nm_active_connection_get_connection (active)),
|
||||
error_desc);
|
||||
|
||||
if (nm_active_connection_get_state (active) <= NM_ACTIVE_CONNECTION_STATE_ACTIVATED) {
|
||||
nm_active_connection_set_state (active, NM_ACTIVE_CONNECTION_STATE_DEACTIVATING);
|
||||
nm_active_connection_set_state (active, NM_ACTIVE_CONNECTION_STATE_DEACTIVATED);
|
||||
}
|
||||
active_connection_remove (self, active);
|
||||
}
|
||||
|
||||
static void
|
||||
_internal_activation_auth_done (NMActiveConnection *active,
|
||||
gboolean success,
|
||||
|
|
@ -2956,12 +2972,9 @@ _internal_activation_auth_done (NMActiveConnection *active,
|
|||
if (_internal_activate_generic (self, active, &error))
|
||||
return;
|
||||
}
|
||||
g_assert (error_desc || error);
|
||||
|
||||
active_connection_remove (self, active);
|
||||
nm_log_warn (LOGD_CORE, "Failed to activate '%s': %s",
|
||||
nm_connection_get_id (nm_active_connection_get_connection (active)),
|
||||
error_desc ? error_desc : error->message);
|
||||
g_assert (error_desc || error);
|
||||
_internal_activation_failed (self, active, error_desc ? error_desc : error->message);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
|
||||
|
|
@ -3130,8 +3143,8 @@ activation_auth_done (NMActiveConnection *active,
|
|||
error_desc);
|
||||
}
|
||||
|
||||
active_connection_remove (self, active);
|
||||
dbus_g_method_return_error (context, error);
|
||||
_internal_activation_failed (self, active, error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
|
|
@ -3275,10 +3288,8 @@ activation_add_done (NMSettings *self,
|
|||
error = local;
|
||||
}
|
||||
|
||||
active_connection_remove (info->manager, info->active);
|
||||
|
||||
if (error)
|
||||
dbus_g_method_return_error (context, error);
|
||||
_internal_activation_failed (info->manager, info->active, error->message);
|
||||
dbus_g_method_return_error (context, error);
|
||||
g_clear_error (&local);
|
||||
|
||||
done:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue