]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: SAE and inactivity timeout
authorJouni Malinen <jouni.malinen@oss.qualcomm.com>
Tue, 23 Sep 2025 06:51:17 +0000 (09:51 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 23 Sep 2025 06:52:21 +0000 (09:52 +0300)
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 <jouni.malinen@oss.qualcomm.com>
src/ap/sta_info.c
tests/hwsim/test_sae.py

index 6167957a5e0edf44167008f5b3e967e84240b62a..e594696ae9eb91598c0dad5d301ef5aefbce9d54 100644 (file)
@@ -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",
index d76ed363f768513cfb267ce03c4d42f4c42ae694..4175fe373f78e46ad90087a09001d1eb75cc4cbe 100644 (file)
@@ -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()