[PATCH 4/4] P2P: Fix association with an AP that is not a P2P manager

Ilan Peer ilan.peer
Tue Apr 28 04:01:05 PDT 2015


Do not add P2P IE when a non P2P interface is associating to an
AP the is not a P2P manager, i.e., does set the managed bit in
the P2P capability attribute.

Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
 src/p2p/p2p.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index a45fe73..dfc5ae9 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -2485,10 +2485,21 @@ static int p2p_assoc_req_ie_wlan_ap(struct p2p_data *p2p, const u8 *bssid,
 	size_t tmplen;
 	int res;
 	u8 group_capab;
+	struct p2p_device *peer;
 
 	if (p2p_ie == NULL)
 		return 0; /* WLAN AP is not a P2P manager */
 
+	peer = p2p_get_device(p2p, bssid);
+	if (!peer)
+		return 0;
+
+	p2p_dbg(p2p, "P2P: managed assoc to " MACSTR" capa=0x%X",
+		MAC2STR(bssid), peer->info.dev_capab);
+
+	if (!(peer->info.dev_capab & P2P_DEV_CAPAB_INFRA_MANAGED))
+		return 0;
+
 	/*
 	 * (Re)Association Request - P2P IE
 	 * P2P Capability attribute (shall be present)
@@ -2509,6 +2520,8 @@ static int p2p_assoc_req_ie_wlan_ap(struct p2p_data *p2p, const u8 *bssid,
 			group_capab |= P2P_GROUP_CAPAB_CROSS_CONN;
 	}
 	p2p_buf_add_capability(tmp, p2p->dev_capab, group_capab);
+
+
 	if ((p2p->dev_capab & P2P_DEV_CAPAB_CONCURRENT_OPER) &&
 	    (p2p->dev_capab & P2P_DEV_CAPAB_INFRA_MANAGED))
 		p2p_buf_add_p2p_interface(tmp, p2p);
-- 
1.9.1




More information about the Hostap mailing list