diff options
author | Jean-Baptiste Queru <jbq@google.com> | 2012-10-03 15:25:25 -0700 |
---|---|---|
committer | Jean-Baptiste Queru <jbq@google.com> | 2012-10-03 15:25:28 -0700 |
commit | 992b10f49def736e424b9d6e01130de28b09cd1f (patch) | |
tree | f48bed420b337cec8dce0e01ab3b2ae4be27d64f | |
parent | 978afbdbf1e4b5e950f419ad5c24d08cd7df1f6d (diff) | |
parent | 0531f20404b2e284d1b444d5af48b6e0c629975b (diff) | |
download | wpa_supplicant_8-tools_r21.tar.gz |
Reconcile with jb-dev - do not mergetools_r21
Change-Id: Ie7428c559f53a12d88e9afdbd7234423881aed0f
-rw-r--r-- | wpa_supplicant/config_ssid.h | 7 | ||||
-rw-r--r-- | wpa_supplicant/events.c | 50 | ||||
-rw-r--r-- | wpa_supplicant/wpa_supplicant.c | 5 | ||||
-rw-r--r-- | wpa_supplicant/wpa_supplicant_i.h | 3 |
4 files changed, 43 insertions, 22 deletions
diff --git a/wpa_supplicant/config_ssid.h b/wpa_supplicant/config_ssid.h index 2605ae80..45a423c0 100644 --- a/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h @@ -423,6 +423,13 @@ struct wpa_ssid { */ int export_keys; +#ifdef ANDROID_P2P + /** + * assoc_retry - Number of times association should be retried. + */ + int assoc_retry; +#endif + #ifdef CONFIG_HT_OVERRIDES /** * disable_ht - Disable HT (IEEE 802.11n) for this network diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index e729e825..ee0af50f 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -2263,23 +2263,39 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, 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; +#ifdef CONFIG_P2P + else if (wpa_s->p2p_group_interface != NOT_P2P_GROUP_INTERFACE) { + if (!wpa_s->current_ssid) { + wpa_printf(MSG_ERROR, "current_ssid == NULL"); + break; + } + /* 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->current_ssid->assoc_retry++ < 5) { + wpa_printf(MSG_ERROR, "Retrying assoc: %d ", + wpa_s->current_ssid->assoc_retry); + wpa_supplicant_cancel_auth_timeout(wpa_s); + + /* Clear the states */ + wpa_sm_notify_disassoc(wpa_s->wpa); + wpa_supplicant_deauthenticate(wpa_s, WLAN_REASON_DEAUTH_LEAVING); + + wpa_s->reassociate = 1; + wpa_supplicant_req_scan(wpa_s, 1, 0); + } else { + /* If we ASSOC_REJECT's hits threshold, disable the + * network + */ + wpa_printf(MSG_ERROR, "Assoc retry threshold reached. " + "Disabling the network"); + wpa_s->current_ssid->assoc_retry = 0; + wpa_supplicant_disable_network(wpa_s, wpa_s->current_ssid); + wpas_p2p_group_remove(wpa_s, wpa_s->ifname); + } + } +#endif #endif /* ANDROID_P2P */ break; case EVENT_AUTH_TIMED_OUT: diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index cb5b42f3..e1ad4d96 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -582,8 +582,9 @@ void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s, wpa_supplicant_state_txt(state)); #ifdef ANDROID_P2P - if(state == WPA_ASSOCIATED || (state <= WPA_INACTIVE)) - wpa_s->assoc_retries = 0; + if(state == WPA_ASSOCIATED && wpa_s->current_ssid) { + wpa_s->current_ssid->assoc_retry = 0; + } #endif /* ANDROID_P2P */ if (state != WPA_SCANNING) diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index 33b62586..21fe5cc4 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -276,9 +276,6 @@ 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; |