diff --git a/tests/hwsim/test_ap_acs.py b/tests/hwsim/test_ap_acs.py index fe88d0171..866fd725c 100644 --- a/tests/hwsim/test_ap_acs.py +++ b/tests/hwsim/test_ap_acs.py @@ -515,3 +515,39 @@ def test_ap_acs_vht160_dfs(dev, apdev, params): hostapd.cmd_execute(apdev[0], ['iw', 'reg', 'set', '00']) dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5) dev[0].flush_scan_cache() + +def test_ap_acs_hw_mode_any(dev, apdev): + """Automatic channel selection with hw_mode=any""" + force_prev_ap_on_24g(apdev[0]) + params = hostapd.wpa2_params(ssid="test-acs", passphrase="12345678") + params['channel'] = '0' + params['hw_mode'] = 'any' + hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False) + wait_acs(hapd) + + freq = hapd.get_status_field("freq") + if int(freq) < 2400: + raise Exception("Unexpected frequency") + + dev[0].connect("test-acs", psk="12345678", scan_freq=freq) + +def test_ap_acs_hw_mode_any_5ghz(dev, apdev): + """Automatic channel selection with hw_mode=any and 5 GHz""" + try: + hapd = None + force_prev_ap_on_5g(apdev[0]) + params = hostapd.wpa2_params(ssid="test-acs", passphrase="12345678") + params['hw_mode'] = 'any' + params['channel'] = '0' + params['country_code'] = 'US' + params['acs_chan_bias'] = '36:0.7 40:0.7 44:0.7 48:0.7' + hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False) + wait_acs(hapd) + freq = hapd.get_status_field("freq") + if int(freq) < 5000: + raise Exception("Unexpected frequency") + + dev[0].connect("test-acs", psk="12345678", scan_freq=freq) + dev[0].wait_regdom(country_ie=True) + finally: + clear_regdom(hapd, dev)