From 0e8a14cc5f7028aec65dd058b777689ceb7703fc Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Sun, 1 Feb 2015 09:09:37 +0100 Subject: [PATCH] cli: don't look up a device for activation request unless we have to Let the server decide which device to use if the user didn't explicitly specify the interface, wireless access point or a wimax nsp. The server will just reuse the device for an already active connection or potentially do a better guess. https://bugzilla.gnome.org/show_bug.cgi?id=730492 --- clients/cli/connections.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/clients/cli/connections.c b/clients/cli/connections.c index 6de3440652..9223866216 100644 --- a/clients/cli/connections.c +++ b/clients/cli/connections.c @@ -1723,6 +1723,7 @@ find_device_for_connection (NmCli *nmc, int i, j; g_return_val_if_fail (nmc != NULL, FALSE); + g_return_val_if_fail (iface || ap || nsp, FALSE); g_return_val_if_fail (device != NULL && *device == NULL, FALSE); g_return_val_if_fail (spec_object != NULL && *spec_object == NULL, FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); @@ -2208,7 +2209,7 @@ nmc_activate_connection (NmCli *nmc, g_return_val_if_fail (nmc != NULL, FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - if (connection) { + if (connection && (ifname || ap || nsp)) { device_found = find_device_for_connection (nmc, connection, ifname, ap, nsp, &device, &spec_object, &local); /* Virtual connection may not have their interfaces created yet */ @@ -2226,7 +2227,7 @@ nmc_activate_connection (NmCli *nmc, _("unknown device '%s'."), ifname); return FALSE; } - } else { + } else if (!connection) { g_set_error_literal (error, NMCLI_ERROR, NMC_RESULT_ERROR_NOT_FOUND, _("neither a valid connection nor device given")); return FALSE;