aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/p2p/p2p.c7
-rw-r--r--src/p2p/p2p_go_neg.c10
-rw-r--r--wpa_supplicant/p2p_supplicant.c2
-rw-r--r--wpa_supplicant/wps_supplicant.c21
4 files changed, 37 insertions, 3 deletions
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index 608f834..7a1a315 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -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);
diff --git a/src/p2p/p2p_go_neg.c b/src/p2p/p2p_go_neg.c
index f55bba7..bf36c7a 100644
--- a/src/p2p/p2p_go_neg.c
+++ b/src/p2p/p2p_go_neg.c
@@ -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;
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index b9b18bb..88e5295 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -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)
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index c955e9f..55a03e2 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -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);