aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2013-09-08 00:51:04 (GMT)
committerJouni Malinen <j@w1.fi>2014-01-27 19:44:30 (GMT)
commitabe44e3ca20245ed991f105399b0e868b2e3b691 (patch)
tree273e0e20fdc9843eda358b621f3ec0ec54d42677 /wpa_supplicant
parent23318bea947a28c3d147ca4db98aba6aadd22afa (diff)
downloadhostap-abe44e3ca20245ed991f105399b0e868b2e3b691.zip
hostap-abe44e3ca20245ed991f105399b0e868b2e3b691.tar.gz
hostap-abe44e3ca20245ed991f105399b0e868b2e3b691.tar.bz2
P2P NFC: Add GO info into handover message when in client role
P2P Group ID can optionally be included in the connection handover messages when acting as a P2P Client in a group. Add this information and show it in the P2P-NFC-PEER-CLIENT event message. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/p2p_supplicant.c46
1 files changed, 38 insertions, 8 deletions
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 9c815ae..312efc9 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -7041,16 +7041,25 @@ static struct wpabuf * wpas_p2p_nfc_handover(int ndef, struct wpabuf *wsc,
}
-static int wpas_p2p_cli_freq(struct wpa_supplicant *wpa_s)
+static int wpas_p2p_cli_freq(struct wpa_supplicant *wpa_s,
+ struct wpa_ssid **ssid, u8 *go_dev_addr)
{
struct wpa_supplicant *iface;
+ if (go_dev_addr)
+ os_memset(go_dev_addr, 0, ETH_ALEN);
+ if (ssid)
+ *ssid = NULL;
for (iface = wpa_s->global->ifaces; iface; iface = iface->next) {
if (iface->wpa_state < WPA_ASSOCIATING ||
iface->current_ssid == NULL || iface->assoc_freq == 0 ||
!iface->current_ssid->p2p_group ||
iface->current_ssid->mode != WPAS_MODE_INFRA)
continue;
+ if (ssid)
+ *ssid = iface->current_ssid;
+ if (go_dev_addr)
+ os_memcpy(go_dev_addr, iface->go_dev_addr, ETH_ALEN);
return iface->assoc_freq;
}
return 0;
@@ -7061,7 +7070,9 @@ struct wpabuf * wpas_p2p_nfc_handover_req(struct wpa_supplicant *wpa_s,
int ndef)
{
struct wpabuf *wsc, *p2p;
- int cli_freq = wpas_p2p_cli_freq(wpa_s);
+ struct wpa_ssid *ssid;
+ u8 go_dev_addr[ETH_ALEN];
+ int cli_freq = wpas_p2p_cli_freq(wpa_s, &ssid, go_dev_addr);
if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL) {
wpa_printf(MSG_DEBUG, "P2P: P2P disabled - cannot build handover request");
@@ -7080,7 +7091,9 @@ struct wpabuf * wpas_p2p_nfc_handover_req(struct wpa_supplicant *wpa_s,
wpa_s->parent->wps, wpa_s->conf->wps_nfc_dh_pubkey);
} else
wsc = NULL;
- p2p = p2p_build_nfc_handover_req(wpa_s->global->p2p, cli_freq);
+ p2p = p2p_build_nfc_handover_req(wpa_s->global->p2p, cli_freq,
+ go_dev_addr, ssid ? ssid->ssid : NULL,
+ ssid ? ssid->ssid_len : 0);
return wpas_p2p_nfc_handover(ndef, wsc, p2p);
}
@@ -7090,7 +7103,9 @@ struct wpabuf * wpas_p2p_nfc_handover_sel(struct wpa_supplicant *wpa_s,
int ndef, int tag)
{
struct wpabuf *wsc, *p2p;
- int cli_freq = wpas_p2p_cli_freq(wpa_s);
+ struct wpa_ssid *ssid;
+ u8 go_dev_addr[ETH_ALEN];
+ int cli_freq = wpas_p2p_cli_freq(wpa_s, &ssid, go_dev_addr);
if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
return NULL;
@@ -7109,7 +7124,9 @@ struct wpabuf * wpas_p2p_nfc_handover_sel(struct wpa_supplicant *wpa_s,
tag ? wpa_s->conf->wps_nfc_dev_pw : NULL);
} else
wsc = NULL;
- p2p = p2p_build_nfc_handover_sel(wpa_s->global->p2p, cli_freq);
+ p2p = p2p_build_nfc_handover_sel(wpa_s->global->p2p, cli_freq,
+ go_dev_addr, ssid ? ssid->ssid : NULL,
+ ssid ? ssid->ssid_len : 0);
return wpas_p2p_nfc_handover(ndef, wsc, p2p);
}
@@ -7280,12 +7297,25 @@ static int wpas_p2p_nfc_connection_handover(struct wpa_supplicant *wpa_s,
}
if (params.next_step == PEER_CLIENT) {
- wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_NFC_PEER_CLIENT "peer="
- MACSTR, MAC2STR(params.peer->p2p_device_addr));
+ if (!is_zero_ether_addr(params.go_dev_addr)) {
+ wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_NFC_PEER_CLIENT
+ "peer=" MACSTR " freq=%d go_dev_addr=" MACSTR
+ " ssid=\"%s\"",
+ MAC2STR(params.peer->p2p_device_addr),
+ params.go_freq,
+ MAC2STR(params.go_dev_addr),
+ wpa_ssid_txt(params.go_ssid,
+ params.go_ssid_len));
+ } else {
+ wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_NFC_PEER_CLIENT
+ "peer=" MACSTR " freq=%d",
+ MAC2STR(params.peer->p2p_device_addr),
+ params.go_freq);
+ }
return 0;
}
- if (wpas_p2p_cli_freq(wpa_s)) {
+ if (wpas_p2p_cli_freq(wpa_s, NULL, NULL)) {
wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_NFC_WHILE_CLIENT "peer="
MACSTR, MAC2STR(params.peer->p2p_device_addr));
return 0;