From d75e8806961cd9dc0e489083ed405e89887b189f Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 18 Oct 2010 17:00:50 +0300 Subject: [PATCH] P2P: Try to re-create group interface if pending one is not available 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 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index f57e50c94..cecfb1a8c 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -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));