old mode 100644
new mode 100755
@@ -3517,6 +3517,7 @@ int wpas_p2p_invite(struct wpa_supplicant *wpa_s, const u8 *peer_addr,
{
enum p2p_invite_role role;
u8 *bssid = NULL;
+ int go;
if (ssid->mode == WPAS_MODE_P2P_GO) {
role = P2P_INVITE_ROLE_GO;
@@ -3525,17 +3526,25 @@ int wpas_p2p_invite(struct wpa_supplicant *wpa_s, const u8 *peer_addr,
"address in invitation command");
return -1;
}
- if (wpas_p2p_create_iface(wpa_s)) {
- if (wpas_p2p_add_group_interface(wpa_s,
- WPA_IF_P2P_GO) < 0) {
- wpa_printf(MSG_ERROR, "P2P: Failed to "
- "allocate a new interface for the "
- "group");
- return -1;
- }
- bssid = wpa_s->pending_interface_addr;
- } else
- bssid = wpa_s->own_addr;
+ /* P2P: Check to see if we are already running a persistent group */
+ if (wpas_get_p2p_group(wpa_s, ssid->ssid, ssid->ssid_len, &go)) {
+ if (go)
+ bssid = wpa_s->own_addr;
+ }
+ else {
+ /* P2P: We are not already running a persistent group so create an interface */
+ if (wpas_p2p_create_iface(wpa_s)) {
+ if (wpas_p2p_add_group_interface(wpa_s,
+ WPA_IF_P2P_GO) < 0) {
+ wpa_printf(MSG_ERROR, "P2P: Failed to "
+ "allocate a new interface for the "
+ "group");
+ return -1;
+ }
+ bssid = wpa_s->pending_interface_addr;
+ } else
+ bssid = wpa_s->own_addr;
+ }
} else {
role = P2P_INVITE_ROLE_CLIENT;
peer_addr = ssid->bssid;