diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2019-07-08 13:52:15 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2019-07-08 13:52:15 +0200 |
commit | fb4823c8aefd1e07624efb3e67fb9c39c048e465 (patch) | |
tree | 6629fe101d16509b6768cda5b76e8f14a057f6a3 | |
parent | 7d8f20b00e461a5a494c15d649068c66897cae58 (diff) | |
parent | ba7b427aecfcea37199fdaa34c4ee655a8afe2ea (diff) | |
download | NetworkManager-fb4823c8aefd1e07624efb3e67fb9c39c048e465.tar.gz |
core: merge branch 'bg/slaves-autoconnect-managed'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/197/commits
-rw-r--r-- | src/devices/nm-device.c | 13 | ||||
-rw-r--r-- | src/nm-manager.c | 13 |
2 files changed, 18 insertions, 8 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 569ff6289d..6a27469d41 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -13445,7 +13445,7 @@ _get_managed_by_flags(NMUnmanagedFlags flags, NMUnmanagedFlags mask, gboolean fo return TRUE; /* A for-user-request, is effectively the same as pretending - * that user-dbus flag is cleared. */ + * that user-explicit flag is cleared. */ mask |= NM_UNMANAGED_USER_EXPLICIT; flags &= ~NM_UNMANAGED_USER_EXPLICIT; } @@ -13497,6 +13497,9 @@ _get_managed_by_flags(NMUnmanagedFlags flags, NMUnmanagedFlags mask, gboolean fo * nm_device_get_managed: * @self: the #NMDevice * @for_user_request: whether to check the flags for an explicit user-request + * Setting this to %TRUE has the same effect as if %NM_UNMANAGED_USER_EXPLICIT + * unmanaged flag would be unset (meaning: explicitly not-unmanaged). + * If this parameter is %TRUE, the device can only appear more managed. * * Whether the device is unmanaged according to the unmanaged flags. * @@ -14066,13 +14069,17 @@ _nm_device_check_connection_available (NMDevice *self, return FALSE; } if (state < NM_DEVICE_STATE_UNAVAILABLE) { - if (!nm_device_get_managed (self, TRUE)) { - if (!nm_device_get_managed (self, FALSE)) { + if (nm_device_get_managed (self, FALSE)) { + /* device is managed, both for user-requests and non-user-requests alike. */ + } else { + if (!nm_device_get_managed (self, TRUE)) { + /* device is strictly unmanaged by authoritative unmanaged reasons. */ nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_UNMANAGED_DEVICE, "device is strictly unmanaged"); return FALSE; } if (!NM_FLAGS_HAS (flags, _NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST_OVERRULE_UNMANAGED)) { + /* device could be managed for an explict user-request, but this is not such a request. */ nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_UNMANAGED_DEVICE, "device is currently unmanaged"); return FALSE; diff --git a/src/nm-manager.c b/src/nm-manager.c index d2dd2f4d51..9d9d05c7be 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -4169,7 +4169,8 @@ static SlaveConnectionInfo * find_slaves (NMManager *manager, NMSettingsConnection *sett_conn, NMDevice *device, - guint *out_n_slaves) + guint *out_n_slaves, + gboolean for_user_request) { NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager); gs_free NMSettingsConnection **all_connections = NULL; @@ -4211,7 +4212,7 @@ find_slaves (NMManager *manager, slave_device = nm_manager_get_best_device_for_connection (manager, candidate, NULL, - FALSE, + for_user_request, devices, NULL); @@ -4287,7 +4288,8 @@ static void autoconnect_slaves (NMManager *self, NMSettingsConnection *master_connection, NMDevice *master_device, - NMAuthSubject *subject) + NMAuthSubject *subject, + gboolean for_user_request) { GError *local_err = NULL; @@ -4297,7 +4299,7 @@ autoconnect_slaves (NMManager *self, guint i, n_slaves = 0; gboolean bind_lifetime_to_profile_visibility; - slaves = find_slaves (self, master_connection, master_device, &n_slaves); + slaves = find_slaves (self, master_connection, master_device, &n_slaves, for_user_request); if (n_slaves > 1) { gs_free char *value = NULL; @@ -4697,7 +4699,8 @@ _internal_activate_device (NMManager *self, NMActiveConnection *active, GError * } /* Check slaves for master connection and possibly activate them */ - autoconnect_slaves (self, sett_conn, device, nm_active_connection_get_subject (active)); + autoconnect_slaves (self, sett_conn, device, nm_active_connection_get_subject (active), + nm_active_connection_get_activation_reason (active) == NM_ACTIVATION_REASON_USER_REQUEST); multi_connect = _nm_connection_get_multi_connect (nm_settings_connection_get_connection (sett_conn)); if ( multi_connect == NM_CONNECTION_MULTI_CONNECT_MULTIPLE |