aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--wpa_supplicant/config_ssid.h2
-rw-r--r--wpa_supplicant/events.c20
-rw-r--r--wpa_supplicant/wpa_supplicant.c5
-rw-r--r--wpa_supplicant/wpa_supplicant_i.h4
4 files changed, 28 insertions, 3 deletions
diff --git a/wpa_supplicant/config_ssid.h b/wpa_supplicant/config_ssid.h
index 45a423c0..b2981d97 100644
--- a/wpa_supplicant/config_ssid.h
+++ b/wpa_supplicant/config_ssid.h
@@ -423,7 +423,7 @@ struct wpa_ssid {
*/
int export_keys;
-#ifdef ANDROID_P2P
+#if defined(ANDROID_P2P) && !defined(LEGACY_STA_EVENTS)
/**
* assoc_retry - Number of times association should be retried.
*/
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index ee0af50f..c886037b 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -2263,7 +2263,25 @@ 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
-#ifdef CONFIG_P2P
+#if defined(LEGACY_STA_EVENTS)
+ /* 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;
+#else if defined(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");
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index e1ad4d96..26c898d7 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -582,9 +582,14 @@ void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s,
wpa_supplicant_state_txt(state));
#ifdef ANDROID_P2P
+#ifdef LEGACY_STA_EVENTS
+ if(state == WPA_ASSOCIATED || (state <= WPA_INACTIVE))
+ wpa_s->assoc_retries = 0;
+#else
if(state == WPA_ASSOCIATED && wpa_s->current_ssid) {
wpa_s->current_ssid->assoc_retry = 0;
}
+#endif
#endif /* ANDROID_P2P */
if (state != WPA_SCANNING)
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index 21fe5cc4..6127737c 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -276,7 +276,9 @@ struct wpa_supplicant {
struct wpa_bss *current_bss;
int ap_ies_from_associnfo;
unsigned int assoc_freq;
-
+#ifdef LEGACY_STA_EVENTS
+ unsigned int assoc_retries;
+#endif
/* Selected configuration (based on Beacon/ProbeResp WPA IE) */
int pairwise_cipher;
int group_cipher;