]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: AP with open mode and external association
authorJouni Malinen <jouni@qca.qualcomm.com>
Mon, 5 Dec 2016 09:48:07 +0000 (11:48 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 5 Dec 2016 10:16:12 +0000 (12:16 +0200)
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
tests/hwsim/test_ap_open.py

index 01cd5f87a9f4bf1432448614c468ae659d0b498e..bbe78674049ccbb2cb5b896d095fb8851580a963 100644 (file)
@@ -181,6 +181,30 @@ def test_ap_open_unexpected_assoc_event(dev, apdev):
                         apdev[0]['bssid']])
     dev[0].wait_disconnected(timeout=15)
 
+def test_ap_open_external_assoc(dev, apdev):
+    """AP with open mode and external association"""
+    hapd = hostapd.add_ap(apdev[0], { "ssid": "open-ext-assoc" })
+    try:
+        dev[0].request("STA_AUTOCONNECT 0")
+        id = dev[0].connect("open-ext-assoc", key_mgmt="NONE", scan_freq="2412",
+                            only_add_network=True)
+        dev[0].request("ENABLE_NETWORK %s no-connect" % id)
+        dev[0].dump_monitor()
+        # This will be accepted due to matching network
+        dev[0].cmd_execute(['iw', 'dev', dev[0].ifname, 'connect',
+                            'open-ext-assoc', "2412", apdev[0]['bssid']])
+        ev = dev[0].wait_event([ "CTRL-EVENT-DISCONNECTED",
+                                 "CTRL-EVENT-CONNECTED" ], timeout=10)
+        if ev is None:
+            raise Exception("Connection timed out")
+        if "CTRL-EVENT-DISCONNECTED" in ev:
+            raise Exception("Unexpected disconnection event")
+        dev[0].dump_monitor()
+        dev[0].request("DISCONNECT")
+        dev[0].wait_disconnected(timeout=5)
+    finally:
+        dev[0].request("STA_AUTOCONNECT 1")
+
 @remote_compatible
 def test_ap_bss_load(dev, apdev):
     """AP with open mode (no security) configuration"""