[PATCH 09/11] P2PS: Authorize any peer for p2ps method
Ilan Peer
ilan.peer
Sun Jul 12 23:49:15 PDT 2015
From: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
When P2PS PD with default P2PS method is done, the peer that becomes GO
should authorize the client. However, P2PS spec doesn't require the client
to include its intended interface address in PD request/response.
As a result the P2P client's address couldn't be known, so the only possible
option is to authorize ANY.
Previously, client's device address was used for authorization, which is
not correct when a dedicated interface is used for p2p client.
This is not resulting in a connection failure, however it causes a
significant delay (until WPS_PIN_TIME_IGNORE_SEL_REG elapses).
Fix this by authorizing ANY.
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
wpa_supplicant/p2p_supplicant.c | 33 ++++++++++++---------------------
wpa_supplicant/wpa_supplicant_i.h | 4 +++-
2 files changed, 15 insertions(+), 22 deletions(-)
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index ce06e61..983c204 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -1686,14 +1686,12 @@ static void p2p_go_configured(void *ctx, void *data)
params->persistent_group, "");
wpa_s->group_formation_reported = 1;
- if (wpa_s->parent->p2ps_join_addr_valid) {
+ if (wpa_s->parent->p2ps_method_config_any) {
wpa_dbg(wpa_s, MSG_DEBUG,
- "P2PS: Setting default PIN for " MACSTR,
- MAC2STR(wpa_s->parent->p2ps_join_addr));
- wpa_supplicant_ap_wps_pin(wpa_s,
- wpa_s->parent->p2ps_join_addr,
- "12345670", NULL, 0, 0);
- wpa_s->parent->p2ps_join_addr_valid = 0;
+ "P2PS: Setting default PIN for ANY");
+ wpa_supplicant_ap_wps_pin(wpa_s, NULL, "12345670",
+ NULL, 0, 0);
+ wpa_s->parent->p2ps_method_config_any = 0;
}
os_get_reltime(&wpa_s->global->p2p_go_wait_client);
@@ -3808,26 +3806,19 @@ static void wpas_p2ps_prov_complete(void *ctx, u8 status, const u8 *dev,
wpas_p2p_group_add(wpa_s, 1, 0, 0, 0);
}
- if (passwd_id == DEV_PW_P2PS_DEFAULT) {
- os_memcpy(wpa_s->p2ps_join_addr, dev, ETH_ALEN);
- wpa_s->p2ps_join_addr_valid = 1;
- wpa_dbg(wpa_s, MSG_DEBUG,
- "P2PS: Saving PIN for " MACSTR,
- MAC2STR(dev));
- }
+ if (passwd_id == DEV_PW_P2PS_DEFAULT)
+ wpa_s->p2ps_method_config_any = 1;
+
} else if (passwd_id == DEV_PW_P2PS_DEFAULT) {
os_memcpy(go_ifname, go_wpa_s->ifname,
sizeof(go_ifname));
wpa_dbg(go_wpa_s, MSG_DEBUG,
- "P2P: Setting PIN-1 For " MACSTR, MAC2STR(dev));
- wpa_supplicant_ap_wps_pin(go_wpa_s, dev, "12345670",
- NULL, 0, 0);
+ "P2P: Setting PIN-1 For ANY");
+ wpa_supplicant_ap_wps_pin(go_wpa_s, NULL,
+ "12345670", NULL, 0, 0);
- os_memcpy(wpa_s->p2ps_join_addr, dev, ETH_ALEN);
- wpa_s->p2ps_join_addr_valid = 1;
- wpa_dbg(wpa_s, MSG_DEBUG,
- "P2PS: Saving PIN for " MACSTR, MAC2STR(dev));
+ wpa_s->p2ps_method_config_any = 1;
}
wpa_msg_global(wpa_s, MSG_INFO,
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index dd5b245..0e9d000 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -820,7 +820,7 @@ struct wpa_supplicant {
unsigned int p2p_nfc_tag_enabled:1;
unsigned int p2p_peer_oob_pk_hash_known:1;
unsigned int p2p_disable_ip_addr_req:1;
- unsigned int p2ps_join_addr_valid:1;
+ unsigned int p2ps_method_config_any:1;
unsigned int p2p_cli_probe:1;
int p2p_persistent_go_freq;
int p2p_persistent_id;
@@ -841,7 +841,9 @@ struct wpa_supplicant {
/* group common frequencies */
int *p2p_group_common_freqs;
unsigned int p2p_group_common_freqs_num;
+
u8 p2ps_join_addr[ETH_ALEN];
+
#endif /* CONFIG_P2P */
struct wpa_ssid *bgscan_ssid;
--
1.9.1
More information about the Hostap
mailing list