P2P: Add peer timeout into group formation 15 second timeout

This adds some more time for WPS provisioning step in case the peer
takes long time to start group interface operations.
This commit is contained in:
Jouni Malinen 2010-09-06 21:04:01 +03:00 committed by Jouni Malinen
parent 2f9929ffcc
commit ae3e342108
5 changed files with 21 additions and 3 deletions

View file

@ -1121,6 +1121,8 @@ void p2p_go_complete(struct p2p_data *p2p, struct p2p_device *peer)
} }
} }
res.peer_config_timeout = go ? peer->client_timeout : peer->go_timeout;
p2p_clear_timeout(p2p); p2p_clear_timeout(p2p);
peer->go_neg_req_sent = 0; peer->go_neg_req_sent = 0;
peer->wps_method = WPS_NOT_READY; peer->wps_method = WPS_NOT_READY;

View file

@ -122,6 +122,11 @@ struct p2p_go_neg_results {
* persistent_group - Whether the group should be made persistent * persistent_group - Whether the group should be made persistent
*/ */
int persistent_group; int persistent_group;
/**
* peer_config_timeout - Peer configuration timeout (in 10 msec units)
*/
unsigned int peer_config_timeout;
}; };
struct p2p_data; struct p2p_data;

View file

@ -567,6 +567,11 @@ void p2p_process_go_neg_req(struct p2p_data *p2p, const u8 *sa,
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Peer operating " wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Peer operating "
"channel preference: %d MHz", dev->oper_freq); "channel preference: %d MHz", dev->oper_freq);
if (msg.config_timeout) {
dev->go_timeout = msg.config_timeout[0];
dev->client_timeout = msg.config_timeout[1];
}
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: GO Negotiation with " MACSTR, MAC2STR(sa)); "P2P: GO Negotiation with " MACSTR, MAC2STR(sa));
if (p2p->state != P2P_IDLE) if (p2p->state != P2P_IDLE)
@ -810,6 +815,9 @@ void p2p_process_go_neg_resp(struct p2p_data *p2p, const u8 *sa,
status = P2P_SC_FAIL_INVALID_PARAMS; status = P2P_SC_FAIL_INVALID_PARAMS;
goto fail; goto fail;
#endif /* CONFIG_P2P_STRICT */ #endif /* CONFIG_P2P_STRICT */
} else {
dev->go_timeout = msg.config_timeout[0];
dev->client_timeout = msg.config_timeout[1];
} }
if (!msg.operating_channel && !go) { if (!msg.operating_channel && !go) {

View file

@ -101,6 +101,9 @@ struct p2p_device {
u16 ext_listen_period; u16 ext_listen_period;
u16 ext_listen_interval; u16 ext_listen_interval;
u8 go_timeout;
u8 client_timeout;
}; };
struct p2p_sd_query { struct p2p_sd_query {

View file

@ -985,9 +985,9 @@ void wpas_go_neg_completed(void *ctx, struct p2p_go_neg_results *res)
eloop_cancel_timeout(wpas_p2p_long_listen_timeout, wpa_s, NULL); eloop_cancel_timeout(wpas_p2p_long_listen_timeout, wpa_s, NULL);
eloop_cancel_timeout(wpas_p2p_group_formation_timeout, wpa_s, NULL); eloop_cancel_timeout(wpas_p2p_group_formation_timeout, wpa_s, NULL);
/* TODO: add peer Config Timeout */ eloop_register_timeout(15 + res->peer_config_timeout / 100,
eloop_register_timeout(15, 0, wpas_p2p_group_formation_timeout, wpa_s, (res->peer_config_timeout % 100) * 10000,
NULL); wpas_p2p_group_formation_timeout, wpa_s, NULL);
} }