aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
authorIlan Peer <ilan.peer@intel.com>2015-09-24 17:37:58 (GMT)
committerJouni Malinen <j@w1.fi>2015-10-07 14:07:21 (GMT)
commitf8a80e39b33212992f88ce2e638193f81664230a (patch)
treea5866f582008f4211ab74de5156354c829edc55a /wpa_supplicant
parentab804bcb6fcdaa74d2d457f1f5d09d37e3f33085 (diff)
downloadhostap-f8a80e39b33212992f88ce2e638193f81664230a.zip
hostap-f8a80e39b33212992f88ce2e638193f81664230a.tar.gz
hostap-f8a80e39b33212992f88ce2e638193f81664230a.tar.bz2
P2PS: Change connection capability handling
Change the connection capability handling so that in case there are no active roles, the peer has an active GO, and the advertisement supports operation as a client, the returned connection capability is set to client. Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/p2p_supplicant.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 832a379..809c455 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -699,10 +699,20 @@ static u8 p2ps_group_capability(void *ctx, u8 incoming, u8 role)
/* If a required role has been specified, handle it here */
if (role && role != P2PS_SETUP_NEW) {
switch (incoming) {
+ case P2PS_SETUP_GROUP_OWNER | P2PS_SETUP_NEW:
+ case P2PS_SETUP_GROUP_OWNER | P2PS_SETUP_CLIENT:
+ /*
+ * Peer has an active GO, so if the role allows it and
+ * we do not have any active roles, become client.
+ */
+ if ((role & P2PS_SETUP_CLIENT) && !go_wpa_s &&
+ !cli_wpa_s)
+ return P2PS_SETUP_CLIENT;
+
+ /* fall through */
+
case P2PS_SETUP_NONE:
case P2PS_SETUP_NEW:
- case P2PS_SETUP_GROUP_OWNER | P2PS_SETUP_CLIENT:
- case P2PS_SETUP_GROUP_OWNER | P2PS_SETUP_NEW:
conncap = role;
goto grp_owner;
@@ -758,6 +768,13 @@ static u8 p2ps_group_capability(void *ctx, u8 incoming, u8 role)
case P2PS_SETUP_GROUP_OWNER | P2PS_SETUP_NEW:
case P2PS_SETUP_GROUP_OWNER | P2PS_SETUP_CLIENT:
+ /*
+ * Peer has an active GO, so if the role allows it and
+ * we do not have any active roles, become client.
+ */
+ if ((role & P2PS_SETUP_CLIENT) && !go_wpa_s && !cli_wpa_s)
+ return P2PS_SETUP_CLIENT;
+
if (cli_wpa_s)
conncap = P2PS_SETUP_GROUP_OWNER;
else {