]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AOSP: assoc_retries
authorJouni Malinen <j@w1.fi>
Thu, 9 Aug 2012 19:05:53 +0000 (22:05 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 9 Aug 2012 20:18:31 +0000 (23:18 +0300)
wpa_supplicant/events.c
wpa_supplicant/wpa_supplicant.c
wpa_supplicant/wpa_supplicant_i.h

index a32dd4e72cc8c90be60034aa11b1a26c801f25b5..26c0d447b923c05f42c964b0d02e67c2953412cf 100644 (file)
@@ -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)
index de3fb638535f51890ea0b1f4f042265c4d6d222e..cbdeb208701621ef6a75922cfc5824cd54086c84 100644 (file)
@@ -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);
 
index e1175046626fbce7cf1bad82ceec86fb7427192c..f0d73894c5e3d78a631ef4a06dbfb53bb3b05485 100644 (file)
@@ -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;