OSDN Git Service

Restrict external scan requests during association stage
authorDmitry Shmidt <dimitrysh@google.com>
Mon, 15 Mar 2010 20:24:18 +0000 (13:24 -0700)
committerDmitry Shmidt <dimitrysh@google.com>
Mon, 15 Mar 2010 20:25:23 +0000 (13:25 -0700)
Change-Id: I6976192eddb9086f192aca4f03826bbe784d078a
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
wpa_supplicant/ctrl_iface.c

index 57eb63c..2e67563 100644 (file)
@@ -1600,6 +1600,11 @@ static int wpa_supplicant_ctrl_iface_ap_scan(
 
        if (ap_scan < 0 || ap_scan > 2)
                return -1;
+#ifdef ANDROID
+       if ((ap_scan == 2) && (wpa_s->wpa_state != WPA_COMPLETED)) {
+               return -1;
+       }
+#endif
        wpa_s->conf->ap_scan = ap_scan;
        return 0;
 }
@@ -1752,12 +1757,17 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
                wpa_s->disconnected = 1;
                wpa_supplicant_disassociate(wpa_s, WLAN_REASON_DEAUTH_LEAVING);
        } else if (os_strcmp(buf, "SCAN") == 0) {
-               if (!wpa_s->scanning) {
+#ifdef ANDROID
+               if (!wpa_s->scanning && ((wpa_s->wpa_state <= WPA_SCANNING) ||
+                       (wpa_s->wpa_state >= WPA_COMPLETED))) {
+#endif
                        wpa_s->scan_req = 2;
                        wpa_supplicant_req_scan(wpa_s, 0, 0);
-        } else {
-                       wpa_printf(MSG_DEBUG, "Ongoing Scan action...");
-        }
+#ifdef ANDROID
+               } else {
+                       wpa_printf(MSG_ERROR, "Ongoing Scan action...");
+#endif
+               }
        } else if (os_strcmp(buf, "SCAN_RESULTS") == 0) {
                reply_len = wpa_supplicant_ctrl_iface_scan_results(
                        wpa_s, reply, reply_size);