]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: Make inactivity polling configurable
authorYogesh Ashok Powar <yogeshp@marvell.com>
Sun, 25 Dec 2011 18:57:01 +0000 (20:57 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 25 Dec 2011 18:57:01 +0000 (20:57 +0200)
hostapd uses the poll method to check if the station is alive
after the station has been inactive for ap_max_inactivity seconds.
Make the poll mechanism configurable so that user can choose to
disconnect idle clients.

This can be especially useful when some devices/firmwares have
restrictions on the number of clients that can connect to the AP
and that limit is smaller than the total number of stations trying
to use the AP.

Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: Nishant Sarmukadam <nishants@marvell.com>
hostapd/config_file.c
hostapd/hostapd.conf
src/ap/ap_config.h
src/ap/sta_info.c

index ca7969537aa3d4a39b26b1f117cac5ae579176ea..467d39fc9cfb602aa6641d72c38556fb7508bf73 100644 (file)
@@ -1334,6 +1334,8 @@ struct hostapd_config * hostapd_config_read(const char *fname)
                        bss->isolate = atoi(pos);
                } else if (os_strcmp(buf, "ap_max_inactivity") == 0) {
                        bss->ap_max_inactivity = atoi(pos);
+               } else if (os_strcmp(buf, "skip_inactivity_poll") == 0) {
+                       bss->skip_inactivity_poll = atoi(pos);
                } else if (os_strcmp(buf, "country_code") == 0) {
                        os_memcpy(conf->country, pos, 2);
                        /* FIX: make this configurable */
index 5272d58502dc924f4aa8e05aa2adf644499d1997..4e6202b2e302803a0494ed19126b93f36fd5910c 100644 (file)
@@ -339,6 +339,12 @@ wmm_ac_vo_acm=0
 # the STA with a data frame.
 # default: 300 (i.e., 5 minutes)
 #ap_max_inactivity=300
+#
+# The inactivity polling can be disabled to disconnect stations based on
+# inactivity timeout so that idle stations are more likely to be disconnected
+# even if they are still in range of the AP. This can be done by setting
+# skip_inactivity_poll to 1 (default 0).
+#skip_inactivity_poll=0
 
 # Disassociate stations based on excessive transmission failures or other
 # indications of connection loss. This depends on the driver capabilities and
index cc7122c20ed992f34f6dcb2bc2b37d0d9bbb5e23..485092d9a986046c280cc0b7f21ad84545b030da 100644 (file)
@@ -340,6 +340,7 @@ struct hostapd_bss_config {
        int p2p;
 
        int disassoc_low_ack;
+       int skip_inactivity_poll;
 
 #define TDLS_PROHIBIT BIT(0)
 #define TDLS_PROHIBIT_CHAN_SWITCH BIT(1)
index 27ab25856b9157c4b6f22e5f968c9783142fe356..972a72367026c654c50d12e7397f42b38f01944e 100644 (file)
@@ -301,12 +301,16 @@ void ap_handle_timer(void *eloop_ctx, void *timeout_ctx)
                                "inactive too long: %d sec, max allowed: %d",
                                MAC2STR(sta->addr), inactive_sec,
                                hapd->conf->ap_max_inactivity);
+
+                       if (hapd->conf->skip_inactivity_poll)
+                               sta->timeout_next = STA_DISASSOC;
                }
        }
 
        if ((sta->flags & WLAN_STA_ASSOC) &&
            sta->timeout_next == STA_DISASSOC &&
-           !(sta->flags & WLAN_STA_PENDING_POLL)) {
+           !(sta->flags & WLAN_STA_PENDING_POLL) &&
+           !hapd->conf->skip_inactivity_poll) {
                wpa_msg(hapd->msg_ctx, MSG_DEBUG, "Station " MACSTR
                        " has ACKed data poll", MAC2STR(sta->addr));
                /* data nullfunc frame poll did not produce TX errors; assume