From cff3e93527b589138efa4beb829e5ed875e40973 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 19 Oct 2015 14:14:17 +0200 Subject: [PATCH] manager: fix activation without specified device For an explicit user-request, we relax some checks when searching for a suitable device; such as requiring-carrier. Without this patch, a connection-up while the device has no carrier yet, would fail right away with "No suitable device found for this connection." https://bugzilla.redhat.com/show_bug.cgi?id=1079353 Fixes: 0bfe635119facb8514e8f5824f599f4c4c3514e2 --- src/nm-manager.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/nm-manager.c b/src/nm-manager.c index db1f26e08c..a3d4117008 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -2030,20 +2030,24 @@ nm_manager_get_connection_device (NMManager *self, static NMDevice * nm_manager_get_best_device_for_connection (NMManager *self, - NMConnection *connection) + NMConnection *connection, + gboolean for_user_request) { const GSList *devices, *iter; NMDevice *act_device = nm_manager_get_connection_device (self, connection); + NMDeviceCheckConAvailableFlags flags; if (act_device) return act_device; + flags = for_user_request ? NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST : NM_DEVICE_CHECK_CON_AVAILABLE_NONE; + /* Pick the first device that's compatible with the connection. */ devices = nm_manager_get_devices (self); for (iter = devices; iter; iter = g_slist_next (iter)) { NMDevice *device = NM_DEVICE (iter->data); - if (nm_device_check_connection_available (device, connection, NM_DEVICE_CHECK_CON_AVAILABLE_NONE, NULL)) + if (nm_device_check_connection_available (device, connection, flags, NULL)) return device; } @@ -2530,7 +2534,7 @@ autoconnect_slaves (NMManager *manager, nm_manager_activate_connection (manager, slave_connection, NULL, - nm_manager_get_best_device_for_connection (manager, NM_CONNECTION (slave_connection)), + nm_manager_get_best_device_for_connection (manager, NM_CONNECTION (slave_connection), FALSE), subject, &local_err); if (local_err) { @@ -3051,7 +3055,7 @@ validate_activation_request (NMManager *self, goto error; } } else - device = nm_manager_get_best_device_for_connection (self, connection); + device = nm_manager_get_best_device_for_connection (self, connection, TRUE); if (!device) { gboolean is_software = nm_connection_is_virtual (connection);