From 10c4edde6e4e060778adbf59ff7c294303dc205b Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Wed, 27 Oct 2010 19:36:10 +0300 Subject: [PATCH] P2P: Do not re-send PD Request for join-a-group after acked frame We are not actually interested in the PD Response in join-a-group case, so there is no point in trying to send PD Request until the response is received. This avoids an extra PD getting started after a join-a-group operation in some cases. --- src/p2p/p2p.c | 14 +++++++++++--- src/p2p/p2p_i.h | 1 + src/p2p/p2p_pd.c | 4 ++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index 5f112ab94..d060de836 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -1920,7 +1920,13 @@ void p2p_continue_find(struct p2p_data *p2p) return; else break; - } else if (dev->req_config_methods) { + } else if (dev->req_config_methods && + !(dev->flags & P2P_DEV_PD_FOR_JOIN)) { + wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Send " + "pending Provisioning Discovery Request to " + MACSTR " (config methods 0x%x)", + MAC2STR(dev->p2p_device_addr), + dev->req_config_methods); if (p2p_send_prov_disc_req(p2p, dev, 0) == 0) return; } @@ -2543,7 +2549,7 @@ int p2p_get_peer_info(struct p2p_data *p2p, const u8 *addr, int next, "country=%c%c\n" "oper_freq=%d\n" "req_config_methods=0x%x\n" - "flags=%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n" + "flags=%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n" "status=%d\n" "wait_count=%u\n" "invitation_reqs=%u\n", @@ -2593,7 +2599,9 @@ int p2p_get_peer_info(struct p2p_data *p2p, const u8 *addr, int next, dev->flags & P2P_DEV_GROUP_CLIENT_ONLY ? "[GROUP_CLIENT_ONLY]" : "", dev->flags & P2P_DEV_FORCE_FREQ ? - "[FORCE_FREQ" : "", + "[FORCE_FREQ]" : "", + dev->flags & P2P_DEV_PD_FOR_JOIN ? + "[PD_FOR_JOIN]" : "", dev->status, dev->wait_count, dev->invitation_reqs); diff --git a/src/p2p/p2p_i.h b/src/p2p/p2p_i.h index b87a3ef4a..be05a8428 100644 --- a/src/p2p/p2p_i.h +++ b/src/p2p/p2p_i.h @@ -93,6 +93,7 @@ struct p2p_device { #define P2P_DEV_WAIT_GO_NEG_CONFIRM BIT(11) #define P2P_DEV_GROUP_CLIENT_ONLY BIT(12) #define P2P_DEV_FORCE_FREQ BIT(13) +#define P2P_DEV_PD_FOR_JOIN BIT(14) unsigned int flags; int status; /* enum p2p_status_code */ diff --git a/src/p2p/p2p_pd.c b/src/p2p/p2p_pd.c index 5f767500c..55341aa08 100644 --- a/src/p2p/p2p_pd.c +++ b/src/p2p/p2p_pd.c @@ -327,6 +327,10 @@ int p2p_prov_disc_req(struct p2p_data *p2p, const u8 *peer_addr, return -1; dev->req_config_methods = config_methods; + if (join) + dev->flags |= P2P_DEV_PD_FOR_JOIN; + else + dev->flags &= ~P2P_DEV_PD_FOR_JOIN; if (p2p->go_neg_peer || (p2p->state != P2P_IDLE && p2p->state != P2P_SEARCH &&