P2P: Report group formation failure on error to start GO mode

There is no need to wait for the 15 second group formation timeout
before indicating P2P group formation failure if GO mode cannot be
started successfully for some reason.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2013-07-11 16:42:13 +03:00 committed by Jouni Malinen
parent b62b29ea87
commit 1075b29571
3 changed files with 15 additions and 8 deletions

View file

@ -494,6 +494,11 @@ int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s,
if (wpa_drv_associate(wpa_s, &params) < 0) {
wpa_msg(wpa_s, MSG_INFO, "Failed to start AP functionality");
#ifdef CONFIG_P2P
if (ssid->mode == WPAS_MODE_P2P_GROUP_FORMATION &&
wpa_s->global->p2p_group_formation == wpa_s)
wpas_p2p_group_formation_failed(wpa_s->parent);
#endif /* CONFIG_P2P */
return -1;
}

View file

@ -1123,6 +1123,14 @@ static void wpas_p2p_group_formation_timeout(void *eloop_ctx,
{
struct wpa_supplicant *wpa_s = eloop_ctx;
wpa_printf(MSG_DEBUG, "P2P: Group Formation timed out");
wpas_p2p_group_formation_failed(wpa_s);
}
void wpas_p2p_group_formation_failed(struct wpa_supplicant *wpa_s)
{
eloop_cancel_timeout(wpas_p2p_group_formation_timeout,
wpa_s->parent, NULL);
if (wpa_s->global->p2p)
p2p_group_formation_failed(wpa_s->global->p2p);
else if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
@ -5559,14 +5567,7 @@ int wpas_p2p_notif_pbc_overlap(struct wpa_supplicant *wpa_s)
"session overlap");
if (wpa_s != wpa_s->parent)
wpa_msg_ctrl(wpa_s->parent, MSG_INFO, WPS_EVENT_OVERLAP);
if (wpa_s->global->p2p)
p2p_group_formation_failed(wpa_s->global->p2p);
eloop_cancel_timeout(wpas_p2p_group_formation_timeout,
wpa_s->parent, NULL);
wpas_group_formation_completed(wpa_s, 0);
wpas_p2p_group_formation_failed(wpa_s);
return 1;
}

View file

@ -74,6 +74,7 @@ void wpas_p2p_group_deinit(struct wpa_supplicant *wpa_s);
void wpas_dev_found(void *ctx, const u8 *addr,
const struct p2p_peer_info *info,
int new_device);
void wpas_p2p_group_formation_failed(struct wpa_supplicant *wpa_s);
void wpas_go_neg_completed(void *ctx, struct p2p_go_neg_results *res);
void wpas_go_neg_req_rx(void *ctx, const u8 *src, u16 dev_passwd_id);
void wpas_prov_disc_req(void *ctx, const u8 *peer, u16 config_methods,