summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4c2c675)
raw | patch | inline | side by side (parent: 4c2c675)
author | Jouni Malinen <j@w1.fi> | |
Sun, 18 Dec 2011 20:21:22 +0000 (22:21 +0200) | ||
committer | Jouni Malinen <j@w1.fi> | |
Sun, 18 Dec 2011 20:21:22 +0000 (22:21 +0200) |
The p2p_group_idle configuration parameter is much more useful for
GO role, so use a separate hardcoded value of 10 seconds in P2P
client role. In practice, this means that the P2P client role will
automatically tear down the group when the GO tears down the group.
The 10 second timeout is enough to recover from temporary disconnections
without unnecessary tearing down the group if the GO is still present
and allows the client to connect.
Signed-hostap: Jouni Malinen <j@w1.fi>
GO role, so use a separate hardcoded value of 10 seconds in P2P
client role. In practice, this means that the P2P client role will
automatically tear down the group when the GO tears down the group.
The 10 second timeout is enough to recover from temporary disconnections
without unnecessary tearing down the group if the GO is still present
and allows the client to connect.
Signed-hostap: Jouni Malinen <j@w1.fi>
wpa_supplicant/config.h | patch | blob | history | |
wpa_supplicant/p2p_supplicant.c | patch | blob | history |
index ae496ff544a3b5d38089ab12fd5ae2c36a67820d..f9e5043572fc3cbd43d50fd2b77506d8959c512a 100644 (file)
--- a/wpa_supplicant/config.h
+++ b/wpa_supplicant/config.h
* stations in the group. As a P2P client, this means no GO seen in
* scan results. The maximum idle time is specified in seconds with 0
* indicating no time limit, i.e., the P2P group remains in active
- * state indefinitely until explicitly removed.
+ * 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.
*/
unsigned int p2p_group_idle;
index 80f7afdfd5c3dd78cb3df85595d57fd13c028f82..7cf37d079c8c48dafab9382969f5dbeb946430af 100644 (file)
*/
#define P2P_MAX_JOIN_SCAN_ATTEMPTS 10
+#ifndef P2P_MAX_CLIENT_IDLE
+/*
+ * How many seconds to try to reconnect to the GO when connection in P2P client
+ * role has been lost.
+ */
+#define P2P_MAX_CLIENT_IDLE 10
+#endif /* P2P_MAX_CLIENT_IDLE */
+
static void wpas_p2p_long_listen_timeout(void *eloop_ctx, void *timeout_ctx);
static struct wpa_supplicant *
}
+static int wpas_p2p_is_client(struct wpa_supplicant *wpa_s)
+{
+ return wpa_s->current_ssid != NULL &&
+ wpa_s->current_ssid->p2p_group &&
+ wpa_s->current_ssid->mode == WPAS_MODE_INFRA;
+}
+
+
static void wpas_p2p_group_idle_timeout(void *eloop_ctx, void *timeout_ctx)
{
struct wpa_supplicant *wpa_s = eloop_ctx;
- if (wpa_s->conf->p2p_group_idle == 0) {
+ if (wpa_s->conf->p2p_group_idle == 0 && !wpas_p2p_is_client(wpa_s)) {
wpa_printf(MSG_DEBUG, "P2P: Ignore group idle timeout - "
"disabled");
return;
static void wpas_p2p_set_group_idle_timeout(struct wpa_supplicant *wpa_s)
{
+ unsigned int timeout;
+
eloop_cancel_timeout(wpas_p2p_group_idle_timeout, wpa_s, NULL);
- if (wpa_s->conf->p2p_group_idle == 0)
+ if (wpa_s->current_ssid == NULL || !wpa_s->current_ssid->p2p_group)
return;
- if (wpa_s->current_ssid == NULL || !wpa_s->current_ssid->p2p_group)
+ timeout = wpa_s->conf->p2p_group_idle;
+ if (wpa_s->current_ssid->mode == WPAS_MODE_INFRA &&
+ (timeout == 0 || timeout > P2P_MAX_CLIENT_IDLE))
+ timeout = P2P_MAX_CLIENT_IDLE;
+
+ if (timeout == 0)
return;
wpa_printf(MSG_DEBUG, "P2P: Set P2P group idle timeout to %u seconds",
- wpa_s->conf->p2p_group_idle);
- eloop_register_timeout(wpa_s->conf->p2p_group_idle, 0,
- wpas_p2p_group_idle_timeout, wpa_s, NULL);
+ timeout);
+ eloop_register_timeout(timeout, 0, wpas_p2p_group_idle_timeout,
+ wpa_s, NULL);
}