]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Ignore disconnect event in case of locally generated request
authorJithu Jance <jithu@broadcom.com>
Sat, 20 Jul 2013 13:06:13 +0000 (16:06 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 20 Jul 2013 13:06:13 +0000 (16:06 +0300)
Previously, there could be two disconnection events in core
wpa_supplicant when going through a case of wpa_supplicant-requested
disconnection with a driver that implements SME internally. This could
result in undesired behavior when a disconnection is followed by a new
connection attempt before the extra event has been received (e.g.,
during fast reassoc or WPS provisioning). Avoid such issues by ignoring
locally generated disconnect events after requesting cfg80211 to
disconnect.

This makes the previously used ignore_next_local_disconnect more
consistent by setting the variable within
wpa_driver_nl80211_disconnect() so that both callers get the same
behavior.

Signed-hostap: Jithu Jance <jithu@broadcom.com>

src/drivers/driver_nl80211.c

index 011553351e059da39ff30bcd67c4f479869caa49..5f7be291341e341b926ad1ad072ed61d7b10e083 100644 (file)
@@ -5165,12 +5165,20 @@ nla_put_failure:
 static int wpa_driver_nl80211_disconnect(struct wpa_driver_nl80211_data *drv,
                                         int reason_code)
 {
+       int ret;
+
        wpa_printf(MSG_DEBUG, "%s(reason_code=%d)", __func__, reason_code);
        nl80211_mark_disconnected(drv);
-       drv->ignore_next_local_disconnect = 0;
        /* Disconnect command doesn't need BSSID - it uses cached value */
-       return wpa_driver_nl80211_mlme(drv, NULL, NL80211_CMD_DISCONNECT,
-                                      reason_code, 0);
+       ret = wpa_driver_nl80211_mlme(drv, NULL, NL80211_CMD_DISCONNECT,
+                                     reason_code, 0);
+       /*
+        * For locally generated disconnect, supplicant already generates a
+        * DEAUTH event, so ignore the event from NL80211.
+        */
+       drv->ignore_next_local_disconnect = ret == 0;
+
+       return ret;
 }
 
 
@@ -7798,8 +7806,6 @@ static int wpa_driver_nl80211_connect(
                if (wpa_driver_nl80211_disconnect(
                            drv, WLAN_REASON_PREV_AUTH_NOT_VALID))
                        return -1;
-               /* Ignore the next local disconnect message. */
-               drv->ignore_next_local_disconnect = 1;
                ret = wpa_driver_nl80211_try_connect(drv, params);
        }
        return ret;