From 98c71cf6b5e42df8b3e8e4c625a0e4ad32e5d799 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 5 Jun 2015 15:32:08 +0300 Subject: [PATCH] tests: Control interface behavior on scan SSID parameter Signed-off-by: Jouni Malinen --- tests/hwsim/test_scan.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/hwsim/test_scan.py b/tests/hwsim/test_scan.py index 914eb41a2..e05aebc6a 100644 --- a/tests/hwsim/test_scan.py +++ b/tests/hwsim/test_scan.py @@ -777,3 +777,27 @@ def test_scan_trigger_failure(dev, apdev): if dev[0].get_status_field('wpa_state') != "COMPLETED": raise Exception("wpa_state COMPLETED not restored") dev[0].request("SET test_failure 0") + +def test_scan_specify_ssid(dev, apdev): + """Control interface behavior on scan SSID parameter""" + dev[0].flush_scan_cache() + hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": "test-hidden", + "ignore_broadcast_ssid": "1" }) + bssid = apdev[0]['bssid'] + check_scan(dev[0], "freq=2412 use_id=1 ssid 414243") + bss = dev[0].get_bss(bssid) + if bss is not None and bss['ssid'] == 'test-hidden': + raise Exception("BSS entry for hidden AP present unexpectedly") + check_scan(dev[0], "freq=2412 ssid 414243 ssid 746573742d68696464656e ssid 616263313233 use_id=1") + bss = dev[0].get_bss(bssid) + if bss is None: + raise Exception("BSS entry for hidden AP not found") + if 'test-hidden' not in dev[0].request("SCAN_RESULTS"): + raise Exception("Expected SSID not included in the scan results"); + + hapd.disable() + dev[0].flush_scan_cache(freq=2432) + dev[0].flush_scan_cache() + + if "FAIL" not in dev[0].request("SCAN ssid foo"): + raise Exception("Invalid SCAN command accepted")