aboutsummaryrefslogtreecommitdiffstats
path: root/src/p2p
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2012-07-23 21:59:01 +0300
committerJouni Malinen <j@w1.fi>2012-07-23 21:59:01 +0300
commit488f4a7108e021be97fc1841fff9042d2b7d737f (patch)
tree5c1e06c2d632a08afa0091965aedc83fb5cdbc23 /src/p2p
parenta5ed45586c63ffd8f9d2b44e27c251d7bacbeaf4 (diff)
downloadexternal_wpa_supplicant_8_ti-488f4a7108e021be97fc1841fff9042d2b7d737f.zip
external_wpa_supplicant_8_ti-488f4a7108e021be97fc1841fff9042d2b7d737f.tar.gz
external_wpa_supplicant_8_ti-488f4a7108e021be97fc1841fff9042d2b7d737f.tar.bz2
P2P: Fix provision discovery retries during p2p_find
Commit 6b56cc2d97fe9efd1feea8d418714b4658b056f1 added retries of provision discovery request frames in IDLE state. However, it did not make the p2p_find case behave consistently with the new limitied retry behavior. This can result in way too many and frequent PD retries. Fix this by extending the previous commit to address PD retries and maximum retry limit consistently regardless of whether p2p_find is running. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com> intended-for: hostap-1
Diffstat (limited to 'src/p2p')
-rw-r--r--src/p2p/p2p.c8
-rw-r--r--src/p2p/p2p_pd.c8
2 files changed, 11 insertions, 5 deletions
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index 35dc195..f1d4345 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -2598,7 +2598,13 @@ static void p2p_prov_disc_cb(struct p2p_data *p2p, int success)
if (!success) {
p2p->pending_action_state = P2P_NO_PENDING_ACTION;
- if (p2p->state != P2P_IDLE)
+ if (p2p->user_initiated_pd &&
+ (p2p->state == P2P_SEARCH || p2p->state == P2P_LISTEN_ONLY))
+ {
+ /* Retry request from timeout to avoid busy loops */
+ p2p->pending_action_state = P2P_PENDING_PD;
+ p2p_set_timeout(p2p, 0, 50000);
+ } else if (p2p->state != P2P_IDLE)
p2p_continue_find(p2p);
else if (p2p->user_initiated_pd) {
p2p->pending_action_state = P2P_PENDING_PD;
diff --git a/src/p2p/p2p_pd.c b/src/p2p/p2p_pd.c
index 38a9dd8..4be7098 100644
--- a/src/p2p/p2p_pd.c
+++ b/src/p2p/p2p_pd.c
@@ -16,8 +16,8 @@
/*
- * Number of retries to attempt for provision discovery requests during IDLE
- * state in case the peer is not listening.
+ * Number of retries to attempt for provision discovery requests
+ * in case the peer is not listening.
*/
#define MAX_PROV_DISC_REQ_RETRIES 10
@@ -347,6 +347,7 @@ int p2p_send_prov_disc_req(struct p2p_data *p2p, struct p2p_device *dev,
if (p2p->state != P2P_IDLE)
p2p_stop_listen_for_freq(p2p, freq);
p2p->pending_action_state = P2P_PENDING_PD;
+ p2p_set_timeout(p2p, 0, 300000);
if (p2p_send_action(p2p, freq, dev->info.p2p_device_addr,
p2p->cfg->dev_addr, dev->info.p2p_device_addr,
wpabuf_head(req), wpabuf_len(req), 200) < 0) {
@@ -408,8 +409,7 @@ int p2p_prov_disc_req(struct p2p_data *p2p, const u8 *peer_addr,
*/
p2p->user_initiated_pd = !join;
- /* Also set some retries to attempt in case of IDLE state */
- if (p2p->user_initiated_pd && p2p->state == P2P_IDLE)
+ if (p2p->user_initiated_pd)
p2p->pd_retries = MAX_PROV_DISC_REQ_RETRIES;
return p2p_send_prov_disc_req(p2p, dev, join, force_freq);