]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Do not ignore disconnect event in case of !drv->associated
authorHu Wang <huw@codeaurora.org>
Wed, 8 Aug 2018 03:21:05 +0000 (11:21 +0800)
committerJouni Malinen <j@w1.fi>
Fri, 31 Aug 2018 09:01:33 +0000 (12:01 +0300)
Commit 3f53c006c7d7362cf715ceaeda92c69d91ea7b63 ('nl80211: Ignore
disconnect event in case of locally generated request') made
wpa_supplicant ignore the next received disconnect event for cases where
wpa_supplicant itself requested a disconnection. This can result in
ignoring a disconnection notification in some cases.

Considering a P2P Client receiving disconnect event from the kernel
after a P2P group is started, drv->ignore_next_local_disconnect is
cleared to 0, then wpa_driver_nl80211_disconnect() will be called during
the removal of the group, in which drv->ignore_next_local_disconnect is
set to 1 by mistake.

Do not allow ignore_next_local_{disconnect,deauth} to be set to 1 if the
driver is not in associated state (drv->associated is 0) to avoid this
type of cases.

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

index 26df43bb799845e3c0ba06207ac54c3e7b16a6d3..39a02d3ee51f4620d27276b7ecce7c1d566cd5ea 100644 (file)
@@ -3133,6 +3133,7 @@ static int wpa_driver_nl80211_disconnect(struct wpa_driver_nl80211_data *drv,
                                         int reason_code)
 {
        int ret;
+       int drv_associated = drv->associated;
 
        wpa_printf(MSG_DEBUG, "%s(reason_code=%d)", __func__, reason_code);
        nl80211_mark_disconnected(drv);
@@ -3143,7 +3144,7 @@ static int wpa_driver_nl80211_disconnect(struct wpa_driver_nl80211_data *drv,
         * For locally generated disconnect, supplicant already generates a
         * DEAUTH event, so ignore the event from NL80211.
         */
-       drv->ignore_next_local_disconnect = ret == 0;
+       drv->ignore_next_local_disconnect = drv_associated && (ret == 0);
 
        return ret;
 }
@@ -3154,6 +3155,7 @@ static int wpa_driver_nl80211_deauthenticate(struct i802_bss *bss,
 {
        struct wpa_driver_nl80211_data *drv = bss->drv;
        int ret;
+       int drv_associated = drv->associated;
 
        if (drv->nlmode == NL80211_IFTYPE_ADHOC) {
                nl80211_mark_disconnected(drv);
@@ -3170,7 +3172,8 @@ static int wpa_driver_nl80211_deauthenticate(struct i802_bss *bss,
         * For locally generated deauthenticate, supplicant already generates a
         * DEAUTH event, so ignore the event from NL80211.
         */
-       drv->ignore_next_local_deauth = ret == 0;
+       drv->ignore_next_local_deauth = drv_associated && (ret == 0);
+
        return ret;
 }