mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-30 20:10:10 +01:00
core: fix duplicating (not removing) active connections
This is a regression introduced by reworked active connections tracking:7258dd270fcore: add the NM_ACTIVE_CONNECTION_STATE_DEACTIVATED state59420add04core: track active connections directly in the manager Because nm-manager.c:active_connection_state_changed() postpones active connection removal to an idle handler (to be able to receive last property change notifications), we also need to ensure that NM_ACTIVE_CONNECTION_STATE_DEACTIVATED state is not changed again in the meantime in nm-activation-request.c:device_state_changed(). Reproducer: Just activate already active connection by clicking it in nm-applet or run 'nmcli con up id <connnection name>' several times, and then check active connections with 'nmcli c s'.
This commit is contained in:
parent
17aff29082
commit
df796527a4
1 changed files with 6 additions and 1 deletions
|
|
@ -298,6 +298,7 @@ static void
|
|||
device_state_changed (NMDevice *device, GParamSpec *pspec, NMActRequest *self)
|
||||
{
|
||||
NMActiveConnectionState ac_state = NM_ACTIVE_CONNECTION_STATE_UNKNOWN;
|
||||
NMActiveConnectionState prev_ac_state = nm_active_connection_get_state (NM_ACTIVE_CONNECTION (self));
|
||||
|
||||
/* Set NMActiveConnection state based on the device's state */
|
||||
switch (nm_device_get_state (device)) {
|
||||
|
|
@ -329,7 +330,11 @@ device_state_changed (NMDevice *device, GParamSpec *pspec, NMActRequest *self)
|
|||
nm_active_connection_set_default6 (NM_ACTIVE_CONNECTION (self), FALSE);
|
||||
}
|
||||
|
||||
nm_active_connection_set_state (NM_ACTIVE_CONNECTION (self), ac_state);
|
||||
/* Only set new state if we are not in DEACTIVATED. Those connections
|
||||
* will be removed. See _active_connection_cleanup() in nm-manager.c
|
||||
*/
|
||||
if (prev_ac_state != NM_ACTIVE_CONNECTION_STATE_DEACTIVATED)
|
||||
nm_active_connection_set_state (NM_ACTIVE_CONNECTION (self), ac_state);
|
||||
}
|
||||
|
||||
/********************************************************************/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue