Browse Source

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.
Jouni Malinen 14 years ago
parent
commit
d75e880696
1 changed files with 10 additions and 1 deletions
  1. 10 1
      wpa_supplicant/p2p_supplicant.c

+ 10 - 1
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));