WNM: Allow a specific BSS max idle period to be requested

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>
This commit is contained in:
Jouni Malinen 2024-05-29 19:40:27 +03:00 committed by Jouni Malinen
parent 829ab90d27
commit 6594ea9ef1
6 changed files with 38 additions and 0 deletions

View file

@ -2754,6 +2754,7 @@ static const struct parse_data ssid_fields[] = {
{ INT_RANGE(sae_pk, 0, 2) }, { INT_RANGE(sae_pk, 0, 2) },
{ INT_RANGE(disable_eht, 0, 1)}, { INT_RANGE(disable_eht, 0, 1)},
{ INT_RANGE(enable_4addr_mode, 0, 1)}, { INT_RANGE(enable_4addr_mode, 0, 1)},
{ INT_RANGE(max_idle, 0, 65535)},
}; };
#undef OFFSET #undef OFFSET

View file

@ -893,6 +893,7 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid)
#endif /* CONFIG_HE_OVERRIDES */ #endif /* CONFIG_HE_OVERRIDES */
INT(disable_eht); INT(disable_eht);
INT(enable_4addr_mode); INT(enable_4addr_mode);
INT(max_idle);
#undef STR #undef STR
#undef INT #undef INT

View file

@ -1270,6 +1270,14 @@ struct wpa_ssid {
* to use the interface in a bridge. * to use the interface in a bridge.
*/ */
int enable_4addr_mode; 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 */ #endif /* CONFIG_SSID_H */

View file

@ -893,6 +893,18 @@ static void sme_send_authentication(struct wpa_supplicant *wpa_s,
os_memcpy(pos, ext_capab, ext_capab_len); 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 #ifdef CONFIG_TESTING_OPTIONS
if (wpa_s->rsnxe_override_assoc && if (wpa_s->rsnxe_override_assoc &&
wpabuf_len(wpa_s->rsnxe_override_assoc) <= wpabuf_len(wpa_s->rsnxe_override_assoc) <=

View 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 #ifdef CONFIG_HS20
if (is_hs20_network(wpa_s, ssid, bss)) { if (is_hs20_network(wpa_s, ssid, bss)) {
struct wpabuf *hs20; struct wpabuf *hs20;

View file

@ -1757,6 +1757,11 @@ fast_reauth=1
# In STA mode it defines the EDMG channel for connection (if supported by AP). # In STA mode it defines the EDMG channel for connection (if supported by AP).
#edmg_channel=9 #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: # Example blocks:
# Simple case: WPA-PSK, PSK as an ASCII passphrase, allow all valid ciphers # Simple case: WPA-PSK, PSK as an ASCII passphrase, allow all valid ciphers