[PATCH 03/19] P2P: fix return value of p2p_reply_probe and p2p_probe_req_rx
Ilan Peer
ilan.peer
Wed Jun 10 01:43:33 PDT 2015
From: Max Stepanov <Max.Stepanov at intel.com>
Return P2P_PREQ_PROCESSED instead of P2P_PREQ_NOT_PROCESSED on
a successful probe request handling in p2p_reply_probe.
Verify a return value of p2p_reply_probe in p2p_probe_req_rx
and continue a pending invitation/connection flow only if a
probe is a probe request from an expected P2P peer.
Signed-off-by: Max Stepanov <Max.Stepanov at intel.com>
Reviewed-by: Ilan Peer <ilan.peer at intel.com>
---
src/p2p/p2p.c | 34 ++++++++++++++++++++++------------
1 file changed, 22 insertions(+), 12 deletions(-)
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index f435faf..a3b1f4c 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -2443,7 +2443,7 @@ p2p_reply_probe(struct p2p_data *p2p, const u8 *addr, const u8 *dst,
wpabuf_free(buf);
- return P2P_PREQ_NOT_PROCESSED;
+ return P2P_PREQ_PROCESSED;
}
@@ -2457,28 +2457,38 @@ p2p_probe_req_rx(struct p2p_data *p2p, const u8 *addr, const u8 *dst,
res = p2p_reply_probe(p2p, addr, dst, bssid, ie, ie_len, rx_freq);
+ if (res != P2P_PREQ_PROCESSED && res != P2P_PREQ_NOT_PROCESSED)
+ return res;
+
+ /*
+ * Activate a pending GON/Invite flow if a received probe request
+ * is from an expected peer. Some devices may share the same
+ * address for P2P and non-P2P STA running simultaneously. The
+ * P2P_PREQ_PROCESSED and P2P_PREQ_NOT_PROCESSED p2p_reply_probe
+ * return values verified above ensure we are handling a probe request
+ * from P2P peer.
+ */
if ((p2p->state == P2P_CONNECT || p2p->state == P2P_CONNECT_LISTEN) &&
p2p->go_neg_peer &&
os_memcmp(addr, p2p->go_neg_peer->info.p2p_device_addr, ETH_ALEN)
== 0 &&
!(p2p->go_neg_peer->flags & P2P_DEV_WAIT_GO_NEG_CONFIRM)) {
/* Received a Probe Request from GO Negotiation peer */
- p2p_dbg(p2p, "Found GO Negotiation peer - try to start GO negotiation from timeout");
+ p2p_dbg(p2p,
+ "Found GO Negotiation peer - try to start GO negotiation from timeout");
eloop_cancel_timeout(p2p_go_neg_start, p2p, NULL);
eloop_register_timeout(0, 0, p2p_go_neg_start, p2p, NULL);
- return P2P_PREQ_PROCESSED;
- }
-
- if ((p2p->state == P2P_INVITE || p2p->state == P2P_INVITE_LISTEN) &&
- p2p->invite_peer &&
- (p2p->invite_peer->flags & P2P_DEV_WAIT_INV_REQ_ACK) &&
- os_memcmp(addr, p2p->invite_peer->info.p2p_device_addr, ETH_ALEN)
- == 0) {
+ } else if ((p2p->state == P2P_INVITE ||
+ p2p->state == P2P_INVITE_LISTEN) &&
+ p2p->invite_peer &&
+ (p2p->invite_peer->flags & P2P_DEV_WAIT_INV_REQ_ACK) &&
+ os_memcmp(addr, p2p->invite_peer->info.p2p_device_addr,
+ ETH_ALEN) == 0) {
/* Received a Probe Request from Invite peer */
- p2p_dbg(p2p, "Found Invite peer - try to start Invite from timeout");
+ p2p_dbg(p2p,
+ "Found Invite peer - try to start Invite from timeout");
eloop_cancel_timeout(p2p_invite_start, p2p, NULL);
eloop_register_timeout(0, 0, p2p_invite_start, p2p, NULL);
- return P2P_PREQ_PROCESSED;
}
return res;
--
1.9.1
More information about the Hostap
mailing list