aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2012-08-09 19:05:53 (GMT)
committerJouni Malinen <j@w1.fi>2012-08-09 20:18:31 (GMT)
commit60e1b8b361849db9bc0e3a43f55a23afc3da5a26 (patch)
treece2568a772bfbe231127c0770558d1760aed4760
parent500db924a8feedba90f0bd3340c7527656770685 (diff)
downloadhostap-60e1b8b361849db9bc0e3a43f55a23afc3da5a26.zip
hostap-60e1b8b361849db9bc0e3a43f55a23afc3da5a26.tar.gz
hostap-60e1b8b361849db9bc0e3a43f55a23afc3da5a26.tar.bz2
AOSP: assoc_retries
-rw-r--r--wpa_supplicant/events.c19
-rw-r--r--wpa_supplicant/wpa_supplicant.c5
-rw-r--r--wpa_supplicant/wpa_supplicant_i.h3
3 files changed, 27 insertions, 0 deletions
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index a32dd4e..26c0d44 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -2219,6 +2219,25 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
data->assoc_reject.status_code);
if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME)
sme_event_assoc_reject(wpa_s, data);
+#ifdef ANDROID_P2P
+ /* If assoc reject is reported by the driver, then avoid
+ * waiting for the authentication timeout. Cancel the
+ * authentication timeout and retry the assoc.
+ */
+ if(wpa_s->assoc_retries++ < 5) {
+ wpa_printf(MSG_ERROR, "Retrying assoc "
+ "Iteration:%d", wpa_s->assoc_retries);
+ wpa_supplicant_cancel_auth_timeout(wpa_s);
+
+ /* Clear the states */
+ wpa_sm_notify_disassoc(wpa_s->wpa);
+ wpa_supplicant_disassociate(wpa_s, WLAN_REASON_DEAUTH_LEAVING);
+
+ wpa_s->reassociate = 1;
+ wpa_supplicant_req_scan(wpa_s, 1, 0);
+ } else
+ wpa_s->assoc_retries = 0;
+#endif /* ANDROID_P2P */
break;
case EVENT_AUTH_TIMED_OUT:
if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME)
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index de3fb63..cbdeb20 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -581,6 +581,11 @@ void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s,
wpa_supplicant_state_txt(wpa_s->wpa_state),
wpa_supplicant_state_txt(state));
+#ifdef ANDROID_P2P
+ if(state == WPA_ASSOCIATED || (state <= WPA_INACTIVE))
+ wpa_s->assoc_retries = 0;
+#endif /* ANDROID_P2P */
+
if (state != WPA_SCANNING)
wpa_supplicant_notify_scanning(wpa_s, 0);
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index e117504..f0d7389 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -274,6 +274,9 @@ struct wpa_supplicant {
struct wpa_bss *current_bss;
int ap_ies_from_associnfo;
unsigned int assoc_freq;
+#ifdef ANDROID_P2P
+ unsigned int assoc_retries;
+#endif
/* Selected configuration (based on Beacon/ProbeResp WPA IE) */
int pairwise_cipher;