summaryrefslogtreecommitdiff
path: root/src/nm-manager.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nm-manager.c')
-rw-r--r--src/nm-manager.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/nm-manager.c b/src/nm-manager.c
index 1e0a0c44cc..c5c33f9d6c 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -3404,10 +3404,33 @@ nm_manager_get_best_device_for_connection (NMManager *self,
if (!connection)
connection = nm_settings_connection_get_connection (sett_conn);
- flags = for_user_request ? NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST : NM_DEVICE_CHECK_CON_AVAILABLE_NONE;
-
multi_connect = _nm_connection_get_multi_connect (connection);
+ if (!for_user_request)
+ flags = NM_DEVICE_CHECK_CON_AVAILABLE_NONE;
+ else {
+ /* if the profile is multi-connect=single, we also consider devices which
+ * are marked as unmanaged (but where an explicit user-request could overrule
+ * the decision).
+ *
+ * We do that, because commonly a multi-connect=single device is explicitly tied
+ * to the right set of devices, so when the user explicitly activates the profile
+ * on an unmanaged device, the command should be honored.
+ *
+ * For multi-connect != single, the profile is intentionally not tied to one
+ * device, but multiple. Quite possibly, the plain `nmcli connection up $PROFILE`
+ * call also doesn't make much sense, and the user should always explicitly select the
+ * device. Anyway, in a multi-connect scenario, we don't want to conisder unmanaged
+ * devices as suitable candidates.
+ *
+ * This can be seen as inconsistant, but I think it ultimately makes more sense.
+ */
+ if (multi_connect == NM_CONNECTION_MULTI_CONNECT_SINGLE)
+ flags = NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST;
+ else
+ flags = NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST & ~_NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST_OVERRULE_UNMANAGED;
+ }
+
if ( multi_connect == NM_CONNECTION_MULTI_CONNECT_SINGLE
&& (ac = active_connection_find_by_connection (self, sett_conn, connection, NM_ACTIVE_CONNECTION_STATE_DEACTIVATING, &all_ac_arr))) {
/* if we have a profile which may activate on only one device (multi-connect single), then