From 79cad775dd779889782caef6946fe9d444e7dbc2 Mon Sep 17 00:00:00 2001 From: Dmitry Shmidt Date: Mon, 10 Sep 2012 16:15:47 -0700 Subject: wpa_supplicant: Postpone P2P scan if usual scan is in progress BUG: b/7137954 Change-Id: I64ef8dbb51c354b4cdebe490ffcd2cec07995939 Signed-off-by: Dmitry Shmidt --- wpa_supplicant/p2p_supplicant.c | 37 ++++++++++++++----------------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 6dbfcdf..73d082e 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -166,10 +166,23 @@ static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq, wpa_printf(MSG_DEBUG, "Delaying P2P scan to allow " "pending station mode scan to be " "completed on interface %s", ifs->ifname); +#ifdef ANDROID_P2P + ifs->p2p_cb_on_scan_complete = 1; +#else wpa_s->p2p_cb_on_scan_complete = 1; +#endif wpa_supplicant_req_scan(ifs, 0, 0); return 1; } +#ifdef ANDROID_P2P + else if(ifs->scanning) { + wpa_printf(MSG_DEBUG, "Wait for the STA scan" + "to be " + "completed on interface %s", ifs->ifname); + ifs->p2p_cb_on_scan_complete = 1; + return 1; + } +#endif } os_memset(¶ms, 0, sizeof(params)); @@ -283,11 +296,7 @@ static int wpas_p2p_group_delete(struct wpa_supplicant *wpa_s, const char *reason; ssid = wpa_s->current_ssid; -#ifdef ANDROID_P2P - if ((ssid == NULL) && (wpa_s->p2p_group_interface == NOT_P2P_GROUP_INTERFACE)) { -#else if (ssid == NULL) { -#endif /* * The current SSID was not known, but there may still be a * pending P2P group interface waiting for provisioning. @@ -700,6 +709,7 @@ static void wpas_group_formation_completed(struct wpa_supplicant *wpa_s, #ifdef ANDROID_P2P /* For client Second phase of Group formation (4-way handshake) can be still pending * So we need to restore wpa_s->global->p2p_group_formation */ + wpa_printf(MSG_INFO, "Restoring back wpa_s->global->p2p_group_formation to wpa_s %p\n", wpa_s); wpa_s->global->p2p_group_formation = wpa_s; #endif @@ -5198,28 +5208,9 @@ int wpas_p2p_disconnect(struct wpa_supplicant *wpa_s) int wpas_p2p_in_progress(struct wpa_supplicant *wpa_s) { -#ifdef ANDROID_P2P - struct wpa_supplicant *group = wpa_s; -#endif - if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL) return 0; -#ifdef ANDROID_P2P - while (group && (group->p2p_group_interface != NOT_P2P_GROUP_INTERFACE)) { - if(group->wpa_state == WPA_ASSOCIATED) { - /* WPA_ASSOCIATED hasn't moved to WPA_COMPLETED. So it could be in WPS - * or 4Way Hanshake phase. Avoid allowing scan during this time critical - * phase - */ - wpa_printf(MSG_ERROR, "P2P: WPS/4way handshake in Progress." - " Defer SCAN "); - return 1; - } - group = group->next; - } -#endif - return p2p_in_progress(wpa_s->global->p2p); } -- cgit v1.1 From 1cccfe8c0b59094a2564d268040478ecb278e790 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 5 Oct 2012 11:01:57 -0700 Subject: P2P: Fix network removal to select correct block If wpa_s->current_ssid is not set (e.g., after disconnection that did not result in immediate group removal), an incorrect group could have been removed since the network block iteration here could select the network block that is used to store persistent group credentials. Fix this by verifying that disabled != 2 to avoid picking the network block that could not have been the temporary P2P group. Bug: 7290511 Change-Id: Ia61bab3e11137ab2c0c34014e4d8d8bdee2a0469 --- wpa_supplicant/p2p_supplicant.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index a51254a..efc36cd 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -272,7 +272,7 @@ static int wpas_p2p_group_delete(struct wpa_supplicant *wpa_s, */ ssid = wpa_s->conf->ssid; while (ssid) { - if (ssid->p2p_group) + if (ssid->p2p_group && ssid->disabled != 2) break; ssid = ssid->next; } -- cgit v1.1