Commit 67d144dd authored by Beniamino Galvani's avatar Beniamino Galvani

cli: check for deactivation failures

If the D-Bus call to DeactivateConnection() fails, don't wait for the
connection to change state because this is not going to
happen. Instead, notify the user of the error and, if necessary, wait
for remaining connections to be deactivated.
parent c4a0002f
......@@ -2642,7 +2642,7 @@ do_connection_down (NmCli *nmc, int argc, char **argv)
NMActiveConnection *active;
ConnectionCbInfo *info = NULL;
const GPtrArray *active_cons;
GSList *queue = NULL, *iter;
GSList *queue = NULL, *iter, *next;
char **arg_arr = NULL;
char **arg_ptr;
int arg_num;
......@@ -2735,17 +2735,36 @@ do_connection_down (NmCli *nmc, int argc, char **argv)
info->timeout_id = g_timeout_add_seconds (nmc->timeout, connection_op_timeout_cb, info);
for (iter = queue; iter; iter = g_slist_next (iter)) {
iter = queue;
while (iter) {
GError *error = NULL;
next = g_slist_next (iter);
active = iter->data;
if (info)
if (info) {
g_signal_connect (active,
G_CALLBACK (down_active_connection_state_cb),
/* Now deactivate the connection */
nm_client_deactivate_connection (nmc->client, active, NULL, NULL);
if (!nm_client_deactivate_connection (nmc->client, active, NULL, &error)) {
g_print (_("Connection '%s' deactivation failed: %s\n"),
nm_active_connection_get_id (active), error->message);
g_error_free (error);
if (info) {
g_signal_handlers_disconnect_by_func (active,
/* Remove the active connection from @queue */
connection_cb_info_finish (info, active);
iter = next;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment