aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIrfan Sheriff <isheriff@google.com>2012-09-04 16:32:08 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-09-04 16:32:08 -0700
commitc5c02f1d8a39ff95f2a01e1cee7daf3c0ade6dbe (patch)
tree1d8a0becd2c2e637f288dc8c3b7d942af4370889
parent978afbdbf1e4b5e950f419ad5c24d08cd7df1f6d (diff)
parenta831bff72fa9e58cc9f71717f63c7649002e64fb (diff)
downloadexternal_wpa_supplicant_8-c5c02f1d8a39ff95f2a01e1cee7daf3c0ade6dbe.zip
external_wpa_supplicant_8-c5c02f1d8a39ff95f2a01e1cee7daf3c0ade6dbe.tar.gz
external_wpa_supplicant_8-c5c02f1d8a39ff95f2a01e1cee7daf3c0ade6dbe.tar.bz2
am a831bff7: Restore STA reconnection behavior
* commit 'a831bff72fa9e58cc9f71717f63c7649002e64fb': Restore STA reconnection behavior
-rw-r--r--wpa_supplicant/events.c50
1 files changed, 33 insertions, 17 deletions
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index e729e82..ee0af50 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: