* If this is specified, %wpa_supplicant will open a control interface
--- a/wpa_supplicant/config_file.c
+++ b/wpa_supplicant/config_file.c
-@@ -313,6 +313,13 @@ static int wpa_config_process_ap_scan(st
+@@ -306,6 +306,13 @@ static int wpa_config_parse_int(const st
return 0;
}
+}
+
- static int wpa_config_process_fast_reauth(struct wpa_config *config, char *pos)
- {
-@@ -446,6 +453,9 @@ static int wpa_config_process_global(str
- if (os_strncmp(pos, "ap_scan=", 8) == 0)
- return wpa_config_process_ap_scan(config, pos + 8);
-
-+ if (os_strncmp(pos, "scan_cache=", 11) == 0)
-+ return wpa_config_process_scan_cache(config, pos + 11);
-+
- if (os_strncmp(pos, "fast_reauth=", 12) == 0)
- return wpa_config_process_fast_reauth(config, pos + 12);
-
-@@ -819,6 +829,8 @@ static void wpa_config_write_global(FILE
+ static int wpa_config_parse_str(const struct global_parse_data *data,
+ struct wpa_config *config, int line,
+@@ -433,6 +440,7 @@ static const struct global_parse_data gl
+ #endif /* CONFIG_CTRL_IFACE */
+ { INT_RANGE(eapol_version, 1, 2) },
+ { INT(ap_scan) },
++ { INT(scan_cache) },
+ { INT(fast_reauth) },
+ #ifdef EAP_TLS_OPENSSL
+ { STR(opensc_engine_path) },
+@@ -835,6 +843,8 @@ static void wpa_config_write_global(FILE
fprintf(f, "eapol_version=%d\n", config->eapol_version);
if (config->ap_scan != DEFAULT_AP_SCAN)
fprintf(f, "ap_scan=%d\n", config->ap_scan);
#ifdef EAP_TLS_OPENSSL
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
-@@ -601,6 +601,9 @@ static void wpa_supplicant_event_scan_re
- if (wpa_s->conf->ap_scan == 2 || wpa_s->disconnected)
+@@ -541,7 +541,7 @@ wpa_supplicant_select_bss_non_wpa(struct
+ "BSSID mismatch");
+ continue;
+ }
+-
++
+ if (!(ssid->key_mgmt & WPA_KEY_MGMT_NONE) &&
+ !(ssid->key_mgmt & WPA_KEY_MGMT_WPS) &&
+ !(ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X_NO_WPA))
+@@ -551,7 +551,7 @@ wpa_supplicant_select_bss_non_wpa(struct
+ continue;
+ }
+
+- if ((ssid->key_mgmt &
++ if ((ssid->key_mgmt &
+ (WPA_KEY_MGMT_IEEE8021X | WPA_KEY_MGMT_PSK |
+ WPA_KEY_MGMT_FT_IEEE8021X | WPA_KEY_MGMT_FT_PSK |
+ WPA_KEY_MGMT_IEEE8021X_SHA256 |
+@@ -640,6 +640,9 @@ static void wpa_supplicant_event_scan_re
+ wpa_s->disconnected)
return;
+ if (wpa_s->wpa_state > WPA_ASSOCIATED)
while (selected == NULL) {
for (prio = 0; prio < wpa_s->conf->num_prio; prio++) {
selected = wpa_supplicant_select_bss(
-@@ -613,6 +616,7 @@ static void wpa_supplicant_event_scan_re
+@@ -652,6 +655,7 @@ static void wpa_supplicant_event_scan_re
wpa_printf(MSG_DEBUG, "No APs found - clear blacklist "
"and try again");
wpa_blacklist_clear(wpa_s);
-+ memset(&wpa_s->last_scan_results, 0, sizeof(wpa_s->last_scan_results));
++ memset(&wpa_s->last_scan_results, 0, sizeof(wpa_s->last_scan_results));
+ wpa_s->blacklist_cleared++;
} else if (selected == NULL) {
break;
- }
-@@ -640,10 +644,12 @@ static void wpa_supplicant_event_scan_re
+@@ -687,10 +691,12 @@ static void wpa_supplicant_event_scan_re
rsn_preauth_scan_results(wpa_s->wpa, wpa_s->scan_res);
} else {
wpa_printf(MSG_DEBUG, "No suitable AP found.");
return;
req_scan:
-@@ -847,6 +853,9 @@ static void wpa_supplicant_event_disasso
+@@ -894,6 +900,9 @@ static void wpa_supplicant_event_disasso
}
if (wpa_s->wpa_state >= WPA_ASSOCIATED)
wpa_supplicant_req_scan(wpa_s, 0, 100000);
bssid = wpa_s->pending_bssid;
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
-@@ -334,6 +334,7 @@ struct wpa_supplicant {
+@@ -350,6 +350,7 @@ struct wpa_supplicant {
struct wpa_client_mlme mlme;
int use_client_mlme;
int driver_4way_handshake;
int pending_mic_error_report;
int pending_mic_error_pairwise;
-@@ -385,6 +386,7 @@ int wpa_supplicant_scard_init(struct wpa
+@@ -405,6 +406,7 @@ int wpa_supplicant_scard_init(struct wpa
/* scan.c */
void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec);
+ return 1;
+}
- static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
- {
-@@ -150,8 +162,9 @@ static void wpa_supplicant_scan(void *el
- } else
- wpa_s->prev_scan_ssid = BROADCAST_SSID_SCAN;
+ #ifdef CONFIG_WPS
+ static int wpas_wps_in_use(struct wpa_config *conf,
+@@ -183,8 +195,9 @@ static void wpa_supplicant_scan(void *el
+ wps = wpas_wps_in_use(wpa_s->conf, &req_type);
+ #endif /* CONFIG_WPS */
- if (wpa_s->scan_res_tried == 0 && wpa_s->conf->ap_scan == 1 &&
-- !wpa_s->use_client_mlme) {
+- !wpa_s->use_client_mlme && wps != 2) {
+ if (!wpa_supplicant_may_scan(wpa_s) ||
-+ (wpa_s->scan_res_tried == 0 && wpa_s->conf->ap_scan == 1 &&
-+ !wpa_s->use_client_mlme)) {
++ (wpa_s->scan_res_tried == 0 && wpa_s->conf->ap_scan == 1 &&
++ !wpa_s->use_client_mlme && wps != 2)) {
wpa_s->scan_res_tried++;
wpa_s->scan_req = scan_req;
wpa_printf(MSG_DEBUG, "Trying to get current scan results "
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
-@@ -1441,6 +1441,9 @@ void wpa_supplicant_rx_eapol(void *ctx,
+@@ -1491,6 +1491,9 @@ void wpa_supplicant_rx_eapol(void *ctx,
{
struct wpa_supplicant *wpa_s = ctx;