OSDN Git Service

Prohibit pno start during assoc process and in connect state
[android-x86/external-wpa_supplicant_8.git] / wpa_supplicant / ctrl_iface.c
index 8736b07..bafe1e9 100644 (file)
@@ -58,6 +58,12 @@ static int pno_start(struct wpa_supplicant *wpa_s)
        if (wpa_s->pno)
                return 0;
 
+       if ((wpa_s->wpa_state > WPA_SCANNING) &&
+           (wpa_s->wpa_state <= WPA_COMPLETED)) {
+               wpa_printf(MSG_ERROR, "PNO: In assoc process");
+               return -EAGAIN;
+       }
+
        if (wpa_s->wpa_state == WPA_SCANNING) {
                wpa_supplicant_cancel_sched_scan(wpa_s);
                wpa_supplicant_cancel_scan(wpa_s);
@@ -5150,8 +5156,19 @@ static int wpa_supplicant_driver_cmd(struct wpa_supplicant *wpa_s, char *cmd,
        int ret;
 
        ret = wpa_drv_driver_cmd(wpa_s, cmd, buf, buflen);
-       if (ret == 0)
+       if (ret == 0) {
+               if (os_strncasecmp(cmd, "COUNTRY", 7) == 0) {
+                       struct p2p_data *p2p = wpa_s->global->p2p;
+                       if (p2p) {
+                               char country[3];
+                               country[0] = cmd[8];
+                               country[1] = cmd[9];
+                               country[2] = 0x04;
+                               p2p_set_country(p2p, country);
+                       }
+               }
                ret = sprintf(buf, "%s\n", "OK");
+       }
        return ret;
 }
 #endif