From 6849b3de8f73d9ad50df19565828289c7f4e613a Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 26 Mar 2016 18:58:52 +0200 Subject: [PATCH] tests: Invalid VHT 80 and 80+80 MHz configuration (seg0/seg1) Signed-off-by: Jouni Malinen --- tests/hwsim/test_ap_vht.py | 92 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/tests/hwsim/test_ap_vht.py b/tests/hwsim/test_ap_vht.py index 38ecd4ee9..137249cf8 100644 --- a/tests/hwsim/test_ap_vht.py +++ b/tests/hwsim/test_ap_vht.py @@ -145,6 +145,67 @@ def test_ap_vht80_params(dev, apdev): dev[0].flush_scan_cache() dev[1].flush_scan_cache() +def test_ap_vht80_invalid(dev, apdev): + """VHT with invalid 80 MHz channel configuration (seg1)""" + try: + hapd = None + params = { "ssid": "vht", + "country_code": "US", + "hw_mode": "a", + "channel": "36", + "ht_capab": "[HT40+]", + "ieee80211n": "1", + "ieee80211ac": "1", + "vht_oper_chwidth": "1", + "vht_oper_centr_freq_seg0_idx": "42", + "vht_oper_centr_freq_seg1_idx": "155", + 'ieee80211d': '1', + 'ieee80211h': '1' } + hapd = hostapd.add_ap(apdev[0]['ifname'], params, wait_enabled=False) + # This fails due to unexpected seg1 configuration + ev = hapd.wait_event(["AP-DISABLED"], timeout=5) + if ev is None: + raise Exception("AP-DISABLED not reported") + except Exception, e: + if isinstance(e, Exception) and str(e) == "AP startup failed": + if not vht_supported(): + raise HwsimSkip("80/160 MHz channel not supported in regulatory information") + raise + finally: + if hapd: + hapd.request("DISABLE") + subprocess.call(['iw', 'reg', 'set', '00']) + +def test_ap_vht80_invalid2(dev, apdev): + """VHT with invalid 80 MHz channel configuration (seg0)""" + try: + hapd = None + params = { "ssid": "vht", + "country_code": "US", + "hw_mode": "a", + "channel": "36", + "ht_capab": "[HT40+]", + "ieee80211n": "1", + "ieee80211ac": "1", + "vht_oper_chwidth": "1", + "vht_oper_centr_freq_seg0_idx": "46", + 'ieee80211d': '1', + 'ieee80211h': '1' } + hapd = hostapd.add_ap(apdev[0]['ifname'], params, wait_enabled=False) + # This fails due to invalid seg0 configuration + ev = hapd.wait_event(["AP-DISABLED"], timeout=5) + if ev is None: + raise Exception("AP-DISABLED not reported") + except Exception, e: + if isinstance(e, Exception) and str(e) == "AP startup failed": + if not vht_supported(): + raise HwsimSkip("80/160 MHz channel not supported in regulatory information") + raise + finally: + if hapd: + hapd.request("DISABLE") + subprocess.call(['iw', 'reg', 'set', '00']) + def test_ap_vht_20(devs, apdevs): """VHT and 20 MHz channel""" dev = devs[0] @@ -457,6 +518,37 @@ def test_ap_vht80plus80(dev, apdev): dev[0].flush_scan_cache() dev[1].flush_scan_cache() +def test_ap_vht80plus80_invalid(dev, apdev): + """VHT with invalid 80+80 MHz channel""" + try: + hapd = None + params = { "ssid": "vht", + "country_code": "US", + "hw_mode": "a", + "channel": "36", + "ht_capab": "[HT40+]", + "ieee80211n": "1", + "ieee80211ac": "1", + "vht_oper_chwidth": "3", + "vht_oper_centr_freq_seg0_idx": "42", + "vht_oper_centr_freq_seg1_idx": "0", + 'ieee80211d': '1', + 'ieee80211h': '1' } + hapd = hostapd.add_ap(apdev[0]['ifname'], params, wait_enabled=False) + # This fails due to missing(invalid) seg1 configuration + ev = hapd.wait_event(["AP-DISABLED"], timeout=5) + if ev is None: + raise Exception("AP-DISABLED not reported") + except Exception, e: + if isinstance(e, Exception) and str(e) == "AP startup failed": + if not vht_supported(): + raise HwsimSkip("80/160 MHz channel not supported in regulatory information") + raise + finally: + if hapd: + hapd.request("DISABLE") + subprocess.call(['iw', 'reg', 'set', '00']) + def test_ap_vht80_csa(dev, apdev): """VHT with 80 MHz channel width and CSA""" csa_supported(dev[0])