]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WNM: Configurable BSS Max Idle Period management on AP
authorJouni Malinen <quic_jouni@quicinc.com>
Wed, 29 May 2024 09:41:51 +0000 (12:41 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 29 May 2024 09:45:02 +0000 (12:45 +0300)
Allow AP's behavior for BSS Max Idle Period management to be configured.
Previously, this was automatically enabled for all CONFIG_WNM_AP=y
builds. This can now be changed with the new hostapd configuration
parameter bss_max_idle:
0 = BSS Max Idle Period management disabled
1 = BSS Max Idle Period management enabled
    (default and the previous behavior)
2 = BSS Max Idle Period management enabled with requirement for
    protected keep-alive frames

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
hostapd/config_file.c
hostapd/hostapd.conf
src/ap/ap_config.c
src/ap/ap_config.h
src/ap/ieee802_11_shared.c

index c83e71e069a72800c0b8c28f0db8e3e82c85a9f1..5999f40dd8c377426bb2360e8b5da41b72964285 100644 (file)
@@ -2549,6 +2549,15 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                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, "bss_max_idle") == 0) {
+               int val = atoi(pos);
+
+               if (val < 0 || val > 2) {
+                       wpa_printf(MSG_ERROR,
+                                  "Line %d: Invalid bss_max_idle value", line);
+                       return 1;
+               }
+               bss->bss_max_idle = val;
        } else if (os_strcmp(buf, "config_id") == 0) {
                os_free(bss->config_id);
                bss->config_id = os_strdup(pos);
index efae334dcedb5681c16e58809e555163da8309f4..c6d279c2f36dcf7a0e80a7c99fb71fa94931d134 100644 (file)
@@ -522,6 +522,13 @@ wmm_ac_vo_acm=0
 # 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
+#
+# BSS max idle period management
+# 0 = disabled (do not advertise and manage BSS max idle period)
+# 1 = enabled (advertise and manage BSS max idle period; default)
+# 2 = enabled requiring protected frames (advertise and manage BSS max idle
+#     period and require STAs to use protected keep-alive frames)
+#bss_max_idle=1
 
 # Disassociate stations based on excessive transmission failures or other
 # indications of connection loss. This depends on the driver capabilities and
index e1910d42239b6d1ef808f0967b2ee745628c6a92..32b04ab353c4174b715896f7c9d2ebf5a534eb23 100644 (file)
@@ -92,6 +92,7 @@ void hostapd_config_defaults_bss(struct hostapd_bss_config *bss)
        bss->eap_sim_id = 3;
        bss->eap_sim_aka_fast_reauth_limit = 1000;
        bss->ap_max_inactivity = AP_MAX_INACTIVITY;
+       bss->bss_max_idle = 1;
        bss->eapol_version = EAPOL_VERSION;
 
        bss->max_listen_interval = 65535;
index 49a2cea166342b085abe5ea583b7283da38ba60d..7fd638ea135255a177e120442430fd42d80b6145 100644 (file)
@@ -465,6 +465,7 @@ struct hostapd_bss_config {
                                 */
 
        int ap_max_inactivity;
+       int bss_max_idle;
        int ignore_broadcast_ssid;
        int no_probe_resp_if_max_sta;
 
index d02f4515abc7516a49fc2b605f99e49097e1a5f7..b98b3ecc740bbe36842467cbf4187e17dbd9a0a0 100644 (file)
@@ -742,7 +742,8 @@ u8 * hostapd_eid_bss_max_idle_period(struct hostapd_data *hapd, u8 *eid)
        u8 *pos = eid;
 
 #ifdef CONFIG_WNM_AP
-       if (hapd->conf->ap_max_inactivity > 0) {
+       if (hapd->conf->ap_max_inactivity > 0 &&
+           hapd->conf->bss_max_idle) {
                unsigned int val;
                *pos++ = WLAN_EID_BSS_MAX_IDLE_PERIOD;
                *pos++ = 3;
@@ -757,7 +758,9 @@ u8 * hostapd_eid_bss_max_idle_period(struct hostapd_data *hapd, u8 *eid)
                        val = 65535;
                WPA_PUT_LE16(pos, val);
                pos += 2;
-               *pos++ = 0x00; /* TODO: Protected Keep-Alive Required */
+               /* Set the Protected Keep-Alive Required bit based on
+                * configuration */
+               *pos++ = hapd->conf->bss_max_idle == 2 ? BIT(0) : 0x00;
        }
 #endif /* CONFIG_WNM_AP */