]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Allow immediate group idle timeout configuration
authorJouni Malinen <jouni@qca.qualcomm.com>
Fri, 13 Apr 2012 14:03:27 +0000 (17:03 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 13 Apr 2012 14:03:27 +0000 (17:03 +0300)
A special value p2p_group_idle=-1 can now be used to configure the P2P
group idle mechanism to terminate a P2P client group immediately on any
disconnection after the completion of the initial 4-way handshake.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

wpa_supplicant/config.h
wpa_supplicant/p2p_supplicant.c

index 9bdc29e22b5f113a22ea0fe3012c509ffb0f37f1..968f14bfb5ce25fe6261f31a079dcc732878a71f 100644 (file)
@@ -526,9 +526,12 @@ struct wpa_config {
         * state indefinitely until explicitly removed. As a P2P client, the
         * maximum idle time of P2P_MAX_CLIENT_IDLE seconds is enforced, i.e.,
         * this parameter is mainly meant for GO use and for P2P client, it can
-        * only be used to reduce the default timeout to smaller value.
+        * only be used to reduce the default timeout to smaller value. A
+        * special value -1 can be used to configure immediate removal of the
+        * group for P2P client role on any disconnection after the data
+        * connection has been established.
         */
-       unsigned int p2p_group_idle;
+       int p2p_group_idle;
 
        /**
         * bss_max_count - Maximum number of BSS entries to keep in memory
index 0b1801eb35b3fd799b7f0652d77d68c380e22105..b2b72ddc58c3486ec3416325302bb049e442ee8f 100644 (file)
@@ -4124,7 +4124,7 @@ static void wpas_p2p_group_idle_timeout(void *eloop_ctx, void *timeout_ctx)
 
 static void wpas_p2p_set_group_idle_timeout(struct wpa_supplicant *wpa_s)
 {
-       unsigned int timeout;
+       int timeout;
 
        if (eloop_cancel_timeout(wpas_p2p_group_idle_timeout, wpa_s, NULL) > 0)
                wpa_printf(MSG_DEBUG, "P2P: Cancelled P2P group idle timeout");
@@ -4140,6 +4140,13 @@ static void wpas_p2p_set_group_idle_timeout(struct wpa_supplicant *wpa_s)
        if (timeout == 0)
                return;
 
+       if (timeout < 0) {
+               if (wpa_s->current_ssid->mode == WPAS_MODE_INFRA)
+                       timeout = 0; /* special client mode no-timeout */
+               else
+                       return;
+       }
+
        if (wpa_s->p2p_in_provisioning) {
                /*
                 * Use the normal group formation timeout during the