mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-06 16:40:16 +01:00
core: fix re-activation of existing active connection
The change to allow an NMConnection to only be active on a single device accidentally broke the case of re-activating a connection on the same device. Fix that.
This commit is contained in:
parent
49983db85e
commit
3c236c88eb
1 changed files with 9 additions and 6 deletions
|
|
@ -2894,20 +2894,23 @@ _new_active_connection (NMManager *self,
|
|||
|
||||
/* Can't create new AC for already-active connection */
|
||||
existing_ac = find_ac_for_connection (self, connection);
|
||||
if (NM_IS_VPN_CONNECTION (existing_ac)) {
|
||||
g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_CONNECTION_ALREADY_ACTIVE,
|
||||
"Connection '%s' is already active",
|
||||
nm_connection_get_id (connection));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (existing_ac) {
|
||||
NMDevice *existing_device = nm_active_connection_get_device (existing_ac);
|
||||
|
||||
if (NM_IS_VPN_CONNECTION (existing_ac) || existing_device == device) {
|
||||
g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_CONNECTION_ALREADY_ACTIVE,
|
||||
"Connection '%s' is already active",
|
||||
nm_connection_get_id (connection));
|
||||
} else {
|
||||
if (existing_device != device) {
|
||||
g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_CONNECTION_ALREADY_ACTIVE,
|
||||
"Connection '%s' is already active on %s",
|
||||
nm_connection_get_id (connection),
|
||||
nm_device_get_iface (existing_device));
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Normalize the specific object */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue