P2P: Do not re-send PD Request for join-a-group after acked frame
authorJouni Malinen <jouni.malinen@atheros.com>
Wed, 27 Oct 2010 16:36:10 +0000 (19:36 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 27 Oct 2010 16:36:10 +0000 (19:36 +0300)
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
src/p2p/p2p_i.h
src/p2p/p2p_pd.c

index 5f112ab..d060de8 100644 (file)
@@ -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);
index b87a3ef..be05a84 100644 (file)
@@ -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 */
index 5f76750..55341aa 100644 (file)
@@ -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 &&