]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WNM: Allow a specific BSS max idle period to be requested
authorJouni Malinen <quic_jouni@quicinc.com>
Wed, 29 May 2024 16:40:27 +0000 (19:40 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 29 May 2024 19:12:48 +0000 (22:12 +0300)
Add a new wpa_supplicant network profile parameter max_idle that can be
used to specify a specific maximum idle period in units of 1000 TUs
(1.024 s) for associations.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
wpa_supplicant/config.c
wpa_supplicant/config_file.c
wpa_supplicant/config_ssid.h
wpa_supplicant/sme.c
wpa_supplicant/wpa_supplicant.c
wpa_supplicant/wpa_supplicant.conf

index 2c756136c358b0dd586a257777971c9fa8cd081c..858c9b312e7715d3f2d9ce648a4342274bafb8fb 100644 (file)
@@ -2754,6 +2754,7 @@ static const struct parse_data ssid_fields[] = {
        { INT_RANGE(sae_pk, 0, 2) },
        { INT_RANGE(disable_eht, 0, 1)},
        { INT_RANGE(enable_4addr_mode, 0, 1)},
+       { INT_RANGE(max_idle, 0, 65535)},
 };
 
 #undef OFFSET
index 1a2c0c9bef8a67f0b7c73f7d401e086d6b5a274a..6dffcaf77112817c62e9996a144589265d81aa7b 100644 (file)
@@ -893,6 +893,7 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid)
 #endif /* CONFIG_HE_OVERRIDES */
        INT(disable_eht);
        INT(enable_4addr_mode);
+       INT(max_idle);
 
 #undef STR
 #undef INT
index e40650c273ebff36d1220ff37e5c4e87150f5de6..74f7fed8946644196e185771c67ef171fd6e5c91 100644 (file)
@@ -1270,6 +1270,14 @@ struct wpa_ssid {
         * to use the interface in a bridge.
         */
        int enable_4addr_mode;
+
+       /**
+        * max_idle - BSS max idle period to request
+        *
+        * If nonzero, request the specified number of 1000 TU (i.e., 1.024 s)
+        * as the maximum idle period for the STA during association.
+        */
+       int max_idle;
 };
 
 #endif /* CONFIG_SSID_H */
index f6860783e73158cd464d22b5641b1e18a3ae1d39..a6f51a5f0220378192dc15eac1b3e3a727fa42a1 100644 (file)
@@ -893,6 +893,18 @@ static void sme_send_authentication(struct wpa_supplicant *wpa_s,
                os_memcpy(pos, ext_capab, ext_capab_len);
        }
 
+       if (ssid->max_idle && wpa_s->sme.assoc_req_ie_len + 5 <=
+           sizeof(wpa_s->sme.assoc_req_ie)) {
+               u8 *pos = wpa_s->sme.assoc_req_ie + wpa_s->sme.assoc_req_ie_len;
+
+               *pos++ = WLAN_EID_BSS_MAX_IDLE_PERIOD;
+               *pos++ = 3;
+               WPA_PUT_LE16(pos, ssid->max_idle);
+               pos += 2;
+               *pos = 0; /* Idle Options */
+               wpa_s->sme.assoc_req_ie_len += 5;
+       }
+
 #ifdef CONFIG_TESTING_OPTIONS
        if (wpa_s->rsnxe_override_assoc &&
            wpabuf_len(wpa_s->rsnxe_override_assoc) <=
index 25a844c5815d2cd6ecbd0030155dc71d2db8670f..5bca64e541748dea9bb85c7163f014a6a5126b07 100644 (file)
@@ -3576,6 +3576,17 @@ static u8 * wpas_populate_assoc_ies(
                }
        }
 
+       if (ssid->max_idle && wpa_ie_len + 5 <= max_wpa_ie_len) {
+               u8 *pos = wpa_ie;
+
+               *pos++ = WLAN_EID_BSS_MAX_IDLE_PERIOD;
+               *pos++ = 3;
+               WPA_PUT_LE16(pos, ssid->max_idle);
+               pos += 2;
+               *pos = 0; /* Idle Options */
+               wpa_ie_len += 5;
+       }
+
 #ifdef CONFIG_HS20
        if (is_hs20_network(wpa_s, ssid, bss)) {
                struct wpabuf *hs20;
index 2e36845f13d614fb2f06b6b643de05ebc919978e..b08f5417ad88a7788bd51328c03562ceb42a2bc7 100644 (file)
@@ -1757,6 +1757,11 @@ fast_reauth=1
 # In STA mode it defines the EDMG channel for connection (if supported by AP).
 #edmg_channel=9
 
+# BSS max idle period to request
+# If nonzero, request the specified number of 1000 TU (i.e., 1.024 s)
+# as the maximum idle period for the STA during association.
+#max_idle=600
+
 # Example blocks:
 
 # Simple case: WPA-PSK, PSK as an ASCII passphrase, allow all valid ciphers