]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Try to re-create group interface if pending one is not available
authorJouni Malinen <jouni.malinen@atheros.com>
Mon, 18 Oct 2010 14:00:50 +0000 (17:00 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 18 Oct 2010 14:00:50 +0000 (17:00 +0300)
This is needed to work around cases where the pending interface gets
removed, e.g., due to failed GO Negotiation. In such case, we may still
accept new GO Negotiation to be completed, but the interface did not
get created without a separate p2p_connect command.

The current implementation is not ideal since the re-created interface
may, at least in theory, get incorrect interface addrees. Though, this
would likely require that the driver supported more than one P2P group
interface and that the previous one was already taken into use for
another group.

wpa_supplicant/p2p_supplicant.c

index f57e50c94089bd0d5d4b4c868ca8d23663581452..cecfb1a8c199ab6bae698fdb8297a50456df0e59 100644 (file)
@@ -896,7 +896,16 @@ wpas_p2p_init_group_interface(struct wpa_supplicant *wpa_s, int go)
 
        if (!wpa_s->pending_interface_name[0]) {
                wpa_printf(MSG_ERROR, "P2P: No pending group interface");
-               return NULL;
+               if (!wpas_p2p_create_iface(wpa_s))
+                       return NULL;
+               /*
+                * Something has forced us to remove the pending interface; try
+                * to create a new one and hope for the best that we will get
+                * the same local address.
+                */
+               if (wpas_p2p_add_group_interface(wpa_s, go ? WPA_IF_P2P_GO :
+                                                WPA_IF_P2P_CLIENT) < 0)
+                       return NULL;
        }
 
        os_memset(&iface, 0, sizeof(iface));