GNOME Bugzilla – Bug 751269
Stop forcing WiFi interface to STA/infra mode when < DISCONNECTED
Last modified: 2020-11-12 14:26:55 UTC
NM currently initializes wifi interfaces on the transition from UNMANAGED -> UNAVAILABLE, so that they are in STA/infra mode when added to wpa_supplicant. This is done from nm-device-wifi.c::deactivate() which gets called from nm-device.c on the transition to UNAVAILABLE. Unfortunately, this also happens if NM's wifi user state is disabled. This means that a new AP interface created by other programs or other processes gets taken over by NM and reset into STA/infra mode, which isn't very nice of NM. Originally this was done to ensure that when the device was in adhoc mode it got moved back to infra mode becuase many really old drivers scan very badly in adhoc mode. This is no longer something we care about. NM doesn't add the interface to wpa_supplicant until WiFi is enabled, so that's not anything we need to worry about. Instead, I think all we need to do is: 1) read the mode with nm_platform_wifi_get_mode() at device construct time 2) instead of setting infra mode in nm-device-wifi.c::deactivate(), do that in device_state_changed() if old_state == NM_DEVICE_STATE && new_state == DISCONNECTED. This gets the change out of the UNMANAGED -> UNAVAILABLE pathway and ensure it is only done when moving to DISCONNECTED. This brings up another point though, which is that most of the NMDevice subclass' deactivate() functions only touch stuff from when the device was activated. When going from UMNANAGED -> UNAVAILABLE they are mostly NOPs. So possibly we could split deactivate() into initialize() (called on UNMANAGED -> UNAVAILALBLE) and cleanup() (called everywhere else that nm_device_cleanup() gets called right now).
bugzilla.gnome.org is being shut down in favor of a GitLab instance. We are closing all old bug reports and feature requests in GNOME Bugzilla which have not seen updates for a long time. If you still use NetworkManager and if you still see this bug / want this feature in a recent and supported version of NetworkManager, then please feel free to report it at https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/ Thank you for creating this report and we are sorry it could not be implemented (workforce and time is unfortunately limited).