diff options
author | Wen Liang <liangwen12year@gmail.com> | 2022-09-21 11:34:41 -0400 |
---|---|---|
committer | Wen Liang <liangwen12year@gmail.com> | 2022-10-03 10:40:02 -0400 |
commit | 99343c3b064762e82f9813610496d89b14485aa2 (patch) | |
tree | 932fbdc3fcffebd27759b650e47a6a37b3b1d150 | |
parent | 531cc967370649dcb6c11ba4ba79e98080d512d0 (diff) | |
download | NetworkManager-wl/addrgenmode_none_disconnected.tar.gz |
device: set the addrgenmode to none for disconnected devicewl/addrgenmode_none_disconnected
When NM manages the device, it should set the addrgenmode to none for
the disconnected device, as a result, the IPv6 link local address should
not be assigned for the device.
-rw-r--r-- | src/core/devices/nm-device.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c index 3a7009e6c2..28d81b5da0 100644 --- a/src/core/devices/nm-device.c +++ b/src/core/devices/nm-device.c @@ -15782,12 +15782,12 @@ _set_state_full(NMDevice *self, NMDeviceState state, NMDeviceStateReason reason, case NM_DEVICE_STATE_UNMANAGED: nm_device_set_firmware_missing(self, FALSE); if (old_state > NM_DEVICE_STATE_UNMANAGED) { - if (priv->sys_iface_state != NM_DEVICE_SYS_IFACE_STATE_MANAGED) { - nm_device_cleanup(self, - reason, - priv->sys_iface_state == NM_DEVICE_SYS_IFACE_STATE_REMOVED - ? CLEANUP_TYPE_REMOVED - : CLEANUP_TYPE_KEEP); + if (priv->sys_iface_state == NM_DEVICE_SYS_IFACE_STATE_REMOVED) { + nm_device_cleanup(self, reason, CLEANUP_TYPE_REMOVED); + _dev_addrgenmode6_set(self, NM_IN6_ADDR_GEN_MODE_EUI64); + _dev_sysctl_restore_ip6_properties(self); + } else if (priv->sys_iface_state != NM_DEVICE_SYS_IFACE_STATE_MANAGED) { + nm_device_cleanup(self, reason, CLEANUP_TYPE_KEEP); } else { /* Clean up if the device is now unmanaged but was activated */ if (nm_device_get_act_request(self)) @@ -15842,7 +15842,8 @@ _set_state_full(NMDevice *self, NMDeviceState state, NMDeviceStateReason reason, 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) { + if (priv->sys_iface_state == NM_DEVICE_SYS_IFACE_STATE_MANAGED + || priv->sys_iface_state == NM_DEVICE_SYS_IFACE_STATE_ASSUME) { /* Ensure IPv6 is set up as it may not have been done when * entering the UNAVAILABLE state depending on the reason. */ @@ -17522,7 +17523,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps reason = NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED; if (NM_IN_SET_TYPED(NMDeviceSysIfaceState, priv->sys_iface_state, - NM_DEVICE_SYS_IFACE_STATE_EXTERNAL, NM_DEVICE_SYS_IFACE_STATE_REMOVED)) nm_device_sys_iface_state_set(self, NM_DEVICE_SYS_IFACE_STATE_ASSUME); } else { |