P2P: Refrain from performing extended listen during P2P connection
authorSunil Dutt <usdutt@qti.qualcomm.com>
Tue, 6 May 2014 16:34:37 +0000 (22:04 +0530)
committerJouni Malinen <j@w1.fi>
Fri, 9 May 2014 17:42:44 +0000 (20:42 +0300)
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 <jouni@qca.qualcomm.com>
src/p2p/p2p.c
src/p2p/p2p.h
wpa_supplicant/p2p_supplicant.c

index b30ea56..5e227ec 100644 (file)
@@ -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
index abbb111..fa8031d 100644 (file)
@@ -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);
 };
 
 
index 522d277..be160c0 100644 (file)
@@ -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);