From 2e71d0415bf37cf829ff438d85b6ce602ba670ce Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 6 Jan 2019 20:51:32 +0200 Subject: [PATCH] tests: disable_sgi with VHT Signed-off-by: Jouni Malinen --- tests/hwsim/test_ap_vht.py | 20 ++++++++++++-------- tests/hwsim/utils.py | 10 ++++++---- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/tests/hwsim/test_ap_vht.py b/tests/hwsim/test_ap_vht.py index 2cd1f995b..1e1583976 100644 --- a/tests/hwsim/test_ap_vht.py +++ b/tests/hwsim/test_ap_vht.py @@ -12,7 +12,7 @@ import subprocess, time import hwsim_utils import hostapd -from utils import HwsimSkip +from utils import * from test_dfs import wait_dfs_event from test_ap_csa import csa_supported from test_ap_ht import clear_scan_cache @@ -148,6 +148,8 @@ def test_ap_vht80_params(dev, apdev): dev[1].connect("vht", key_mgmt="NONE", scan_freq="5180", disable_vht="1", wait_connect=False) dev[0].connect("vht", key_mgmt="NONE", scan_freq="5180") + dev[2].connect("vht", key_mgmt="NONE", scan_freq="5180", + disable_sgi="1") ev = dev[1].wait_event(["CTRL-EVENT-ASSOC-REJECT"]) if ev is None: raise Exception("Association rejection timed out") @@ -155,19 +157,21 @@ def test_ap_vht80_params(dev, apdev): raise Exception("Unexpected rejection status code") dev[1].request("DISCONNECT") hwsim_utils.test_connectivity(dev[0], hapd) + sta0 = hapd.get_sta(dev[0].own_addr()) + sta2 = hapd.get_sta(dev[2].own_addr()) + capab0 = int(sta0['vht_caps_info'], base=16) + capab2 = int(sta2['vht_caps_info'], base=16) + if capab0 & 0x60 == 0: + raise Exception("dev[0] did not support SGI") + if capab2 & 0x60 != 0: + raise Exception("dev[2] claimed support for SGI") except Exception, e: if isinstance(e, Exception) and str(e) == "AP startup failed": if not vht_supported(): raise HwsimSkip("80 MHz channel not supported in regulatory information") raise finally: - dev[0].request("DISCONNECT") - dev[1].request("DISCONNECT") - if hapd: - hapd.request("DISABLE") - subprocess.call(['iw', 'reg', 'set', '00']) - dev[0].flush_scan_cache() - dev[1].flush_scan_cache() + clear_regdom(hapd, dev, count=3) def test_ap_vht80_invalid(dev, apdev): """VHT with invalid 80 MHz channel configuration (seg1)""" diff --git a/tests/hwsim/utils.py b/tests/hwsim/utils.py index b5c5441de..b19bd4e29 100644 --- a/tests/hwsim/utils.py +++ b/tests/hwsim/utils.py @@ -146,12 +146,13 @@ def clear_country(dev): dev[0].dump_monitor() dev[1].dump_monitor() -def clear_regdom(hapd, dev): +def clear_regdom(hapd, dev, count=1): if hapd: hapd.request("DISABLE") time.sleep(0.1) - dev[0].request("DISCONNECT") - dev[0].request("ABORT_SCAN") + for i in range(count): + dev[i].request("DISCONNECT") + dev[i].request("ABORT_SCAN") dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5) subprocess.call(['iw', 'reg', 'set', '00']) wait_regdom_changes(dev[0]) @@ -159,4 +160,5 @@ def clear_regdom(hapd, dev): logger.info("Country code at the end: " + country) if country != "00": clear_country(dev) - dev[0].flush_scan_cache() + for i in range(count): + dev[i].flush_scan_cache()