tests: WNM BSS max idle period management

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
Jouni Malinen 2024-05-29 21:43:26 +03:00 committed by Jouni Malinen
parent 2c89b56d64
commit e4e91f5320
2 changed files with 33 additions and 1 deletions

View file

@ -39,7 +39,8 @@ def start_wnm_ap(apdev, bss_transition=True, time_adv=False, ssid=None,
hw_mode=None, channel=None, country_code=None, country3=None, hw_mode=None, channel=None, country_code=None, country3=None,
pmf=True, passphrase=None, ht=True, vht=False, mbo=False, pmf=True, passphrase=None, ht=True, vht=False, mbo=False,
beacon_prot=False, he=False, bss_max_idle=None, beacon_prot=False, he=False, bss_max_idle=None,
wpa_group_rekey=None, no_disconnect_on_group_keyerror=False): wpa_group_rekey=None, no_disconnect_on_group_keyerror=False,
max_acceptable_idle_period=None):
if rsn: if rsn:
if not ssid: if not ssid:
ssid = "test-wnm-rsn" ssid = "test-wnm-rsn"
@ -94,6 +95,8 @@ def start_wnm_ap(apdev, bss_transition=True, time_adv=False, ssid=None,
params["wpa_group_rekey"] = str(wpa_group_rekey) params["wpa_group_rekey"] = str(wpa_group_rekey)
if no_disconnect_on_group_keyerror: if no_disconnect_on_group_keyerror:
params["no_disconnect_on_group_keyerror"] = "1" params["no_disconnect_on_group_keyerror"] = "1"
if max_acceptable_idle_period is not None:
params["max_acceptable_idle_period"] = str(max_acceptable_idle_period)
try: try:
hapd = hostapd.add_ap(apdev, params) hapd = hostapd.add_ap(apdev, params)
except Exception as e: except Exception as e:
@ -823,6 +826,34 @@ def run_wnm_bss_keep_alive(dev, apdev, protected):
if int(sta['tx_packets']) <= int(end['tx_packets']): if int(sta['tx_packets']) <= int(end['tx_packets']):
raise Exception("No client poll packet seen") raise Exception("No client poll packet seen")
def test_wnm_bss_max_idle_period_management(dev, apdev):
"""WNM BSS max idle period management"""
hapd = start_wnm_ap(apdev[0], bss_transition=False, ap_max_inactivity=10,
max_acceptable_idle_period=1000, rsn=True)
addr = dev[0].own_addr()
dev[0].connect("test-wnm-rsn", psk="12345678", ieee80211w="2",
key_mgmt="WPA-PSK-SHA256", proto="WPA2", scan_freq="2412",
max_idle="1500")
addr1 = dev[1].own_addr()
dev[1].connect("test-wnm-rsn", psk="12345678", ieee80211w="2",
key_mgmt="WPA-PSK-SHA256", proto="WPA2", scan_freq="2412")
ap_val = hapd.get_sta(addr)['max_idle_period']
if ap_val != '1000':
raise Exception("AP reported unexpected value: " + ap_val)
sta_val = dev[0].get_status_field("bss_max_idle_period")
if sta_val != '1000':
raise Exception("STA reported unexpected value: " + sta_val)
sta = hapd.get_sta(addr1)
if 'max_idle_period' in sta:
raise Exception("AP reported unexpected value(2): " + sta['max_idle_period'])
sta_val = dev[1].get_status_field("bss_max_idle_period")
if sta_val != '9':
raise Exception("STA reported unexpected value(2): " + sta_val)
def test_wnm_bss_group_rekey(dev, apdev): def test_wnm_bss_group_rekey(dev, apdev):
"""WNM BSS max idle period and group rekey""" """WNM BSS max idle period and group rekey"""
hapd = start_wnm_ap(apdev[0], bss_transition=False, ap_max_inactivity=100, hapd = start_wnm_ap(apdev[0], bss_transition=False, ap_max_inactivity=100,

View file

@ -1115,6 +1115,7 @@ class WpaSupplicant:
"ft_eap_pmksa_caching", "beacon_prot", "ft_eap_pmksa_caching", "beacon_prot",
"mac_value", "mac_value",
"wpa_deny_ptk0_rekey", "wpa_deny_ptk0_rekey",
"max_idle",
"enable_4addr_mode"] "enable_4addr_mode"]
for field in not_quoted: for field in not_quoted:
if field in kwargs and kwargs[field]: if field in kwargs and kwargs[field]: