aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2009-02-10 09:43:40 (GMT)
committerJouni Malinen <j@w1.fi>2009-02-15 13:08:48 (GMT)
commit7f9d4b1099ca6da00f71f471c2ba53029d2acecf (patch)
tree2c498f2b027be78673bf0093e9793b99d4179ec7 /src
parent21725f3a5d6f6499e72dcd8186ace374efe19e9f (diff)
downloadhostap-06-7f9d4b1099ca6da00f71f471c2ba53029d2acecf.zip
hostap-06-7f9d4b1099ca6da00f71f471c2ba53029d2acecf.tar.gz
hostap-06-7f9d4b1099ca6da00f71f471c2ba53029d2acecf.tar.bz2
wext: Force disconnect on deauthenticate()
Use the same zero-BSSID, random-SSID trick for both disassociate() and deauthenticate(). (cherry picked from commit 4853d5ac847efbfe54b80eeefabc2932696414c9)
Diffstat (limited to 'src')
-rw-r--r--src/drivers/driver_wext.c39
1 files changed, 26 insertions, 13 deletions
diff --git a/src/drivers/driver_wext.c b/src/drivers/driver_wext.c
index 9f19b5a..8c2daa8 100644
--- a/src/drivers/driver_wext.c
+++ b/src/drivers/driver_wext.c
@@ -1898,12 +1898,35 @@ static int wpa_driver_wext_mlme(struct wpa_driver_wext_data *drv,
}
+static void wpa_driver_wext_disconnect(struct wpa_driver_wext_data *drv)
+{
+ const u8 null_bssid[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 };
+ u8 ssid[32];
+ int i;
+
+ /*
+ * Clear the BSSID selection and set a random SSID to make sure the
+ * driver will not be trying to associate with something even if it
+ * does not understand SIOCSIWMLME commands (or tries to associate
+ * automatically after deauth/disassoc).
+ */
+ wpa_driver_wext_set_bssid(drv, null_bssid);
+
+ for (i = 0; i < 32; i++)
+ ssid[i] = rand() & 0xFF;
+ wpa_driver_wext_set_ssid(drv, ssid, 32);
+}
+
+
static int wpa_driver_wext_deauthenticate(void *priv, const u8 *addr,
int reason_code)
{
struct wpa_driver_wext_data *drv = priv;
+ int ret;
wpa_printf(MSG_DEBUG, "%s", __FUNCTION__);
- return wpa_driver_wext_mlme(drv, addr, IW_MLME_DEAUTH, reason_code);
+ wpa_driver_wext_disconnect(drv);
+ ret = wpa_driver_wext_mlme(drv, addr, IW_MLME_DEAUTH, reason_code);
+ return ret;
}
@@ -1911,20 +1934,10 @@ static int wpa_driver_wext_disassociate(void *priv, const u8 *addr,
int reason_code)
{
struct wpa_driver_wext_data *drv = priv;
- const u8 null_bssid[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 };
- u8 ssid[32];
- int ret, i;
-
+ int ret;
wpa_printf(MSG_DEBUG, "%s", __FUNCTION__);
-
ret = wpa_driver_wext_mlme(drv, addr, IW_MLME_DISASSOC, reason_code);
-
- wpa_driver_wext_set_bssid(drv, null_bssid);
-
- for (i = 0; i < 32; i++)
- ssid[i] = rand() & 0xFF;
- wpa_driver_wext_set_ssid(drv, ssid, 32);
-
+ wpa_driver_wext_disconnect(drv);
return ret;
}