[PATCH 2/2] Do not create interface if already running a persisten=
root none
root
Thu Oct 20 23:52:04 PDT 2011
t group
Signed-off-by: root <root at neeraj-ubuntu64.(none)>
---
wpa_supplicant/p2p_supplicant.c | 31 ++++++++++++++++++++-----------
1 files changed, 20 insertions(+), 11 deletions(-)
mode change 100644 =3D> 100755 wpa_supplicant/p2p_supplicant.c
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplican=
t.c
old mode 100644
new mode 100755
index 9af1839..2935e81
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -3517,6 +3517,7 @@ int wpas_p2p_invite(struct wpa_supplicant *wpa_s, con=
st u8 *peer_addr,
{
enum p2p_invite_role role;
u8 *bssid =3D NULL;
+ int go;
=20
if (ssid->mode =3D=3D WPAS_MODE_P2P_GO) {
role =3D P2P_INVITE_ROLE_GO;
@@ -3525,17 +3526,25 @@ int wpas_p2p_invite(struct wpa_supplicant *wpa_s, c=
onst 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 =3D wpa_s->pending_interface_addr;
- } else
- bssid =3D 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 =3D wpa_s->own_addr;
+ }
+ else {
+ /* P2P: We are not already running a persistent group so create an inte=
rface */
+ 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 =3D wpa_s->pending_interface_addr;
+ } else
+ bssid =3D wpa_s->own_addr;
+ }
} else {
role =3D P2P_INVITE_ROLE_CLIENT;
peer_addr =3D ssid->bssid;
--=20
=20
Regards,
-Neeraj
More information about the Hostap
mailing list