mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-25 00:38:24 -05:00
P2P: Change order of P2P IE and frequencies set up
When setting up parameters for P2P scan, calculate the frequencies for the scan before calculating the scan IE. This is because the scan IE calculation may need information about the scan frequencies in use. Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
This commit is contained in:
parent
61697c7ecc
commit
94ad3c3389
@ -380,28 +380,6 @@ static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq,
|
|||||||
if (wps_ie == NULL)
|
if (wps_ie == NULL)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
ielen = p2p_scan_ie_buf_len(wpa_s->global->p2p);
|
|
||||||
ies = wpabuf_alloc(wpabuf_len(wps_ie) + ielen);
|
|
||||||
if (ies == NULL) {
|
|
||||||
wpabuf_free(wps_ie);
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
wpabuf_put_buf(ies, wps_ie);
|
|
||||||
wpabuf_free(wps_ie);
|
|
||||||
|
|
||||||
p2p_scan_ie(wpa_s->global->p2p, ies, dev_id);
|
|
||||||
|
|
||||||
params->p2p_probe = 1;
|
|
||||||
n = os_malloc(wpabuf_len(ies));
|
|
||||||
if (n == NULL) {
|
|
||||||
wpabuf_free(ies);
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
os_memcpy(n, wpabuf_head(ies), wpabuf_len(ies));
|
|
||||||
params->extra_ies = n;
|
|
||||||
params->extra_ies_len = wpabuf_len(ies);
|
|
||||||
wpabuf_free(ies);
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case P2P_SCAN_SOCIAL:
|
case P2P_SCAN_SOCIAL:
|
||||||
params->freqs = os_calloc(ARRAY_SIZE(social_channels_freq) + 1,
|
params->freqs = os_calloc(ARRAY_SIZE(social_channels_freq) + 1,
|
||||||
@ -442,6 +420,28 @@ static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ielen = p2p_scan_ie_buf_len(wpa_s->global->p2p);
|
||||||
|
ies = wpabuf_alloc(wpabuf_len(wps_ie) + ielen);
|
||||||
|
if (ies == NULL) {
|
||||||
|
wpabuf_free(wps_ie);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
wpabuf_put_buf(ies, wps_ie);
|
||||||
|
wpabuf_free(wps_ie);
|
||||||
|
|
||||||
|
p2p_scan_ie(wpa_s->global->p2p, ies, dev_id);
|
||||||
|
|
||||||
|
params->p2p_probe = 1;
|
||||||
|
n = os_malloc(wpabuf_len(ies));
|
||||||
|
if (n == NULL) {
|
||||||
|
wpabuf_free(ies);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
os_memcpy(n, wpabuf_head(ies), wpabuf_len(ies));
|
||||||
|
params->extra_ies = n;
|
||||||
|
params->extra_ies_len = wpabuf_len(ies);
|
||||||
|
wpabuf_free(ies);
|
||||||
|
|
||||||
radio_remove_works(wpa_s, "p2p-scan", 0);
|
radio_remove_works(wpa_s, "p2p-scan", 0);
|
||||||
if (radio_add_work(wpa_s, 0, "p2p-scan", 0, wpas_p2p_trigger_scan_cb,
|
if (radio_add_work(wpa_s, 0, "p2p-scan", 0, wpas_p2p_trigger_scan_cb,
|
||||||
params) < 0)
|
params) < 0)
|
||||||
@ -4955,22 +4955,6 @@ static void wpas_p2p_join_scan_req(struct wpa_supplicant *wpa_s, int freq,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ielen = p2p_scan_ie_buf_len(wpa_s->global->p2p);
|
|
||||||
ies = wpabuf_alloc(wpabuf_len(wps_ie) + ielen);
|
|
||||||
if (ies == NULL) {
|
|
||||||
wpabuf_free(wps_ie);
|
|
||||||
wpas_p2p_scan_res_join(wpa_s, NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
wpabuf_put_buf(ies, wps_ie);
|
|
||||||
wpabuf_free(wps_ie);
|
|
||||||
|
|
||||||
p2p_scan_ie(wpa_s->global->p2p, ies, NULL);
|
|
||||||
|
|
||||||
params.p2p_probe = 1;
|
|
||||||
params.extra_ies = wpabuf_head(ies);
|
|
||||||
params.extra_ies_len = wpabuf_len(ies);
|
|
||||||
|
|
||||||
if (!freq) {
|
if (!freq) {
|
||||||
int oper_freq;
|
int oper_freq;
|
||||||
/*
|
/*
|
||||||
@ -4987,6 +4971,22 @@ static void wpas_p2p_join_scan_req(struct wpa_supplicant *wpa_s, int freq,
|
|||||||
params.freqs = freqs;
|
params.freqs = freqs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ielen = p2p_scan_ie_buf_len(wpa_s->global->p2p);
|
||||||
|
ies = wpabuf_alloc(wpabuf_len(wps_ie) + ielen);
|
||||||
|
if (ies == NULL) {
|
||||||
|
wpabuf_free(wps_ie);
|
||||||
|
wpas_p2p_scan_res_join(wpa_s, NULL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
wpabuf_put_buf(ies, wps_ie);
|
||||||
|
wpabuf_free(wps_ie);
|
||||||
|
|
||||||
|
p2p_scan_ie(wpa_s->global->p2p, ies, NULL);
|
||||||
|
|
||||||
|
params.p2p_probe = 1;
|
||||||
|
params.extra_ies = wpabuf_head(ies);
|
||||||
|
params.extra_ies_len = wpabuf_len(ies);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Run a scan to update BSS table and start Provision Discovery once
|
* Run a scan to update BSS table and start Provision Discovery once
|
||||||
* the new scan results become available.
|
* the new scan results become available.
|
||||||
|
Loading…
Reference in New Issue
Block a user