aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJithu Jance <jithu@broadcom.com>2014-12-03 18:54:40 +0530
committerAhmad Kholaif <akholaif@codeaurora.org>2014-12-15 11:24:53 -0800
commitf9fb50dfd7609c7ff814160a3218aa75846e7f88 (patch)
tree4ebae7cf40629f65017b39e4c3d878330c105b16 /src
parentd47b40847f52d9b45e5d64729232d3b8a7372bb7 (diff)
downloadandroid_external_wpa_supplicant_8-f9fb50dfd7609c7ff814160a3218aa75846e7f88.tar.gz
android_external_wpa_supplicant_8-f9fb50dfd7609c7ff814160a3218aa75846e7f88.tar.bz2
android_external_wpa_supplicant_8-f9fb50dfd7609c7ff814160a3218aa75846e7f88.zip
nl80211: Ignore Connect failure for the previous association
Suppose there are two APs (AP1 & AP2) and user attempted to connect to AP2 before the previous connection with AP1 could succeed. Now, if the connection event comes for the older AP with failed status, we should just ignore it as the wpa_supplicant state has moved to "ASSOCIATING" with the new AP (AP2). This is a similar to the case where a disconnection event is ignored for a case where local disconnect request can cause the extra event to show up during the next association process following that command. Signed-off-by: Jithu Jance <jithu@broadcom.com> Git-commit: 0d4e3d1d13b2fd28128f10bc7f455034bc1bbcbb Git-repo : git://w1.fi/srv/git/hostap.git Change-Id: If3190b21e0430f181ef342fabf63cd9090fa59b7 CRs-fixed: 771294
Diffstat (limited to 'src')
-rw-r--r--src/drivers/driver_nl80211.c43
1 files changed, 36 insertions, 7 deletions
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 021fb17c..31177c10 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -1501,6 +1501,7 @@ static void mlme_event_connect(struct wpa_driver_nl80211_data *drv,
struct nlattr *resp_ie)
{
union wpa_event_data event;
+ u16 status_code;
if (drv->capa.flags & WPA_DRIVER_FLAGS_SME) {
/*
@@ -1512,21 +1513,41 @@ static void mlme_event_connect(struct wpa_driver_nl80211_data *drv,
return;
}
- if (cmd == NL80211_CMD_CONNECT)
- wpa_printf(MSG_DEBUG, "nl80211: Connect event");
- else if (cmd == NL80211_CMD_ROAM)
+ status_code = status ? nla_get_u16(status) : WLAN_STATUS_SUCCESS;
+
+ if (cmd == NL80211_CMD_CONNECT) {
+ wpa_printf(MSG_DEBUG,
+ "nl80211: Connect event (status=%u ignore_next_local_disconnect=%d)",
+ status_code, drv->ignore_next_local_disconnect);
+ } else if (cmd == NL80211_CMD_ROAM) {
wpa_printf(MSG_DEBUG, "nl80211: Roam event");
+ }
os_memset(&event, 0, sizeof(event));
- if (cmd == NL80211_CMD_CONNECT &&
- nla_get_u16(status) != WLAN_STATUS_SUCCESS) {
+ if (cmd == NL80211_CMD_CONNECT && status_code != WLAN_STATUS_SUCCESS) {
if (addr)
event.assoc_reject.bssid = nla_data(addr);
+ if (drv->ignore_next_local_disconnect) {
+ drv->ignore_next_local_disconnect = 0;
+ if (!event.assoc_reject.bssid ||
+ (os_memcmp(event.assoc_reject.bssid,
+ drv->auth_attempt_bssid,
+ ETH_ALEN) != 0)) {
+ /*
+ * Ignore the event that came without a BSSID or
+ * for the old connection since this is likely
+ * not relevant to the new Connect command.
+ */
+ wpa_printf(MSG_DEBUG,
+ "nl80211: Ignore connection failure event triggered during reassociation");
+ return;
+ }
+ }
if (resp_ie) {
event.assoc_reject.resp_ies = nla_data(resp_ie);
event.assoc_reject.resp_ies_len = nla_len(resp_ie);
}
- event.assoc_reject.status_code = nla_get_u16(status);
+ event.assoc_reject.status_code = status_code;
wpa_supplicant_event(drv->ctx, EVENT_ASSOC_REJECT, &event);
return;
}
@@ -9126,7 +9147,15 @@ static int wpa_driver_nl80211_connect(
struct wpa_driver_nl80211_data *drv,
struct wpa_driver_associate_params *params)
{
- int ret = wpa_driver_nl80211_try_connect(drv, params);
+ int ret;
+
+ /* Store the connection attempted bssid for future use */
+ if (params->bssid)
+ os_memcpy(drv->auth_attempt_bssid, params->bssid, ETH_ALEN);
+ else
+ os_memset(drv->auth_attempt_bssid, 0, ETH_ALEN);
+
+ ret = wpa_driver_nl80211_try_connect(drv, params);
if (ret == -EALREADY) {
/*
* cfg80211 does not currently accept new connections if