]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: WPS PBC/PIN timeout on AP
authorJouni Malinen <jouni@codeaurora.org>
Wed, 4 Mar 2020 21:28:45 +0000 (23:28 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 4 Mar 2020 21:28:45 +0000 (23:28 +0200)
Verify that AuthorizedMACs advertisement is removed when a PBC session
or a PIN times out.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
tests/hwsim/test_ap_wps.py
tests/hwsim/vm/parallel-vm.py

index 234531c5db5ae0e6b905f86ce40990ab426d288b..b4dacf280620d8010aa09b37a8e53d63fec23cd0 100644 (file)
@@ -10397,3 +10397,40 @@ def test_ap_wps_appl_ext(dev, apdev):
     dev[0].scan_for_bss(apdev[0]['bssid'], freq="2412")
     dev[0].request("WPS_PIN %s %s" % (apdev[0]['bssid'], pin))
     dev[0].wait_connected(timeout=30)
+
+def test_ap_wps_pbc_ap_timeout(dev, apdev, params):
+    """WPS PBC timeout on AP [long]"""
+    if not params['long']:
+        raise HwsimSkip("Skip test case with long duration due to --long not specified")
+    run_ap_wps_ap_timeout(dev, apdev, "WPS_PBC")
+
+def test_ap_wps_pin_ap_timeout(dev, apdev, params):
+    """WPS PIN timeout on AP [long]"""
+    if not params['long']:
+        raise HwsimSkip("Skip test case with long duration due to --long not specified")
+    run_ap_wps_ap_timeout(dev, apdev, "WPS_PIN any 12345670 10")
+
+def run_ap_wps_ap_timeout(dev, apdev, cmd):
+    ssid = "test-wps-conf"
+    hapd = hostapd.add_ap(apdev[0],
+                          {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+                           "wpa_passphrase": "12345678", "wpa": "2",
+                           "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
+    bssid = hapd.own_addr()
+    hapd.request(cmd)
+    time.sleep(1)
+    dev[0].scan_for_bss(bssid, freq="2412")
+    bss = dev[0].get_bss(bssid)
+    logger.info("BSS during active Registrar: " + str(bss))
+    if not bss['ie'].endswith("0106ffffffffffff"):
+        raise Exception("Authorized MAC not included")
+    ev = hapd.wait_event(["WPS-TIMEOUT"], timeout=130)
+    if ev is None and "PBC" in cmd:
+        raise Exception("WPS-TIMEOUT not reported")
+    time.sleep(5)
+    dev[0].flush_scan_cache()
+    dev[0].scan_for_bss(bssid, freq="2412", force_scan=True)
+    bss = dev[0].get_bss(bssid)
+    logger.info("BSS after timeout: " + str(bss))
+    if bss['ie'].endswith("0106ffffffffffff"):
+        raise Exception("Authorized MAC not removed")
index 3dd09584f8bcdb91756fbadf1eb542a3e81d329d..c451e8ab6adaf01095cd154aa0985528a04fbb9b 100755 (executable)
@@ -76,6 +76,8 @@ long_tests = ["ap_roam_open",
               "ap_wps_iteration",
               "ap_wps_iteration_error",
               "ap_wps_pbc_timeout",
+              "ap_wps_pbc_ap_timeout",
+              "ap_wps_pin_ap_timeout",
               "ap_wps_http_timeout",
               "p2p_go_move_reg_change",
               "p2p_go_move_active",