]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: disable_sgi with VHT
authorJouni Malinen <j@w1.fi>
Sun, 6 Jan 2019 18:51:32 +0000 (20:51 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 6 Jan 2019 18:59:36 +0000 (20:59 +0200)
Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_ap_vht.py
tests/hwsim/utils.py

index 2cd1f995b169ee0f3a1eeae919f16bf81d9d667b..1e15839764e45295e7f16a998e11400d7b8a6ee4 100644 (file)
@@ -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)"""
index b5c5441de5f3e5ad7568d4e1ad955c347c83a550..b19bd4e29df201816879f0e61e8e3f119b51d80d 100644 (file)
@@ -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()