P2PS: Add group SSID, if known, to the P2PS-PROV-DONE event

The new optional group_ssid=<hexdump> argument in the P2PS-PROV-DONE
event can be used to help in identifying the exact group if there have
been multiple groups with the same P2P Interface Address in short period
of time.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2015-12-30 18:59:03 +02:00 committed by Jouni Malinen
parent 8fb84690ae
commit aa256cb399
4 changed files with 35 additions and 15 deletions

View file

@ -3354,7 +3354,7 @@ static void p2p_prov_disc_cb(struct p2p_data *p2p, int success)
NULL, p2p->p2ps_prov->adv_id, NULL, p2p->p2ps_prov->adv_id,
p2p->p2ps_prov->session_id, p2p->p2ps_prov->session_id,
0, 0, NULL, 0, 0, 0, 0, 0, NULL, 0, 0, 0,
NULL, NULL, 0, 0); NULL, NULL, 0, 0, NULL, 0);
} }
if (p2p->user_initiated_pd) if (p2p->user_initiated_pd)

View file

@ -1074,7 +1074,8 @@ struct p2p_config {
size_t persist_ssid_size, int response_done, size_t persist_ssid_size, int response_done,
int prov_start, const char *session_info, int prov_start, const char *session_info,
const u8 *feat_cap, size_t feat_cap_len, const u8 *feat_cap, size_t feat_cap_len,
unsigned int freq); unsigned int freq, const u8 *group_ssid,
size_t group_ssid_len);
/** /**
* prov_disc_resp_cb - Callback for indicating completion of PD Response * prov_disc_resp_cb - Callback for indicating completion of PD Response

View file

@ -1028,7 +1028,8 @@ out:
NULL, adv_id, session_id, NULL, adv_id, session_id,
0, 0, msg.persistent_ssid, 0, 0, msg.persistent_ssid,
msg.persistent_ssid_len, msg.persistent_ssid_len,
0, 0, NULL, NULL, 0, freq); 0, 0, NULL, NULL, 0, freq,
NULL, 0);
} else if (msg.status && *msg.status == P2P_SC_SUCCESS_DEFERRED && } else if (msg.status && *msg.status == P2P_SC_SUCCESS_DEFERRED &&
p2p->p2ps_prov) { p2p->p2ps_prov) {
p2p->p2ps_prov->status = reject; p2p->p2ps_prov->status = reject;
@ -1041,7 +1042,8 @@ out:
session_id, conncap, 0, session_id, conncap, 0,
msg.persistent_ssid, msg.persistent_ssid,
msg.persistent_ssid_len, 0, msg.persistent_ssid_len, 0,
0, NULL, NULL, 0, freq); 0, NULL, NULL, 0, freq,
NULL, 0);
else else
p2p->cfg->p2ps_prov_complete(p2p->cfg->cb_ctx, p2p->cfg->p2ps_prov_complete(p2p->cfg->cb_ctx,
*msg.status, *msg.status,
@ -1053,7 +1055,8 @@ out:
msg.persistent_ssid_len, 0, msg.persistent_ssid_len, 0,
0, NULL, 0, NULL,
(const u8 *) &resp_fcap, (const u8 *) &resp_fcap,
sizeof(resp_fcap), freq); sizeof(resp_fcap), freq,
NULL, 0);
} else if (msg.status && p2p->p2ps_prov) { } else if (msg.status && p2p->p2ps_prov) {
p2p->p2ps_prov->status = P2P_SC_SUCCESS; p2p->p2ps_prov->status = P2P_SC_SUCCESS;
p2p->cfg->p2ps_prov_complete(p2p->cfg->cb_ctx, *msg.status, sa, p2p->cfg->p2ps_prov_complete(p2p->cfg->cb_ctx, *msg.status, sa,
@ -1064,7 +1067,7 @@ out:
msg.persistent_ssid_len, msg.persistent_ssid_len,
0, 0, NULL, 0, 0, NULL,
(const u8 *) &resp_fcap, (const u8 *) &resp_fcap,
sizeof(resp_fcap), freq); sizeof(resp_fcap), freq, NULL, 0);
} else if (msg.status) { } else if (msg.status) {
} else if (auto_accept && reject == P2P_SC_SUCCESS) { } else if (auto_accept && reject == P2P_SC_SUCCESS) {
p2p->cfg->p2ps_prov_complete(p2p->cfg->cb_ctx, P2P_SC_SUCCESS, p2p->cfg->p2ps_prov_complete(p2p->cfg->cb_ctx, P2P_SC_SUCCESS,
@ -1075,7 +1078,11 @@ out:
msg.persistent_ssid_len, msg.persistent_ssid_len,
0, 0, NULL, 0, 0, NULL,
(const u8 *) &resp_fcap, (const u8 *) &resp_fcap,
sizeof(resp_fcap), freq); sizeof(resp_fcap), freq,
msg.group_id ?
msg.group_id + ETH_ALEN : NULL,
msg.group_id ?
msg.group_id_len - ETH_ALEN : 0);
} else if (reject == P2P_SC_FAIL_INFO_CURRENTLY_UNAVAILABLE && } else if (reject == P2P_SC_FAIL_INFO_CURRENTLY_UNAVAILABLE &&
(!msg.session_info || !msg.session_info_len)) { (!msg.session_info || !msg.session_info_len)) {
p2p->p2ps_prov->method = msg.wps_config_methods; p2p->p2ps_prov->method = msg.wps_config_methods;
@ -1088,7 +1095,7 @@ out:
msg.persistent_ssid_len, msg.persistent_ssid_len,
0, 1, NULL, 0, 1, NULL,
(const u8 *) &resp_fcap, (const u8 *) &resp_fcap,
sizeof(resp_fcap), freq); sizeof(resp_fcap), freq, NULL, 0);
} else if (reject == P2P_SC_FAIL_INFO_CURRENTLY_UNAVAILABLE) { } else if (reject == P2P_SC_FAIL_INFO_CURRENTLY_UNAVAILABLE) {
size_t buf_len = msg.session_info_len; size_t buf_len = msg.session_info_len;
char *buf = os_malloc(2 * buf_len + 1); char *buf = os_malloc(2 * buf_len + 1);
@ -1106,7 +1113,7 @@ out:
msg.persistent_ssid, msg.persistent_ssid_len, msg.persistent_ssid, msg.persistent_ssid_len,
0, 1, buf, 0, 1, buf,
(const u8 *) &resp_fcap, sizeof(resp_fcap), (const u8 *) &resp_fcap, sizeof(resp_fcap),
freq); freq, NULL, 0);
os_free(buf); os_free(buf);
} }
@ -1468,7 +1475,9 @@ void p2p_process_prov_disc_resp(struct p2p_data *p2p, const u8 *sa,
group_mac, adv_id, p2p->p2ps_prov->session_id, group_mac, adv_id, p2p->p2ps_prov->session_id,
conncap, passwd_id, msg.persistent_ssid, conncap, passwd_id, msg.persistent_ssid,
msg.persistent_ssid_len, 1, 0, NULL, msg.persistent_ssid_len, 1, 0, NULL,
msg.feature_cap, msg.feature_cap_len, freq); msg.feature_cap, msg.feature_cap_len, freq,
msg.group_id ? msg.group_id + ETH_ALEN : NULL,
msg.group_id ? msg.group_id_len - ETH_ALEN : 0);
} }
p2ps_prov_free(p2p); p2ps_prov_free(p2p);
} else if (status != P2P_SC_SUCCESS && } else if (status != P2P_SC_SUCCESS &&
@ -1479,7 +1488,7 @@ void p2p_process_prov_disc_resp(struct p2p_data *p2p, const u8 *sa,
p2p->cfg->cb_ctx, status, sa, adv_mac, p2p->cfg->cb_ctx, status, sa, adv_mac,
p2p->p2ps_prov->session_mac, p2p->p2ps_prov->session_mac,
group_mac, adv_id, p2p->p2ps_prov->session_id, group_mac, adv_id, p2p->p2ps_prov->session_id,
0, 0, NULL, 0, 1, 0, NULL, NULL, 0, 0); 0, 0, NULL, 0, 1, 0, NULL, NULL, 0, 0, NULL, 0);
p2ps_prov_free(p2p); p2ps_prov_free(p2p);
} }

View file

@ -3950,7 +3950,8 @@ static void wpas_p2ps_prov_complete(void *ctx, u8 status, const u8 *dev,
size_t persist_ssid_size, int response_done, size_t persist_ssid_size, int response_done,
int prov_start, const char *session_info, int prov_start, const char *session_info,
const u8 *feat_cap, size_t feat_cap_len, const u8 *feat_cap, size_t feat_cap_len,
unsigned int freq) unsigned int freq,
const u8 *group_ssid, size_t group_ssid_len)
{ {
struct wpa_supplicant *wpa_s = ctx; struct wpa_supplicant *wpa_s = ctx;
u8 mac[ETH_ALEN]; u8 mac[ETH_ALEN];
@ -4124,7 +4125,8 @@ static void wpas_p2ps_prov_complete(void *ctx, u8 status, const u8 *dev,
wpa_s, P2P_SC_FAIL_UNKNOWN_GROUP, wpa_s, P2P_SC_FAIL_UNKNOWN_GROUP,
dev, adv_mac, ses_mac, dev, adv_mac, ses_mac,
grp_mac, adv_id, ses_id, 0, 0, grp_mac, adv_id, ses_id, 0, 0,
NULL, 0, 0, 0, NULL, NULL, 0, 0); NULL, 0, 0, 0, NULL, NULL, 0, 0,
NULL, 0);
return; return;
} }
@ -4191,16 +4193,24 @@ static void wpas_p2ps_prov_complete(void *ctx, u8 status, const u8 *dev,
} }
if (conncap == P2PS_SETUP_CLIENT) { if (conncap == P2PS_SETUP_CLIENT) {
char ssid_hex[32 * 2 + 1];
if (group_ssid)
wpa_snprintf_hex(ssid_hex, sizeof(ssid_hex),
group_ssid, group_ssid_len);
else
ssid_hex[0] = '\0';
wpa_msg_global(wpa_s, MSG_INFO, wpa_msg_global(wpa_s, MSG_INFO,
P2P_EVENT_P2PS_PROVISION_DONE MACSTR P2P_EVENT_P2PS_PROVISION_DONE MACSTR
" status=%d conncap=%x" " status=%d conncap=%x"
" adv_id=%x adv_mac=" MACSTR " adv_id=%x adv_mac=" MACSTR
" session=%x mac=" MACSTR " session=%x mac=" MACSTR
" dev_passwd_id=%d join=" MACSTR "%s", " dev_passwd_id=%d join=" MACSTR "%s%s%s",
MAC2STR(dev), status, conncap, MAC2STR(dev), status, conncap,
adv_id, MAC2STR(adv_mac), adv_id, MAC2STR(adv_mac),
ses_id, MAC2STR(ses_mac), ses_id, MAC2STR(ses_mac),
passwd_id, MAC2STR(grp_mac), feat_cap_str); passwd_id, MAC2STR(grp_mac), feat_cap_str,
group_ssid ? " group_ssid=" : "", ssid_hex);
} else { } else {
wpa_msg_global(wpa_s, MSG_INFO, wpa_msg_global(wpa_s, MSG_INFO,
P2P_EVENT_P2PS_PROVISION_DONE MACSTR P2P_EVENT_P2PS_PROVISION_DONE MACSTR