]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Do not ignore disconnection event after a connection event
authorVamsi Krishna <vamsin@codeaurora.org>
Fri, 18 Dec 2020 17:20:00 +0000 (22:50 +0530)
committerJouni Malinen <j@w1.fi>
Mon, 21 Dec 2020 13:51:32 +0000 (15:51 +0200)
After a disconnect command is issued, wpa_supplicant generates a
disconnection event to self and ignores the next disconnection event
coming from the driver.  In a race condition in which the driver
generates a connected event due to roaming just before receiving the
disconnect command from userspace, wpa_supplicant processes the
connected event after processing the self-generated disconnection event
and enters WPA_COMPLETED state. The driver sends a disconnection event
after processing the disconnect command sent by wpa_supplicant but the
disconnection event is ignored by wpa_supplicant as the disconnection
event is considered to be a result of locally generated disconnect
command. Thus, wpa_supplicant continues to be in the connected
(WPA_COMPLETED) state though the driver is in disconnected state.

Fix this out-of-sync behavior between the driver and wpa_supplicant by
not ignoring the disconnection event from the driver because of the
locally generated disconnect command sent to the driver if there is a
connection event received after issuing the disconnect command to the
driver.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/drivers/driver_nl80211_event.c

index a3e2eee93ce8855f150923a9c65b0c6697f08616..3af13f4109695f90970aa9b82bd9f65e16505711 100644 (file)
@@ -571,6 +571,13 @@ static void mlme_event_connect(struct wpa_driver_nl80211_data *drv,
                event.assoc_info.fils_pmkid = nla_data(fils_pmkid);
 
        wpa_supplicant_event(drv->ctx, EVENT_ASSOC, &event);
+
+       /* Avoid a race condition by stopping to ignore any following
+        * disconnection events now that the driver has indicated it is
+        * connected since that connection could have been triggered by a roam
+        * operation that happened in parallel with the disconnection request.
+        */
+       drv->ignore_next_local_disconnect = 0;
 }