Browse Source

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.
Jouni Malinen 14 years ago
parent
commit
10c4edde6e
3 changed files with 16 additions and 3 deletions
  1. 11 3
      src/p2p/p2p.c
  2. 1 0
      src/p2p/p2p_i.h
  3. 4 0
      src/p2p/p2p_pd.c

+ 11 - 3
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);

+ 1 - 0
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 */

+ 4 - 0
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 &&