From 6ec64f3ec871d38138ffcec4f1ca33af96ae1505 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 12 Jun 2014 22:09:05 +0300 Subject: [PATCH] tests: Truncated GAS query request Signed-off-by: Jouni Malinen --- tests/hwsim/test_gas.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/hwsim/test_gas.py b/tests/hwsim/test_gas.py index fd7104536..7a9b88159 100644 --- a/tests/hwsim/test_gas.py +++ b/tests/hwsim/test_gas.py @@ -728,3 +728,30 @@ def test_gas_no_pending(dev, apdev): status_code = gresp['status_code'] if status_code != 60: raise Exception("Unexpected status code {} (expected 60)".format(status_code)) + +def test_gas_missing_payload(dev, apdev): + """No action code in the query frame""" + bssid = apdev[0]['bssid'] + params = hs20_ap_params() + params['hessid'] = bssid + hostapd.add_ap(apdev[0]['ifname'], params) + + dev[0].scan_for_bss(bssid, freq="2412", force_scan=True) + + cmd = "MGMT_TX {} {} freq=2412 action=040A".format(bssid, bssid) + if "FAIL" in dev[0].request(cmd): + raise Exception("Could not send test Action frame") + ev = dev[0].wait_event(["MGMT-TX-STATUS"], timeout=10) + if ev is None: + raise Exception("Timeout on MGMT-TX-STATUS") + if "result=SUCCESS" not in ev: + raise Exception("AP did not ack Action frame") + + cmd = "MGMT_TX {} {} freq=2412 action=04".format(bssid, bssid) + if "FAIL" in dev[0].request(cmd): + raise Exception("Could not send test Action frame") + ev = dev[0].wait_event(["MGMT-TX-STATUS"], timeout=10) + if ev is None: + raise Exception("Timeout on MGMT-TX-STATUS") + if "result=SUCCESS" not in ev: + raise Exception("AP did not ack Action frame")