From 3d18c9c841aeaad831f609d2623d9e6482f45f65 Mon Sep 17 00:00:00 2001 From: Fernando Fernandez Mancera Date: Tue, 24 Jan 2023 12:30:45 +0100 Subject: [PATCH] device: do cleanup type removed if sys-iface-state is REMOVED When the state is DISCONNECTED is being set from a configuring/configured state we might want to always DECONFIGURE the interface (ifindex, ip addresses, routes..) except if the sys-iface-state is REMOVED in that case we would like to remove it. --- src/core/devices/nm-device.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c index 300c958743..4046fc2bfc 100644 --- a/src/core/devices/nm-device.c +++ b/src/core/devices/nm-device.c @@ -16105,8 +16105,11 @@ _set_state_full(NMDevice *self, NMDeviceState state, NMDeviceStateReason reason, * userspace IPv6LL enabled. */ _dev_addrgenmode6_set(self, NM_IN6_ADDR_GEN_MODE_NONE); + if (priv->sys_iface_state == NM_DEVICE_SYS_IFACE_STATE_REMOVED) { + nm_device_cleanup(self, reason, CLEANUP_TYPE_REMOVED); + } else + nm_device_cleanup(self, reason, CLEANUP_TYPE_DECONFIGURE); - nm_device_cleanup(self, reason, CLEANUP_TYPE_DECONFIGURE); } else if (old_state < NM_DEVICE_STATE_DISCONNECTED) { if (priv->sys_iface_state == NM_DEVICE_SYS_IFACE_STATE_MANAGED) { /* Ensure IPv6 is set up as it may not have been done when