]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Verify link removal (MLO)
authorIlan Peer <ilan.peer@intel.com>
Mon, 20 Nov 2023 23:51:55 +0000 (01:51 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 26 Nov 2023 11:25:57 +0000 (13:25 +0200)
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
tests/hwsim/hostapd.py
tests/hwsim/test_eht.py

index b93d5caed5908434ab5d3609597c3efc8f97e72b..ed9378bdc536327c0128196df8fe2ddc33764595 100644 (file)
@@ -266,6 +266,10 @@ class Hostapd:
         if "OK" not in self.request("DISABLE"):
             raise Exception("Failed to disable hostapd interface " + self.ifname)
 
+    def link_remove(self, count=10):
+        if "OK" not in self.request("LINK_REMOVE %u" % count):
+            raise Exception("Failed to remove hostapd link " + self.ifname)
+
     def dump_monitor(self):
         while self.mon.pending():
             ev = self.mon.recv()
index de2ba57f1028ae692e87cdc581611ab3eed1e94c..b7441d6eaea35fbdeb5ef743a0f19306338abf53 100644 (file)
@@ -92,8 +92,8 @@ def eht_verify_status(wpas, hapd, freq, bw, is_ht=False, is_vht=False,
     time.sleep(0.1)
     _eht_verify_links(wpas, valid_links, active_links)
 
-def traffic_test(wpas, hapd):
-    hwsim_utils.test_connectivity(wpas, hapd)
+def traffic_test(wpas, hapd, success=True):
+    hwsim_utils.test_connectivity(wpas, hapd, success_expected=success)
 
 def test_eht_open(dev, apdev):
     """EHT AP with open mode configuration"""
@@ -625,3 +625,44 @@ def test_eht_ml_probe_req(dev, apdev):
                               "CTRL-EVENT-SCAN-FAILED"], timeout=10)
         if ev is None:
             raise Exception("ML_PROBE_REQ did not result in scan results")
+
+def test_eht_mld_link_removal(dev, apdev):
+    """EHT MLD with two links. Links removed during association"""
+
+    with HWSimRadio(use_mlo=True) as (hapd0_radio, hapd0_iface), \
+        HWSimRadio(use_mlo=True) as (wpas_radio, wpas_iface):
+
+        wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
+        wpas.interface_add(wpas_iface)
+
+        ssid = "mld_ap_owe_two_link"
+        params = eht_mld_ap_wpa2_params(ssid, key_mgmt="OWE", mfp="2")
+        hapd0 = eht_mld_enable_ap(hapd0_iface, params)
+
+        params['channel'] = '6'
+        hapd1 = eht_mld_enable_ap(hapd0_iface, params)
+
+        wpas.connect(ssid, scan_freq="2412 2437", key_mgmt="OWE",
+                     ieee80211w="2")
+        eht_verify_status(wpas, hapd0, 2412, 20, is_ht=True, mld=True,
+                          valid_links=3, active_links=3)
+        eht_verify_wifi_version(wpas)
+        traffic_test(wpas, hapd0)
+
+        logger.info("Disable the 2nd link in 4 beacon intervals")
+        hapd1.link_remove(4)
+        time.sleep(0.6)
+
+        logger.info("Test traffic after 2nd link disabled")
+        traffic_test(wpas, hapd0)
+
+        logger.info("Disable the 1st link in 20 beacon intervals")
+        hapd0.link_remove(20)
+        time.sleep(1)
+
+        logger.info("Verify that traffic is valid before the link is removed")
+        traffic_test(wpas, hapd0)
+        time.sleep(2)
+
+        logger.info("Test traffic after 1st link disabled")
+        traffic_test(wpas, hapd0, success=False)