[RFC] hostapd: Make inactivity polling configurable

Yogesh Ashok Powar yogeshp
Tue Sep 20 00:08:08 PDT 2011


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
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 in practical scenario's this limit can be much lesser than
the current limit in the hostpad which is 255.

Signed-off-by: Yogesh Ashok Powar <yogeshp at marvell.com>
Signed-off-by: Nishant Sarmukadam <nishants at marvell.com>
---
 hostapd/config_file.c |    2 ++
 hostapd/hostapd.conf  |    7 +++++++
 src/ap/ap_config.h    |    1 +
 src/ap/sta_info.c     |    6 +++++-
 4 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 6ffa981..5a3c9f7 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -2041,6 +2041,8 @@ struct hostapd_config * hostapd_config_read(const char *fname)
 #endif /* CONFIG_P2P_MANAGER */
 		} else if (os_strcmp(buf, "disassoc_low_ack") == 0) {
 			bss->disassoc_low_ack = atoi(pos);
+		} else if (os_strcmp(buf, "skip_inactivity_poll") == 0) {
+			bss->skip_inactivity_poll = atoi(pos);
 		} else if (os_strcmp(buf, "tdls_prohibit") == 0) {
 			int val = atoi(pos);
 			if (val)
diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index 3e145ae..ae16f0d 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -339,6 +339,13 @@ wmm_ac_vo_acm=0
 # the STA with a data frame.
 # default: 300 (i.e., 5 minutes)
 #ap_max_inactivity=300
+#
+#
+# The polling is configurable for users. Users who wish to skip the
+# polling method and only use the station inactivity values to decide
+# to deauthenticate and disconnect stations can set 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
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index 09eed5a..96b07ff 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -329,6 +329,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)
diff --git a/src/ap/sta_info.c b/src/ap/sta_info.c
index ef90bf9..330a564 100644
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
@@ -297,12 +297,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_DEBUG, "Station " MACSTR " has ACKed data "
 			"poll", MAC2STR(sta->addr));
 		/* data nullfunc frame poll did not produce TX errors; assume
-- 
1.7.0.4




More information about the Hostap mailing list