diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c index bf84dc456..c48a28659 100644 --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c @@ -494,6 +494,11 @@ int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s, if (wpa_drv_associate(wpa_s, ¶ms) < 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; } diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index cbc0a38dd..a97b65ff7 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -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; } diff --git a/wpa_supplicant/p2p_supplicant.h b/wpa_supplicant/p2p_supplicant.h index a7fadc049..e7ddb85ed 100644 --- a/wpa_supplicant/p2p_supplicant.h +++ b/wpa_supplicant/p2p_supplicant.h @@ -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,