Handle NULL return from os_zalloc() in sta_track_add()
[mech_eap.git] / tests / hwsim / test_ap_vht.py
index 0123e4b..9ecf8d1 100644 (file)
@@ -50,6 +50,18 @@ def test_ap_vht80(dev, apdev):
         est = dev[0].get_bss(bssid)['est_throughput']
         if est != "390001":
             raise Exception("Unexpected BSS est_throughput: " + est)
+        status = hapd.get_status()
+        logger.info("hostapd STATUS: " + str(status))
+        if status["ieee80211n"] != "1":
+            raise Exception("Unexpected STATUS ieee80211n value")
+        if status["ieee80211ac"] != "1":
+            raise Exception("Unexpected STATUS ieee80211ac value")
+        if status["secondary_channel"] != "1":
+            raise Exception("Unexpected STATUS secondary_channel value")
+        if status["vht_oper_chwidth"] != "1":
+            raise Exception("Unexpected STATUS vht_oper_chwidth value")
+        if status["vht_oper_centr_freq_seg0_idx"] != "42":
+            raise Exception("Unexpected STATUS vht_oper_centr_freq_seg0_idx value")
     except Exception, e:
         if isinstance(e, Exception) and str(e) == "AP startup failed":
             if not vht_supported():
@@ -63,7 +75,7 @@ def test_ap_vht80(dev, apdev):
         dev[0].flush_scan_cache()
 
 def vht80_test(apdev, dev, channel, ht_capab):
-    clear_scan_cache(apdev['ifname'])
+    clear_scan_cache(apdev)
     try:
         hapd = None
         params = { "ssid": "vht",
@@ -75,7 +87,7 @@ def vht80_test(apdev, dev, channel, ht_capab):
                    "ieee80211ac": "1",
                    "vht_oper_chwidth": "1",
                    "vht_oper_centr_freq_seg0_idx": "42" }
-        hapd = hostapd.add_ap(apdev['ifname'], params)
+        hapd = hostapd.add_ap(apdev, params)
         bssid = apdev['bssid']
 
         dev.connect("vht", key_mgmt="NONE", scan_freq=str(5000 + 5 * channel))
@@ -225,7 +237,7 @@ def test_ap_vht_20(devs, apdevs):
                    "supported_rates": "60 120 240 360 480 540",
                    "require_vht": "1",
                  }
-        hapd = hostapd.add_ap(ap['ifname'], params)
+        hapd = hostapd.add_ap(ap, params)
         dev.connect("test-vht20", scan_freq="5180", key_mgmt="NONE")
         hwsim_utils.test_connectivity(dev, hapd)
     finally:
@@ -252,7 +264,7 @@ def test_ap_vht_40(devs, apdevs):
                    "vht_oper_chwidth": "0",
                    "vht_oper_centr_freq_seg0_idx": "0",
                  }
-        hapd = hostapd.add_ap(ap['ifname'], params)
+        hapd = hostapd.add_ap(ap, params)
         dev.connect("test-vht40", scan_freq="5180", key_mgmt="NONE")
         hwsim_utils.test_connectivity(dev, hapd)
     finally:
@@ -708,3 +720,34 @@ def test_ap_vht80_pwr_constraint(dev, apdev):
             hapd.request("DISABLE")
         subprocess.call(['iw', 'reg', 'set', '00'])
         dev[0].flush_scan_cache()
+
+def test_ap_vht_use_sta_nsts(dev, apdev):
+    """VHT with 80 MHz channel width and use_sta_nsts=1"""
+    try:
+        hapd = None
+        params = { "ssid": "vht",
+                   "country_code": "FI",
+                   "hw_mode": "a",
+                   "channel": "36",
+                   "ht_capab": "[HT40+]",
+                   "ieee80211n": "1",
+                   "ieee80211ac": "1",
+                   "vht_oper_chwidth": "1",
+                   "vht_oper_centr_freq_seg0_idx": "42",
+                   "use_sta_nsts": "1" }
+        hapd = hostapd.add_ap(apdev[0], params)
+        bssid = apdev[0]['bssid']
+
+        dev[0].connect("vht", key_mgmt="NONE", scan_freq="5180")
+        hwsim_utils.test_connectivity(dev[0], hapd)
+    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")
+        if hapd:
+            hapd.request("DISABLE")
+        subprocess.call(['iw', 'reg', 'set', '00'])
+        dev[0].flush_scan_cache()