OSDN Git Service

Add better handling of CTRL-EVENT-ASSOC-REJECT
authorJeff Johnson <jjohnson@qca.qualcomm.com>
Mon, 22 Oct 2012 01:19:27 +0000 (18:19 -0700)
committerIrfan Sheriff <isheriff@google.com>
Tue, 23 Oct 2012 21:15:48 +0000 (14:15 -0700)
In an enterprise environment a given Access Point (AP) may reject an
association request due to load balancing.  In an enterprise with a
congested Wi-Fi network we may have to connect to many APs before we
find one that will accept the connection.  Currently when the
wpa_supplicant receives a CTRL-EVENT-ASSOC-REJECT it will continue to
count down the 10 second authentication timer, and doesn't realize
that it should now attempt to find a different AP.  Fix this issue in
multiple ways.  First, we increase the number of association rejects
we handle before we disable the network.  This will allow us more
opportunity to authenticate with other APs which are sharing the same
SSID.  Second, when we are rejected we immediately blacklist the AP
and rescan so that we can immediately attempt to connect to other APs.

Bug: 7329568
Change-Id: I0ff66a0e05e6d4a9dec3dea98eccd850ecd5e343

wpa_supplicant/events.c

index 6e9d7ba..34300e4 100644 (file)
@@ -2532,7 +2532,7 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
                        sme_event_assoc_reject(wpa_s, data);
 #ifdef ANDROID_P2P
 #ifdef CONFIG_P2P
-               else if (wpa_s->p2p_group_interface != NOT_P2P_GROUP_INTERFACE) {
+               else {
                        if(!wpa_s->current_ssid) {
                                wpa_printf(MSG_ERROR, "current_ssid == NULL");
                                break;
@@ -2541,9 +2541,10 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
                         * waiting for  the authentication timeout. Cancel the
                         * authentication timeout and retry the assoc.
                         */
-                       if(wpa_s->current_ssid->assoc_retry++ < 5) {
+                       if(wpa_s->current_ssid->assoc_retry++ < 10) {
                                wpa_printf(MSG_ERROR, "Retrying assoc: %d ",
                                                                wpa_s->current_ssid->assoc_retry);
+
                                wpa_supplicant_cancel_auth_timeout(wpa_s);
 
                                /* Clear the states */
@@ -2551,8 +2552,13 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
                                wpa_supplicant_deauthenticate(wpa_s, WLAN_REASON_DEAUTH_LEAVING);
 
                                wpa_s->reassociate = 1;
-                               wpa_supplicant_req_scan(wpa_s, 1, 0);
-                       } else {
+                               if (wpa_s->p2p_group_interface == NOT_P2P_GROUP_INTERFACE) {
+                                       wpa_blacklist_add(wpa_s, data->assoc_reject.bssid);
+                                       wpa_supplicant_req_scan(wpa_s, 0, 0);
+                               } else {
+                                       wpa_supplicant_req_scan(wpa_s, 1, 0);
+                               }
+                       } else if (wpa_s->p2p_group_interface != NOT_P2P_GROUP_INTERFACE) {
                                /* If we ASSOC_REJECT's hits threshold, disable the 
                                 * network
                                 */