]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Verify behavior on unexpected association event
authorJouni Malinen <j@w1.fi>
Sat, 7 Jun 2014 10:35:03 +0000 (13:35 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 7 Jun 2014 10:35:03 +0000 (13:35 +0300)
This verifies association event processing in case the association was
not requested by wpa_supplicant.

Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_ap_open.py

index e3ae32f4201c32d46cf4383a9816cdab64aea5a3..e31010fc3133a999e86bcd52692f6a16aa0a5bad 100644 (file)
@@ -7,6 +7,8 @@
 import logging
 logger = logging.getLogger()
 import struct
+import subprocess
+import time
 
 import hostapd
 import hwsim_utils
@@ -137,3 +139,28 @@ def test_ap_open_select_any(dev, apdev):
     ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED"])
     if ev is None:
         raise Exception("Association with the AP timed out")
+
+def test_ap_open_unexpected_assoc_event(dev, apdev):
+    """AP with open mode and unexpected association event"""
+    hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": "open" })
+    dev[0].connect("open", key_mgmt="NONE", scan_freq="2412")
+    dev[0].request("DISCONNECT")
+    time.sleep(0.1)
+    dev[0].dump_monitor()
+    # This will be accepted due to matching network
+    subprocess.call(['sudo', 'iw', 'dev', dev[0].ifname, 'connect', 'open',
+                     "2412", apdev[0]['bssid']])
+    ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED"], timeout=15)
+    if ev is None:
+        raise Exception("Association with the AP timed out")
+    dev[0].dump_monitor()
+
+    dev[0].request("REMOVE_NETWORK all")
+    time.sleep(0.1)
+    dev[0].dump_monitor()
+    # This will result in disconnection due to no matching network
+    subprocess.call(['sudo', 'iw', 'dev', dev[0].ifname, 'connect', 'open',
+                     "2412", apdev[0]['bssid']])
+    ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=15)
+    if ev is None:
+        raise Exception("Disconnection with the AP timed out")