P2P: Fix scan_res_handler setting for p2p_scan
The previous version set scan_res_handler unconditionally and then cleared it if scan request failed. This can result in incorrect clearing of the handler to NULL for a previously started scan that has not yet completed. This can make p2p_find command fail to use the start-after-scan-completion mechanism in some cases. Fix this by setting scan_res_handler properly after having verified that the driver command for starting the scan was successful. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com> intended-for: hostap-1
This commit is contained in:
parent
792c8877c3
commit
5b37633364
1 changed files with 4 additions and 6 deletions
|
@ -112,7 +112,6 @@ static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq,
|
|||
struct wpabuf *wps_ie, *ies;
|
||||
int social_channels[] = { 2412, 2437, 2462, 0, 0 };
|
||||
size_t ielen;
|
||||
int was_in_p2p_scan;
|
||||
|
||||
if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
|
||||
return -1;
|
||||
|
@ -163,19 +162,18 @@ static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq,
|
|||
break;
|
||||
}
|
||||
|
||||
was_in_p2p_scan = wpa_s->scan_res_handler == wpas_p2p_scan_res_handler;
|
||||
wpa_s->scan_res_handler = wpas_p2p_scan_res_handler;
|
||||
ret = wpa_drv_scan(wpa_s, ¶ms);
|
||||
|
||||
wpabuf_free(ies);
|
||||
|
||||
if (ret) {
|
||||
wpa_s->scan_res_handler = NULL;
|
||||
if (wpa_s->scanning || was_in_p2p_scan) {
|
||||
if (wpa_s->scanning ||
|
||||
wpa_s->scan_res_handler == wpas_p2p_scan_res_handler) {
|
||||
wpa_s->p2p_cb_on_scan_complete = 1;
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
} else
|
||||
wpa_s->scan_res_handler = wpas_p2p_scan_res_handler;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue