P2P: Use SSID from GO Negotiation to limit WPS provisioning step
In order to avoid picking incorrect SSID from old scan results, use SSID from GO Negotiation to select the AP.
This commit is contained in:
parent
743ef79914
commit
e9a7ae41fa
4 changed files with 37 additions and 3 deletions
|
@ -1092,8 +1092,13 @@ void p2p_go_complete(struct p2p_data *p2p, struct p2p_device *peer)
|
|||
os_memcpy(res.ssid, p2p->ssid, p2p->ssid_len);
|
||||
res.ssid_len = p2p->ssid_len;
|
||||
p2p_random(res.passphrase, 8);
|
||||
} else
|
||||
} else {
|
||||
res.freq = peer->oper_freq;
|
||||
if (p2p->ssid_len) {
|
||||
os_memcpy(res.ssid, p2p->ssid, p2p->ssid_len);
|
||||
res.ssid_len = p2p->ssid_len;
|
||||
}
|
||||
}
|
||||
|
||||
p2p_channels_intersect(&p2p->channels, &peer->channels,
|
||||
&intersection);
|
||||
|
|
|
@ -786,11 +786,14 @@ void p2p_process_go_neg_resp(struct p2p_data *p2p, const u8 *sa,
|
|||
}
|
||||
|
||||
if (!go && msg.group_id) {
|
||||
/* TODO: Store SSID for Provisioning step */
|
||||
/* Store SSID for Provisioning step */
|
||||
p2p->ssid_len = msg.group_id_len - ETH_ALEN;
|
||||
os_memcpy(p2p->ssid, msg.group_id + ETH_ALEN, p2p->ssid_len);
|
||||
} else if (!go) {
|
||||
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
|
||||
"P2P: Mandatory P2P Group ID attribute missing from "
|
||||
"GO Negotiation Response");
|
||||
p2p->ssid_len = 0;
|
||||
#ifdef CONFIG_P2P_STRICT
|
||||
status = P2P_SC_FAIL_INVALID_PARAMS;
|
||||
goto fail;
|
||||
|
@ -1034,11 +1037,14 @@ void p2p_process_go_neg_conf(struct p2p_data *p2p, const u8 *sa,
|
|||
}
|
||||
|
||||
if (dev->go_state == REMOTE_GO && msg.group_id) {
|
||||
/* TODO: Store SSID for Provisioning step */
|
||||
/* Store SSID for Provisioning step */
|
||||
p2p->ssid_len = msg.group_id_len - ETH_ALEN;
|
||||
os_memcpy(p2p->ssid, msg.group_id + ETH_ALEN, p2p->ssid_len);
|
||||
} else if (dev->go_state == REMOTE_GO) {
|
||||
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
|
||||
"P2P: Mandatory P2P Group ID attribute missing from "
|
||||
"GO Negotiation Confirmation");
|
||||
p2p->ssid_len = 0;
|
||||
#ifdef CONFIG_P2P_STRICT
|
||||
p2p_parse_free(&msg);
|
||||
return;
|
||||
|
|
|
@ -698,6 +698,8 @@ static int wpas_copy_go_neg_results(struct wpa_supplicant *wpa_s,
|
|||
static void wpas_start_wps_enrollee(struct wpa_supplicant *wpa_s,
|
||||
struct p2p_go_neg_results *res)
|
||||
{
|
||||
wpa_hexdump_ascii(MSG_DEBUG, "P2P: Start WPS Enrollee for SSID",
|
||||
res->ssid, res->ssid_len);
|
||||
wpa_supplicant_ap_deinit(wpa_s);
|
||||
wpas_copy_go_neg_results(wpa_s, res);
|
||||
if (res->wps_method == WPS_PBC)
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "blacklist.h"
|
||||
#include "bss.h"
|
||||
#include "scan.h"
|
||||
#include "p2p/p2p.h"
|
||||
#include "p2p_supplicant.h"
|
||||
#include "wps_supplicant.h"
|
||||
|
||||
|
@ -691,6 +692,16 @@ int wpas_wps_start_pbc(struct wpa_supplicant *wpa_s, const u8 *bssid,
|
|||
return -1;
|
||||
ssid->temporary = 1;
|
||||
ssid->p2p_group = p2p_group;
|
||||
if (p2p_group && wpa_s->go_params && wpa_s->go_params->ssid_len) {
|
||||
ssid->ssid = os_zalloc(wpa_s->go_params->ssid_len + 1);
|
||||
if (ssid->ssid) {
|
||||
ssid->ssid_len = wpa_s->go_params->ssid_len;
|
||||
os_memcpy(ssid->ssid, wpa_s->go_params->ssid,
|
||||
ssid->ssid_len);
|
||||
wpa_hexdump_ascii(MSG_DEBUG, "WPS: Use specific AP "
|
||||
"SSID", ssid->ssid, ssid->ssid_len);
|
||||
}
|
||||
}
|
||||
wpa_config_set(ssid, "phase1", "\"pbc=1\"", 0);
|
||||
if (wpa_s->wps_fragment_size)
|
||||
ssid->eap.fragment_size = wpa_s->wps_fragment_size;
|
||||
|
@ -714,6 +725,16 @@ int wpas_wps_start_pin(struct wpa_supplicant *wpa_s, const u8 *bssid,
|
|||
return -1;
|
||||
ssid->temporary = 1;
|
||||
ssid->p2p_group = p2p_group;
|
||||
if (p2p_group && wpa_s->go_params && wpa_s->go_params->ssid_len) {
|
||||
ssid->ssid = os_zalloc(wpa_s->go_params->ssid_len + 1);
|
||||
if (ssid->ssid) {
|
||||
ssid->ssid_len = wpa_s->go_params->ssid_len;
|
||||
os_memcpy(ssid->ssid, wpa_s->go_params->ssid,
|
||||
ssid->ssid_len);
|
||||
wpa_hexdump_ascii(MSG_DEBUG, "WPS: Use specific AP "
|
||||
"SSID", ssid->ssid, ssid->ssid_len);
|
||||
}
|
||||
}
|
||||
if (pin)
|
||||
os_snprintf(val, sizeof(val), "\"pin=%s dev_pw_id=%u\"",
|
||||
pin, dev_pw_id);
|
||||
|
|
Loading…
Reference in a new issue