mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-04 14:10:36 +01:00
core: don't allow auto-activation of a master that has been disconnected
The master-activation code was ignoring whether or not the master device was inhibiting automatic connections.
This commit is contained in:
parent
454490c6d5
commit
2dac2cf56e
2 changed files with 31 additions and 12 deletions
|
|
@ -2529,6 +2529,8 @@ ensure_master_active_connection (NMManager *self,
|
|||
nm_device_get_path (master_device),
|
||||
dbus_sender,
|
||||
error);
|
||||
if (!master_ac)
|
||||
g_prefix_error (error, "%s", "Master device activation failed: ");
|
||||
g_slist_free (connections);
|
||||
return master_ac;
|
||||
}
|
||||
|
|
@ -2569,24 +2571,30 @@ ensure_master_active_connection (NMManager *self,
|
|||
if (master_state != NM_DEVICE_STATE_DISCONNECTED)
|
||||
continue;
|
||||
|
||||
return nm_manager_activate_connection (self,
|
||||
master_connection,
|
||||
NULL,
|
||||
nm_device_get_path (candidate),
|
||||
dbus_sender,
|
||||
error);
|
||||
master_ac = nm_manager_activate_connection (self,
|
||||
master_connection,
|
||||
NULL,
|
||||
nm_device_get_path (candidate),
|
||||
dbus_sender,
|
||||
error);
|
||||
if (!master_ac)
|
||||
g_prefix_error (error, "%s", "Master device activation failed: ");
|
||||
return master_ac;
|
||||
}
|
||||
|
||||
/* Device described by master_connection may be a virtual one that's
|
||||
* not created yet.
|
||||
*/
|
||||
if (!found_device && connection_needs_virtual_device (master_connection)) {
|
||||
return nm_manager_activate_connection (self,
|
||||
master_connection,
|
||||
NULL,
|
||||
NULL,
|
||||
dbus_sender,
|
||||
error);
|
||||
master_ac = nm_manager_activate_connection (self,
|
||||
master_connection,
|
||||
NULL,
|
||||
NULL,
|
||||
dbus_sender,
|
||||
error);
|
||||
if (!master_ac)
|
||||
g_prefix_error (error, "%s", "Master device activation failed: ");
|
||||
return master_ac;
|
||||
}
|
||||
|
||||
g_set_error (error,
|
||||
|
|
@ -2774,6 +2782,16 @@ nm_manager_activate_connection (NMManager *manager,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* If this is an autoconnect request, but the device isn't allowing autoconnect
|
||||
* right now, we reject it.
|
||||
*/
|
||||
if (!dbus_sender && !nm_device_autoconnect_allowed (device)) {
|
||||
g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_AUTOCONNECT_NOT_ALLOWED,
|
||||
"%s does not allow automatic connections at this time",
|
||||
nm_device_get_iface (device));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Try to find the master connection/device if the connection has a dependency */
|
||||
if (!find_master (manager, connection, device, &master_connection, &master_device)) {
|
||||
g_set_error_literal (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_UNKNOWN_DEVICE,
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ typedef enum {
|
|||
NM_MANAGER_ERROR_ALREADY_ENABLED_OR_DISABLED, /*< nick=AlreadyEnabledOrDisabled >*/
|
||||
NM_MANAGER_ERROR_UNSUPPORTED_CONNECTION_TYPE, /*< nick=UnsupportedConnectionType >*/
|
||||
NM_MANAGER_ERROR_DEPENDENCY_FAILED, /*< nick=DependencyFailed >*/
|
||||
NM_MANAGER_ERROR_AUTOCONNECT_NOT_ALLOWED, /*< nick=AutoconnectNotAllowed >*/
|
||||
} NMManagerError;
|
||||
|
||||
#define NM_MANAGER_VERSION "version"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue