Browse Source

P2P: Check GO Neg Req retransmit limit in p2p_listen_end

This needs to be done both in the more normal location in
p2p_timeout_connect_listen() (internal timeout after driver event) and
in p2p_listen_end() as a workaround for the case where the driver event
is delayed to happen after the internal timeout.
Jouni Malinen 14 years ago
parent
commit
e24cf97c0d
1 changed files with 8 additions and 0 deletions
  1. 8 0
      src/p2p/p2p.c

+ 8 - 0
src/p2p/p2p.c

@@ -2337,6 +2337,14 @@ int p2p_listen_end(struct p2p_data *p2p, unsigned int freq)
 		return 0; /* Internal timeout will trigger the next step */
 
 	if (p2p->state == P2P_CONNECT_LISTEN && p2p->go_neg_peer) {
+		if (p2p->go_neg_peer->connect_reqs >= 120) {
+			wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
+				"P2P: Timeout on sending GO Negotiation "
+				"Request without getting response");
+			p2p_go_neg_failed(p2p, p2p->go_neg_peer, -1);
+			return 0;
+		}
+
 		p2p_set_state(p2p, P2P_CONNECT);
 		p2p_connect_send(p2p, p2p->go_neg_peer);
 		return 1;