diff --git a/tests/hwsim/test_dfs.py b/tests/hwsim/test_dfs.py index 592736e3a..1c90bcdb2 100644 --- a/tests/hwsim/test_dfs.py +++ b/tests/hwsim/test_dfs.py @@ -26,7 +26,8 @@ def wait_dfs_event(hapd, event, timeout): return ev def start_dfs_ap(ap, allow_failure=False, ssid="dfs", ht=True, ht40=False, - ht40minus=False, vht80=False, vht20=False, chanlist=None): + ht40minus=False, vht80=False, vht20=False, chanlist=None, + channel=None): ifname = ap['ifname'] logger.info("Starting AP " + ifname + " on DFS channel") hapd_global = hostapd.HostapdGlobal() @@ -59,6 +60,8 @@ def start_dfs_ap(ap, allow_failure=False, ssid="dfs", ht=True, ht40=False, hapd.set("vht_oper_centr_freq_seg0_idx", "0") if chanlist: hapd.set("chanlist", chanlist) + if channel: + hapd.set("channel", str(channel)) hapd.enable() ev = wait_dfs_event(hapd, "DFS-CAC-START", 5) @@ -400,3 +403,39 @@ def test_dfs_radar_ht40minus(dev, apdev): hapd.request("DISABLE") subprocess.call(['iw', 'reg', 'set', '00']) dev[0].flush_scan_cache() + +def test_dfs_ht40_minus(dev, apdev, params): + """DFS CAC functionality on channel 104 HT40- [long]""" + if not params['long']: + raise HwsimSkip("Skip test case with long duration due to --long not specified") + try: + hapd = None + hapd = start_dfs_ap(apdev[0], allow_failure=True, ht40minus=True, + channel=104) + + ev = wait_dfs_event(hapd, "DFS-CAC-COMPLETED", 70) + if "success=1" not in ev: + raise Exception("CAC failed") + if "freq=5520" not in ev: + raise Exception("Unexpected DFS freq result") + + ev = hapd.wait_event(["AP-ENABLED"], timeout=5) + if not ev: + raise Exception("AP setup timed out") + + state = hapd.get_status_field("state") + if state != "ENABLED": + raise Exception("Unexpected interface state") + + freq = hapd.get_status_field("freq") + if freq != "5520": + raise Exception("Unexpected frequency") + + dev[0].connect("dfs", key_mgmt="NONE", scan_freq="5520") + hwsim_utils.test_connectivity(dev[0], hapd) + finally: + dev[0].request("DISCONNECT") + if hapd: + hapd.request("DISABLE") + subprocess.call(['iw', 'reg', 'set', '00']) + dev[0].flush_scan_cache() diff --git a/tests/hwsim/vm/parallel-vm.py b/tests/hwsim/vm/parallel-vm.py index 0f175b184..40bbb7609 100755 --- a/tests/hwsim/vm/parallel-vm.py +++ b/tests/hwsim/vm/parallel-vm.py @@ -50,6 +50,7 @@ long_tests = [ "ap_roam_open", "ap_vht160", "dfs_radar", "dfs", + "dfs_ht40_minus", "grpform_cred_ready_timeout", "hostapd_oom_wpa2_eap_connect", "wpas_ap_dfs",