P2P: Report group formation failure on error to start GO mode
authorJouni Malinen <jouni@qca.qualcomm.com>
Thu, 11 Jul 2013 13:42:13 +0000 (16:42 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 11 Jul 2013 14:04:46 +0000 (17:04 +0300)
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>

wpa_supplicant/ap.c
wpa_supplicant/p2p_supplicant.c
wpa_supplicant/p2p_supplicant.h

index bf84dc4..c48a286 100644 (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;
        }
 
index cbc0a38..a97b65f 100644 (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;
 }
 
index a7fadc0..e7ddb85 100644 (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,