mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-06-05 06:38:18 +02:00
checkpoint: fetch new device on rollback
When a device belonging to a checkpoint is removed, we clear the
device pointer from the DeviceCheckpoint and move the object from the
devices list to the removed-devices list of the checkpoint.
Later, when restoring the connection we need to set again the device
pointer in DeviceCheckpoint; otherwise, any connection on that device
can't be reactivated if changed.
Fixes: 0e2f7ac7b5 ('nm-checkpoint: drop reference to NM_DEVICE objects on removal signal')
This commit is contained in:
parent
0fcfd6e24f
commit
b80a398306
1 changed files with 10 additions and 8 deletions
|
|
@ -259,17 +259,19 @@ restore_and_activate_connection(NMCheckpoint *self, DeviceCheckpoint *dev_checkp
|
|||
g_clear_error(&local_error);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* If the device is software, a brand new NMDevice may have been created */
|
||||
if (dev_checkpoint->is_software && !dev_checkpoint->device) {
|
||||
dev_checkpoint->device = nm_manager_get_device(priv->manager,
|
||||
dev_checkpoint->original_dev_name,
|
||||
dev_checkpoint->dev_type);
|
||||
nm_g_object_ref(dev_checkpoint->device);
|
||||
}
|
||||
need_activation = TRUE;
|
||||
}
|
||||
|
||||
/* If the device is software, a brand new NMDevice may have been created
|
||||
* after adding the new connection; or the old device might have been
|
||||
* deleted and we need to fetch it again. */
|
||||
if (dev_checkpoint->is_software && !dev_checkpoint->device) {
|
||||
dev_checkpoint->device = nm_manager_get_device(priv->manager,
|
||||
dev_checkpoint->original_dev_name,
|
||||
dev_checkpoint->dev_type);
|
||||
nm_g_object_ref(dev_checkpoint->device);
|
||||
}
|
||||
|
||||
if (!dev_checkpoint->device) {
|
||||
_LOGD("rollback: device cannot be restored");
|
||||
return FALSE;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue