diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index b03c52b95..3cb63877b 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -837,9 +837,9 @@ static int wpa_supplicant_need_to_roam(struct wpa_supplicant *wpa_s, return 1; } - -static void _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s, - union wpa_event_data *data) +/* Return < 0 if no scan results could be fetched. */ +static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s, + union wpa_event_data *data) { struct wpa_bss *selected; struct wpa_ssid *ssid = NULL; @@ -858,11 +858,11 @@ static void _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s, NULL, 1); if (scan_res == NULL) { if (wpa_s->conf->ap_scan == 2 || ap) - return; + return -1; wpa_dbg(wpa_s, MSG_DEBUG, "Failed to get scan results - try " "scanning again"); wpa_supplicant_req_new_scan(wpa_s, 1, 0); - return; + return -1; } #ifndef CONFIG_NO_RANDOM_POOL @@ -891,13 +891,13 @@ static void _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s, scan_res_handler(wpa_s, scan_res); wpa_scan_results_free(scan_res); - return; + return 0; } if (ap) { wpa_dbg(wpa_s, MSG_DEBUG, "Ignore scan results in AP mode"); wpa_scan_results_free(scan_res); - return; + return 0; } wpa_dbg(wpa_s, MSG_DEBUG, "New scan results available"); @@ -908,18 +908,18 @@ static void _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s, if ((wpa_s->conf->ap_scan == 2 && !wpas_wps_searching(wpa_s))) { wpa_scan_results_free(scan_res); - return; + return 0; } if (wpa_s->disconnected) { wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); wpa_scan_results_free(scan_res); - return; + return 0; } if (bgscan_notify_scan(wpa_s, scan_res) == 1) { wpa_scan_results_free(scan_res); - return; + return 0; } wpa_supplicant_rsn_preauth_scan_results(wpa_s, scan_res); @@ -932,7 +932,7 @@ static void _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s, scan_res); wpa_scan_results_free(scan_res); if (skip) - return; + return 0; wpa_supplicant_connect(wpa_s, selected, ssid); } else { wpa_scan_results_free(scan_res); @@ -958,6 +958,7 @@ static void _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s, timeout_usec); } } + return 0; } @@ -967,7 +968,14 @@ static void wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s, const char *rn, *rn2; struct wpa_supplicant *ifs; - _wpa_supplicant_event_scan_results(wpa_s, data); + if (_wpa_supplicant_event_scan_results(wpa_s, data) < 0) { + /* + * If no scan results could be fetched, then no need to + * notify those interfaces that did not actually request + * this scan. + */ + return; + } /* * Check other interfaces to see if they have the same radio-name. If