aboutsummaryrefslogtreecommitdiffstats
path: root/src/p2p
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2014-01-17 10:52:01 -0800
committerDmitry Shmidt <dimitrysh@google.com>2014-01-17 10:52:01 -0800
commit9e3f8ee32a0c11c56b11985805b5492d04886a99 (patch)
treece82b2b5e4f5fe040f9d1effa9948eae43015b48 /src/p2p
parentb9cc2c06682edb323487f8e7cce1bc95875ed01e (diff)
downloadandroid_external_wpa_supplicant_8-9e3f8ee32a0c11c56b11985805b5492d04886a99.tar.gz
android_external_wpa_supplicant_8-9e3f8ee32a0c11c56b11985805b5492d04886a99.tar.bz2
android_external_wpa_supplicant_8-9e3f8ee32a0c11c56b11985805b5492d04886a99.zip
Cumulative patch from commit 3eaaca1a0b372f31ddc43d152c3681dce48889bb
3eaaca1 P2P: Allow GO Negotiation Request to update peer entry after PD 443427e P2P: Add missing direct global ctrl_iface commands for P2P 37b4198 P2P: Use GO's operating channel to optimize scan during join a691d99 P2P: Don't expire the peer, if GO Negotiation is in progress a0e9d89 Use minimal scan delay upon EVENT_INTERFACE_ADDED 5ddd07c Reset normal_scans counter upon entering INTERFACE_DISABLED state Change-Id: I07ea029ba6d473af39c74c10b7058de0056695da Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Diffstat (limited to 'src/p2p')
-rw-r--r--src/p2p/p2p.c46
-rw-r--r--src/p2p/p2p_go_neg.c12
2 files changed, 21 insertions, 37 deletions
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index 2b3b1827..138ba16b 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -41,40 +41,10 @@ static void p2p_scan_timeout(void *eloop_ctx, void *timeout_ctx);
* P2P_PEER_EXPIRATION_AGE - Number of seconds after which inactive peer
* entries will be removed
*/
-#ifdef ANDROID_P2P
-#define P2P_PEER_EXPIRATION_AGE 30
-#else
#define P2P_PEER_EXPIRATION_AGE 300
-#endif
#define P2P_PEER_EXPIRATION_INTERVAL (P2P_PEER_EXPIRATION_AGE / 2)
-#ifdef ANDROID_P2P
-int p2p_connection_in_progress(struct p2p_data *p2p)
-{
- int ret = 0;
-
- switch (p2p->state) {
- case P2P_CONNECT:
- case P2P_CONNECT_LISTEN:
- case P2P_GO_NEG:
- case P2P_WAIT_PEER_CONNECT:
- case P2P_WAIT_PEER_IDLE:
- case P2P_PROVISIONING:
- case P2P_INVITE:
- case P2P_INVITE_LISTEN:
- ret = 1;
- break;
-
- default:
- wpa_printf(MSG_DEBUG, "p2p_connection_in_progress state %d", p2p->state);
- ret = 0;
- }
-
- return ret;
-}
-#endif
-
static void p2p_expire_peers(struct p2p_data *p2p)
{
struct p2p_device *dev, *n;
@@ -86,6 +56,15 @@ static void p2p_expire_peers(struct p2p_data *p2p)
if (dev->last_seen.sec + P2P_PEER_EXPIRATION_AGE >= now.sec)
continue;
+ if (dev == p2p->go_neg_peer) {
+ /*
+ * GO Negotiation is in progress with the peer, so
+ * don't expire the peer entry until GO Negotiation
+ * fails or times out.
+ */
+ continue;
+ }
+
if (p2p->cfg->go_connected &&
p2p->cfg->go_connected(p2p->cfg->cb_ctx,
dev->info.p2p_device_addr)) {
@@ -111,13 +90,6 @@ static void p2p_expire_peers(struct p2p_data *p2p)
continue;
}
-#ifdef ANDROID_P2P
- /* If Connection is in progress, don't expire the peer
- */
- if (p2p_connection_in_progress(p2p))
- continue;
-#endif
-
p2p_dbg(p2p, "Expiring old peer entry " MACSTR,
MAC2STR(dev->info.p2p_device_addr));
dl_list_del(&dev->list);
diff --git a/src/p2p/p2p_go_neg.c b/src/p2p/p2p_go_neg.c
index 874f4341..a887a5e1 100644
--- a/src/p2p/p2p_go_neg.c
+++ b/src/p2p/p2p_go_neg.c
@@ -590,6 +590,18 @@ void p2p_process_go_neg_req(struct p2p_data *p2p, const u8 *sa,
dev = p2p_add_dev_from_go_neg_req(p2p, sa, &msg);
else if (dev->flags & P2P_DEV_PROBE_REQ_ONLY)
p2p_add_dev_info(p2p, sa, dev, &msg);
+ else if (!dev->listen_freq && !dev->oper_freq) {
+ /*
+ * This may happen if the peer entry was added based on PD
+ * Request and no Probe Request/Response frame has been received
+ * from this peer (or that information has timed out).
+ */
+ p2p_dbg(p2p, "Update peer " MACSTR
+ " based on GO Neg Req since listen/oper freq not known",
+ MAC2STR(dev->info.p2p_device_addr));
+ p2p_add_dev_info(p2p, sa, dev, &msg);
+ }
+
if (dev && dev->flags & P2P_DEV_USER_REJECTED) {
p2p_dbg(p2p, "User has rejected this peer");
status = P2P_SC_FAIL_REJECTED_BY_USER;