From: Sunil Dutt Date: Tue, 6 May 2014 16:34:37 +0000 (+0530) Subject: P2P: Refrain from performing extended listen during P2P connection X-Git-Tag: hostap_2_2~176 X-Git-Url: http://www.project-moonshot.org/gitweb/?a=commitdiff_plain;h=0f1034e3889e7b8f54ed59317f1234db8167d12e;hp=8d0dd4eebc14857890b974ae5a0312830d87d8e3;p=mech_eap.git P2P: Refrain from performing extended listen during P2P connection Do not perform extended listen period operations when either a P2P connection is in progress. This makes the connection more robust should an extended listen timer trigger during such an operation. Signed-off-by: Jouni Malinen --- diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index b30ea56..5e227ec 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -3849,6 +3849,13 @@ static void p2p_ext_listen_timeout(void *eloop_ctx, void *timeout_ctx) p2p_ext_listen_timeout, p2p, NULL); } + if (p2p->cfg->is_p2p_in_progress && + p2p->cfg->is_p2p_in_progress(p2p->cfg->cb_ctx)) { + p2p_dbg(p2p, "Operation in progress - skip Extended Listen timeout (%s)", + p2p_state_txt(p2p->state)); + return; + } + if (p2p->state == P2P_LISTEN_ONLY && p2p->ext_listen_only) { /* * This should not really happen, but it looks like the Listen diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h index abbb111..fa8031d 100644 --- a/src/p2p/p2p.h +++ b/src/p2p/p2p.h @@ -805,6 +805,14 @@ struct p2p_config { * or 0 if not. */ int (*is_concurrent_session_active)(void *ctx); + + /** + * is_p2p_in_progress - Check whether P2P operation is in progress + * @ctx: Callback context from cb_ctx + * Returns: 1 if P2P operation (e.g., group formation) is in progress + * or 0 if not. + */ + int (*is_p2p_in_progress)(void *ctx); }; diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 522d277..be160c0 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -3748,6 +3748,13 @@ static void wpas_presence_resp(void *ctx, const u8 *src, u8 status, } +static int _wpas_p2p_in_progress(void *ctx) +{ + struct wpa_supplicant *wpa_s = ctx; + return wpas_p2p_in_progress(wpa_s); +} + + /** * wpas_p2p_init - Initialize P2P module for %wpa_supplicant * @global: Pointer to global data from wpa_supplicant_init() @@ -3795,6 +3802,7 @@ int wpas_p2p_init(struct wpa_global *global, struct wpa_supplicant *wpa_s) p2p.go_connected = wpas_go_connected; p2p.presence_resp = wpas_presence_resp; p2p.is_concurrent_session_active = wpas_is_concurrent_session_active; + p2p.is_p2p_in_progress = _wpas_p2p_in_progress; os_memcpy(wpa_s->global->p2p_dev_addr, wpa_s->own_addr, ETH_ALEN); os_memcpy(p2p.dev_addr, wpa_s->global->p2p_dev_addr, ETH_ALEN);