Use special scan result processing steps only on requesting interface

Scan result events are shared between all virtual interfaces sharing the
same radio. However, some of the steps are not really appropriate on
virtual interfaces that did not issue the scan request. Fix this by
making these steps conditional on the scan results being processed on
the interface that requested them.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2013-03-18 17:07:09 +02:00 committed by Jouni Malinen
parent b1cd021e29
commit cfd31b5026

View file

@ -1089,7 +1089,8 @@ static int wpa_supplicant_need_to_roam(struct wpa_supplicant *wpa_s,
/* Return != 0 if no scan results could be fetched or if scan results should not
* be shared with other virtual interfaces. */
static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
union wpa_event_data *data)
union wpa_event_data *data,
int own_request)
{
struct wpa_scan_results *scan_res;
int ap = 0;
@ -1105,7 +1106,7 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
wpa_supplicant_notify_scanning(wpa_s, 0);
#ifdef CONFIG_P2P
if (wpa_s->global->p2p_cb_on_scan_complete &&
if (own_request && wpa_s->global->p2p_cb_on_scan_complete &&
!wpa_s->global->p2p_disabled &&
wpa_s->global->p2p != NULL && !wpa_s->sta_scan_pending &&
!wpa_s->scan_res_handler) {
@ -1128,6 +1129,8 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
if (wpa_s->conf->ap_scan == 2 || ap ||
wpa_s->scan_res_handler == scan_only_handler)
return -1;
if (!own_request)
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);
@ -1150,7 +1153,7 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
}
#endif /* CONFIG_NO_RANDOM_POOL */
if (wpa_s->scan_res_handler) {
if (own_request && wpa_s->scan_res_handler) {
void (*scan_res_handler)(struct wpa_supplicant *wpa_s,
struct wpa_scan_results *scan_res);
@ -1292,7 +1295,7 @@ static void wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
const char *rn, *rn2;
struct wpa_supplicant *ifs;
if (_wpa_supplicant_event_scan_results(wpa_s, data) != 0) {
if (_wpa_supplicant_event_scan_results(wpa_s, data, 1) != 0) {
/*
* If no scan results could be fetched, then no need to
* notify those interfaces that did not actually request
@ -1325,7 +1328,7 @@ static void wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
if (rn2 && os_strcmp(rn, rn2) == 0) {
wpa_printf(MSG_DEBUG, "%s: Updating scan results from "
"sibling", ifs->ifname);
_wpa_supplicant_event_scan_results(ifs, data);
_wpa_supplicant_event_scan_results(ifs, data, 0);
}
}
}