aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2012-01-01 16:53:12 (GMT)
committerJouni Malinen <j@w1.fi>2012-01-01 16:55:58 (GMT)
commit3d9975d5b0da66584107e99eb3c418b13b485d60 (patch)
tree4100e2fb13d0b1706f98a208abf98e2efb7f6f9f /src
parent0be3542338892e5c1e51682d3d2f509aa7dbda42 (diff)
downloadhostap-3d9975d5b0da66584107e99eb3c418b13b485d60.zip
hostap-3d9975d5b0da66584107e99eb3c418b13b485d60.tar.gz
hostap-3d9975d5b0da66584107e99eb3c418b13b485d60.tar.bz2
Do not trigger fast reconnection on locally generated deauth/disassoc
The deauthentication and disassociation events from nl80211 were being processed identically regardless of whether the frame was generated by the local STA or the AP. This resulted in fast reconnection mechanism getting triggered even in the case where the disconnection was detected locally (e.g., due to beacon loss) while this was supposed to happen only in the case where the AP is sending an explicit Deauthentication or Disassociation frame with a specific reason code. Fix this by adding a new deauth/disassoc event variable to indicate whether the event was generated locally. Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src')
-rw-r--r--src/drivers/driver.h12
-rw-r--r--src/drivers/driver_nl80211.c13
2 files changed, 21 insertions, 4 deletions
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 53d1c25..d72c83b 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -1,6 +1,6 @@
/*
* Driver interface definition
- * Copyright (c) 2003-2010, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2003-2012, Jouni Malinen <j@w1.fi>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -3028,6 +3028,11 @@ union wpa_event_data {
* ie_len - Length of ie buffer in octets
*/
size_t ie_len;
+
+ /**
+ * locally_generated - Whether the frame was locally generated
+ */
+ int locally_generated;
} disassoc_info;
/**
@@ -3054,6 +3059,11 @@ union wpa_event_data {
* ie_len - Length of ie buffer in octets
*/
size_t ie_len;
+
+ /**
+ * locally_generated - Whether the frame was locally generated
+ */
+ int locally_generated;
} deauth_info;
/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index d407b0f..6af8cc9 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -1,6 +1,6 @@
/*
* Driver interaction with Linux nl80211/cfg80211
- * Copyright (c) 2002-2010, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2002-2012, Jouni Malinen <j@w1.fi>
* Copyright (c) 2003-2004, Instant802 Networks, Inc.
* Copyright (c) 2005-2006, Devicescape Software, Inc.
* Copyright (c) 2007, Johannes Berg <johannes@sipsolutions.net>
@@ -1151,7 +1151,8 @@ static void mlme_event_connect(struct wpa_driver_nl80211_data *drv,
static void mlme_event_disconnect(struct wpa_driver_nl80211_data *drv,
- struct nlattr *reason, struct nlattr *addr)
+ struct nlattr *reason, struct nlattr *addr,
+ struct nlattr *by_ap)
{
union wpa_event_data data;
@@ -1169,6 +1170,7 @@ static void mlme_event_disconnect(struct wpa_driver_nl80211_data *drv,
os_memset(&data, 0, sizeof(data));
if (reason)
data.disassoc_info.reason_code = nla_get_u16(reason);
+ data.disassoc_info.locally_generated = by_ap == NULL;
wpa_supplicant_event(drv->ctx, EVENT_DISASSOC, &data);
}
@@ -1309,6 +1311,8 @@ static void mlme_event_deauth_disassoc(struct wpa_driver_nl80211_data *drv,
reason_code = le_to_host16(mgmt->u.deauth.reason_code);
if (type == EVENT_DISASSOC) {
+ event.disassoc_info.locally_generated =
+ !os_memcmp(mgmt->sa, drv->first_bss.addr, ETH_ALEN);
event.disassoc_info.addr = bssid;
event.disassoc_info.reason_code = reason_code;
if (frame + len > mgmt->u.disassoc.variable) {
@@ -1317,6 +1321,8 @@ static void mlme_event_deauth_disassoc(struct wpa_driver_nl80211_data *drv,
mgmt->u.disassoc.variable;
}
} else {
+ event.deauth_info.locally_generated =
+ !os_memcmp(mgmt->sa, drv->first_bss.addr, ETH_ALEN);
event.deauth_info.addr = bssid;
event.deauth_info.reason_code = reason_code;
if (frame + len > mgmt->u.deauth.variable) {
@@ -2083,7 +2089,8 @@ static void do_process_drv_event(struct wpa_driver_nl80211_data *drv,
break;
case NL80211_CMD_DISCONNECT:
mlme_event_disconnect(drv, tb[NL80211_ATTR_REASON_CODE],
- tb[NL80211_ATTR_MAC]);
+ tb[NL80211_ATTR_MAC],
+ tb[NL80211_ATTR_DISCONNECTED_BY_AP]);
break;
case NL80211_CMD_MICHAEL_MIC_FAILURE:
mlme_event_michael_mic_failure(drv, tb);