]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: WPS PBC triggered based on hostapd event
authorJouni Malinen <j@w1.fi>
Sun, 12 Oct 2014 14:58:04 +0000 (17:58 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 12 Oct 2014 14:58:04 +0000 (17:58 +0300)
Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_ap_wps.py

index a9dfc7e2cff6395cdb9f5aa1e0e8f265598f12c5..afe75e08a227541d56a57ab5073e09b7a42bb1e9 100644 (file)
@@ -2181,3 +2181,26 @@ def test_ap_wps_while_connected_no_autoconnect(dev, apdev):
             raise Exception("Unexpected BSSID")
     finally:
         dev[0].request("STA_AUTOCONNECT 1")
+
+def test_ap_wps_from_event(dev, apdev):
+    """WPS PBC event on AP to enable PBC"""
+    ssid = "test-wps-conf"
+    hapd = hostapd.add_ap(apdev[0]['ifname'],
+                          { "ssid": ssid, "eap_server": "1", "wps_state": "2",
+                            "wpa_passphrase": "12345678", "wpa": "2",
+                            "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
+    dev[0].dump_monitor()
+    dev[0].request("WPS_PBC")
+
+    ev = hapd.wait_event(['WPS-ENROLLEE-SEEN'], timeout=15)
+    if ev is None:
+        raise Exception("No WPS-ENROLLEE-SEEN event on AP")
+    vals = ev.split(' ')
+    if vals[1] != dev[0].p2p_interface_addr():
+        raise Exception("Unexpected enrollee address: " + vals[1])
+    if vals[5] != '4':
+        raise Exception("Unexpected Device Password Id: " + vals[5])
+    hapd.request("WPS_PBC")
+    ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED"], timeout=30)
+    if ev is None:
+        raise Exception("Association with the AP timed out")