P2P: Limit the retransmission of GO Negotiation request to 120

If the peer you want to connect to is no longer available (does not
acknowledge frames) when wpa_supplicant sends GO Negotition Request
frames, retransmission of this frame is done until the associated
p2p_device  structure is removed on timeout. In that case, no signal
is emitted to  inform the GO Negotiation has failed.

When sending an Invitation Request frame, the same retransmission
mechanism is in place but limit the transmission to 100 and hitting
the limit generates an event.

This patch adds the same mechanism as the one in place for Invitation
Request, but with limit of 120 to match the existing wait_count for
for GO Negotiation.
This commit is contained in:
Fabien Marotte 2010-12-28 11:48:58 +02:00 committed by Jouni Malinen
parent cc5e390d28
commit 9dac8c3eaf
3 changed files with 12 additions and 0 deletions

View File

@ -958,6 +958,7 @@ int p2p_connect(struct p2p_data *p2p, const u8 *peer_addr,
dev->flags &= ~P2P_DEV_USER_REJECTED;
dev->flags &= ~P2P_DEV_WAIT_GO_NEG_RESPONSE;
dev->flags &= ~P2P_DEV_WAIT_GO_NEG_CONFIRM;
dev->connect_reqs = 0;
dev->go_neg_req_sent = 0;
dev->go_state = UNKNOWN_GO;
if (persistent_group)
@ -2365,6 +2366,15 @@ static void p2p_timeout_connect_listen(struct p2p_data *p2p)
"complete");
return;
}
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;
}
p2p_set_state(p2p, P2P_CONNECT);
p2p_connect_send(p2p, p2p->go_neg_peer);
} else

View File

@ -209,6 +209,7 @@ int p2p_connect_send(struct p2p_data *p2p, struct p2p_device *dev)
p2p->pending_action_state = P2P_PENDING_GO_NEG_REQUEST;
p2p->go_neg_peer = dev;
dev->flags |= P2P_DEV_WAIT_GO_NEG_RESPONSE;
dev->connect_reqs++;
if (p2p_send_action(p2p, freq, dev->p2p_device_addr,
p2p->cfg->dev_addr, dev->p2p_device_addr,
wpabuf_head(req), wpabuf_len(req), 200) < 0) {

View File

@ -98,6 +98,7 @@ struct p2p_device {
int status; /* enum p2p_status_code */
unsigned int wait_count;
unsigned int connect_reqs;
unsigned int invitation_reqs;
u16 ext_listen_period;