wifi: fix evaluating the scanning state for wpa-supplicant

wpa_supplicant has a property "scanning" and a "state=scanning".
Previously, NetworkManager considered both parts to indicate whether
supplicant is currently scanning (if either the property or the state
indicated scanning, it took that as indication for scanning).

If NetworkManager thinks that supplicant is scanning, it suppresses
explicit "Scan" requests. That alone is not severe, because the "Scan"
request is only to trigger a scan in supplicant (which supplicant
possibly is already doing in state "scanning").

However, what is severe is that NetworkManager will also block autoconnect
while supplicant is scanning. That is because NetworkManager wants to get
a complete scan result before deciding which network to connect to.

It seems that wpa_supplicant can get into "state=scanning" and stay
there indefinitely. This prevents NetworkManager from autoactivating
a profile.

Fix that, to only honor the "scanning" property.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/597

Fixes: b83f07916a ('supplicant: large rework of wpa_supplicant handling')
This commit is contained in:
Thomas Haller 2020-12-10 11:50:18 +01:00
parent b012877445
commit 8cadfed2fe
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -457,9 +457,7 @@ _notify_maybe_scanning(NMSupplicantInterface *self)
NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE(self);
gboolean scanning;
scanning =
nm_supplicant_interface_state_is_operational(priv->state)
&& (priv->scanning_property || priv->supp_state == NM_SUPPLICANT_INTERFACE_STATE_SCANNING);
scanning = nm_supplicant_interface_state_is_operational(priv->state) && priv->scanning_property;
if (priv->scanning_cached == scanning)
return;