P2P: Postpone concurrent scans when waiting for first client as GO

Previously, concurrent station mode scans were postponed during an
ongoing P2P group formation up to the point of completed WPS
provisioning step. This would allow a scan to be started before the P2P
client has completed association for the data connection if a scan
request were timed to hit the window between the provisioning step and
the following association. Avoid this by extending P2P-in-progress state
to continue until the first data connection has been completed as part
of group formation. Use a ten second timeout for this to avoid leaving
scans disabled indefinitely if the client fails to connect completely.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2013-08-27 12:23:10 +03:00 committed by Jouni Malinen
parent dcfb4d652a
commit c1c0b35fea
2 changed files with 28 additions and 1 deletions

View file

@ -57,6 +57,16 @@
#define P2P_MAX_INITIAL_CONN_WAIT 10
#endif /* P2P_MAX_INITIAL_CONN_WAIT */
#ifndef P2P_MAX_INITIAL_CONN_WAIT_GO
/*
* How many seconds to wait for initial 4-way handshake to get completed after
* WPS provisioning step on the GO. This controls the extra time the P2P
* operation is considered to be in progress (e.g., to delay other scans) after
* WPS provisioning has been completed on the GO during group formation.
*/
#define P2P_MAX_INITIAL_CONN_WAIT_GO 10
#endif /* P2P_MAX_INITIAL_CONN_WAIT_GO */
#ifndef P2P_CONCURRENT_SEARCH_DELAY
#define P2P_CONCURRENT_SEARCH_DELAY 500
#endif /* P2P_CONCURRENT_SEARCH_DELAY */
@ -767,8 +777,10 @@ static void wpas_group_formation_completed(struct wpa_supplicant *wpa_s,
ssid, go_dev_addr);
if (network_id < 0 && ssid)
network_id = ssid->id;
if (!client)
if (!client) {
wpas_notify_p2p_group_started(wpa_s, ssid, network_id, 0);
os_get_time(&wpa_s->global->p2p_go_wait_client);
}
}
@ -5769,6 +5781,19 @@ int wpas_p2p_in_progress(struct wpa_supplicant *wpa_s)
}
}
if (!ret && wpa_s->global->p2p_go_wait_client.sec) {
struct os_time now;
os_get_time(&now);
if (now.sec > wpa_s->global->p2p_go_wait_client.sec +
P2P_MAX_INITIAL_CONN_WAIT_GO) {
/* Wait for the first client has expired */
wpa_s->global->p2p_go_wait_client.sec = 0;
} else {
wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Waiting for initial client connection during group formation");
ret = 1;
}
}
return ret;
}
@ -5828,6 +5853,7 @@ struct wpa_ssid * wpas_p2p_get_persistent(struct wpa_supplicant *wpa_s,
void wpas_p2p_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
const u8 *addr)
{
wpa_s->global->p2p_go_wait_client.sec = 0;
if (addr == NULL)
return;
wpas_p2p_add_persistent_group_client(wpa_s, addr);

View file

@ -252,6 +252,7 @@ struct wpa_global {
struct wpa_supplicant *p2p_group_formation;
struct wpa_supplicant *p2p_invite_group;
u8 p2p_dev_addr[ETH_ALEN];
struct os_time p2p_go_wait_client;
struct dl_list p2p_srv_bonjour; /* struct p2p_srv_bonjour */
struct dl_list p2p_srv_upnp; /* struct p2p_srv_upnp */
int p2p_disabled;