From 58bd7dc341ca6f4d91c8786f90c8442348300b29 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 13 Dec 2016 16:45:51 +0200 Subject: [PATCH] tests: Scan and both Beacon and Probe Response frame IEs Signed-off-by: Jouni Malinen --- tests/hwsim/test_scan.py | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/tests/hwsim/test_scan.py b/tests/hwsim/test_scan.py index 9e823c378..9d2e59877 100644 --- a/tests/hwsim/test_scan.py +++ b/tests/hwsim/test_scan.py @@ -13,7 +13,7 @@ import subprocess import hostapd from wpasupplicant import WpaSupplicant -from utils import HwsimSkip, fail_test, alloc_fail, wait_fail_trigger +from utils import HwsimSkip, fail_test, alloc_fail, wait_fail_trigger, parse_ie from tshark import run_tshark from test_ap_csa import switch_channel, wait_channel_switch, csa_supported @@ -1284,3 +1284,35 @@ def test_scan_flush(dev, apdev): raise Exception("Scan did not complete") if "CTRL-EVENT-BSS-ADDED" in ev: raise Exception("Unexpected BSS entry addition after FLUSH") + +def test_scan_ies(dev, apdev): + """Scan and both Beacon and Probe Response frame IEs""" + dev[0].flush_scan_cache() + hapd = hostapd.add_ap(apdev[0], { "ssid": "test-scan", + "beacon_int": "20" }) + bssid = hapd.own_addr() + dev[0].dump_monitor() + + for i in range(10): + dev[0].request("SCAN TYPE=ONLY freq=2412 passive=1") + ev = dev[0].wait_event(["CTRL-EVENT-SCAN-RESULTS"], timeout=15) + if ev is None: + raise Exception("Scan did not complete") + if dev[0].get_bss(bssid): + break + + for i in range(10): + dev[0].scan_for_bss(bssid, freq=2412, force_scan=True) + bss = dev[0].get_bss(bssid) + if 'beacon_ie' in bss: + if bss['ie'] != bss['beacon_ie']: + break + + if not bss or 'beacon_ie' not in bss: + raise Exception("beacon_ie not present") + ie = parse_ie(bss['ie']) + logger.info("ie: " + str(ie.keys())) + beacon_ie = parse_ie(bss['beacon_ie']) + logger.info("beacon_ie: " + str(ie.keys())) + if bss['ie'] == bss['beacon_ie']: + raise Exception("Both ie and beacon_ie show same data")