mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-20 04:40:04 +01:00
device: don't generate an assumed connection for ports on wake
After resuming from suspend, devices with wake-on-lan enabled are temporarily set as unmanaged, and then managed again. At the beginning of this process, an active device goes from state ACTIVATED to UNMANAGED and is deconfigured via "nm_device_cleanup(cleanup_type=CLEANUP_TYPE_DECONFIGURE)". If the device is attached to a controller, the cleanup doesn't detach it. Later when the device is managed again, NetworkManager tries to create an assumed connection. Normally, this would fail because we detect that the device is not configured. However, if there is a controller-port relationship, the assumed connection generation succeeds and the persistent connection doesn't go up. As this is wrong, prevent the generation of the assumed connection by detaching the port during a cleanup. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1766 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2242
This commit is contained in:
parent
600c5452bf
commit
e1a7d5ac06
1 changed files with 19 additions and 9 deletions
|
|
@ -17003,6 +17003,25 @@ nm_device_cleanup(NMDevice *self, NMDeviceStateReason reason, CleanupType cleanu
|
|||
/* controller: release ports */
|
||||
nm_device_controller_release_ports_all(self);
|
||||
|
||||
/* port: detach from controller */
|
||||
if (priv->controller) {
|
||||
nm_device_controller_release_port(priv->controller,
|
||||
self,
|
||||
RELEASE_PORT_TYPE_CONFIG,
|
||||
reason);
|
||||
}
|
||||
}
|
||||
|
||||
/* port: mark no longer attached */
|
||||
if (priv->controller && priv->ifindex > 0
|
||||
&& nm_platform_link_get_controller(nm_device_get_platform(self), priv->ifindex) <= 0) {
|
||||
nm_device_controller_release_port(priv->controller,
|
||||
self,
|
||||
RELEASE_PORT_TYPE_NO_CONFIG,
|
||||
NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED);
|
||||
}
|
||||
|
||||
if (cleanup_type == CLEANUP_TYPE_DECONFIGURE) {
|
||||
/* Take out any entries in the routing table and any IP address the device had. */
|
||||
if (ifindex > 0) {
|
||||
NMPlatform *platform = nm_device_get_platform(self);
|
||||
|
|
@ -17026,15 +17045,6 @@ nm_device_cleanup(NMDevice *self, NMDeviceStateReason reason, CleanupType cleanu
|
|||
if (ifindex > 0)
|
||||
nm_platform_ip4_dev_route_blacklist_set(nm_device_get_platform(self), ifindex, NULL);
|
||||
|
||||
/* port: mark no longer attached */
|
||||
if (priv->controller && priv->ifindex > 0
|
||||
&& nm_platform_link_get_controller(nm_device_get_platform(self), priv->ifindex) <= 0) {
|
||||
nm_device_controller_release_port(priv->controller,
|
||||
self,
|
||||
RELEASE_PORT_TYPE_NO_CONFIG,
|
||||
NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED);
|
||||
}
|
||||
|
||||
lldp_setup(self, NM_TERNARY_FALSE);
|
||||
|
||||
nm_device_update_metered(self);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue