From: Jouni Malinen Date: Tue, 23 Sep 2025 06:51:17 +0000 (+0300) Subject: tests: SAE and inactivity timeout X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2735a3f7ff0023cebfd81d16bf383ef4075e41de;p=thirdparty%2Fhostap.git tests: SAE and inactivity timeout Add special testing value skip_inactivity_poll=-1 to be able to test the exact STA inactivity timeout behavior without having to disconnect the STA for that. Use this to verify inactivity timer with SAE and PMF. Signed-off-by: Jouni Malinen --- diff --git a/src/ap/sta_info.c b/src/ap/sta_info.c index 6167957a5..e594696ae 100644 --- a/src/ap/sta_info.c +++ b/src/ap/sta_info.c @@ -601,6 +601,17 @@ void ap_handle_timer(void *eloop_ctx, void *timeout_ctx) sta->timeout_next = STA_DISASSOC; goto skip_poll; } else if (inactive_sec < max_inactivity) { +#ifdef CONFIG_TESTING_OPTIONS + if (hapd->conf->skip_inactivity_poll == -1) { + wpa_msg(hapd->msg_ctx, MSG_DEBUG, + "Force inactivity timeout for station " + MACSTR + " even though it has been active %is ago", + MAC2STR(sta->addr), inactive_sec); + sta->timeout_next = STA_DISASSOC; + goto skip_poll; + } +#endif /* CONFIG_TESTING_OPTIONS */ /* station activity detected; reset timeout state */ wpa_msg(hapd->msg_ctx, MSG_DEBUG, "Station " MACSTR " has been active %is ago", diff --git a/tests/hwsim/test_sae.py b/tests/hwsim/test_sae.py index d76ed363f..4175fe373 100644 --- a/tests/hwsim/test_sae.py +++ b/tests/hwsim/test_sae.py @@ -3674,3 +3674,21 @@ def test_sae_dump_beacon(dev, apdev): # Make sure there is enough time to capture at least one Beacon frame time.sleep(0.2) + +def test_sae_inactivity_timeout(dev, apdev): + """SAE and inactivity timeout""" + check_sae_capab(dev[0]) + params = hostapd.wpa3_params(ssid="test-sae", password="12345678") + params['ap_max_inactivity'] = "3" + params['skip_inactivity_poll'] = "-1" + hapd = hostapd.add_ap(apdev[0], params) + + dev[0].set("sae_groups", "") + dev[0].connect("test-sae", sae_password="12345678", key_mgmt="SAE", + ieee80211w="2", scan_freq="2412") + hapd.wait_sta() + ev = hapd.wait_event(["AP-STA-DISCONNECTED"], timeout=10) + if ev is None: + raise Exception("STA disconnection on inactivity was not reported") + dev[0].wait_disconnected() + dev[0].wait_connected()