From f0b7218f7a92c942dab019735fe65aeeb8c9913b Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 12 Apr 2014 19:27:57 +0300 Subject: [PATCH] tests: Association timeout Signed-off-by: Jouni Malinen --- tests/hwsim/test_ap_open.py | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/tests/hwsim/test_ap_open.py b/tests/hwsim/test_ap_open.py index c9232d143..46a474a5c 100644 --- a/tests/hwsim/test_ap_open.py +++ b/tests/hwsim/test_ap_open.py @@ -4,6 +4,10 @@ # This software may be distributed under the terms of the BSD license. # See README for more details. +import logging +logger = logging.getLogger() +import struct + import hostapd import hwsim_utils @@ -61,3 +65,45 @@ def test_ap_open_reconnect_on_inactivity_disconnect(dev, apdev): ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED"], timeout=2) if ev is None: raise Exception("Timeout on reconnection") + +def test_ap_open_assoc_timeout(dev, apdev): + """AP timing out association""" + ssid = "test" + hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": "open" }) + dev[0].scan(freq="2412") + hapd.set("ext_mgmt_frame_handling", "1") + dev[0].connect("open", key_mgmt="NONE", scan_freq="2412", + wait_connect=False) + for i in range(0, 10): + req = hapd.mgmt_rx() + if req is None: + raise Exception("MGMT RX wait timed out") + if req['subtype'] == 11: + break + req = None + if not req: + raise Exception("Authentication frame not received") + + resp = {} + resp['fc'] = req['fc'] + resp['da'] = req['sa'] + resp['sa'] = req['da'] + resp['bssid'] = req['bssid'] + resp['payload'] = struct.pack('