[PATCH 10/10] tests: Add tests for SMD AP and association

Pooventhiran G pooventhiran.g at oss.qualcomm.com
Sat Nov 21 12:34:19 PST 2026


Add tests for SMD AP setup and association:
 - SMD AP sanity with invalid configuration
 - SMD association with Security Profiles 0 and 1
 - SMD association with Per-AP MLD PTK mode

Signed-off-by: Pooventhiran G <pooventhiran.g at oss.qualcomm.com>
---
 tests/hwsim/test_smd.py | 259 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 259 insertions(+)
 create mode 100644 tests/hwsim/test_smd.py

diff --git a/tests/hwsim/test_smd.py b/tests/hwsim/test_smd.py
new file mode 100644
index 000000000000..eb1e30a2dcbc
--- /dev/null
+++ b/tests/hwsim/test_smd.py
@@ -0,0 +1,259 @@
+# Test cases for SMD
+# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+#
+# This software may be distributed under the terms of the BSD license.
+# See README for more details.
+
+import hostapd
+from utils import *
+from hwsim import HWSimRadio
+from wpasupplicant import WpaSupplicant
+from test_eht import eht_verify_status, traffic_test
+from test_uhr import uhr_verify_status, uhr_verify_wifi_version, uhr_mld_ap_wpa2_params, uhr_mld_enable_ap
+from test_security_profiles import enable_sta_security_profiles, check_security_profile
+
+def smd_config_defaults(params):
+    params['smd_ap'] = "1"
+    params['smd_identifier'] = "00:01:02:03:04:05"
+    params['smd_prep_timeout'] = "250"
+    params['smd_dl_data_forward'] = "0"
+    params['smd_max_prep_target_ap_mlds'] = "7"
+    params['smd_type'] = "0"
+    params['smd_ptk_mode'] = "0"
+    params['smd_neighbor_probing'] = "0"
+
+def smd_secprof_config(params, eppke_unauth="1", secprof="0"):
+    params['rsn_pairwise'] = "GCMP-256"
+    params['group_cipher'] = "GCMP-256"
+    params['beacon_prot'] = "1"
+    params['ieee80211w'] = "2"
+    params['eppke_unauth'] = eppke_unauth
+    params['security_profiles'] = secprof
+    params['assoc_frame_encryption'] = "1"
+    params['pmksa_caching_privacy'] = "1"
+
+def __check_smd_ap_sanity(hapd_iface, link, params, uhr=True, valid=True, msg=None):
+    from test_eht import eht_mld_enable_ap
+
+    msg = "" if not msg else ": " + msg
+
+    try:
+        if uhr:
+            hapd = uhr_mld_enable_ap(hapd_iface, link, params)
+        else:
+            hapd = eht_mld_enable_ap(hapd_iface, link, params)
+    except:
+        if valid:
+            raise Exception("Failed to start SMD AP" + msg)
+        else:
+            logger.info("SMD AP failed as expected" + msg)
+    else:
+        if not valid:
+            raise Exception("SMD AP with invalid conf" + msg)
+        else:
+            logger.info("SMD AP started successfully")
+
+def test_smd_ap_no_mld(dev, apdev):
+    """SMD AP sanity check - without MLD"""
+    ssid = "smd-ap"
+    passphrase = "1234567890"
+    check_sae_capab(dev[0])
+    params = hostapd.wpa2_params(ssid, passphrase, wpa_key_mgmt="SAE",
+                                 ieee80211w="2")
+    params['sae_pwe'] = "2"
+    smd_config_defaults(params)
+
+    try:
+        hapd = hostapd.add_ap(apdev[0], params)
+    except:
+        logger.info("SMD AP failed as expected: without MLD")
+    else:
+        raise Exception("SMD AP with invalid conf: without MLD")
+
+def test_smd_ap_no_uhr(dev, apdev):
+    """SMD AP sanity check - without UHR"""
+    from test_eht import eht_mld_ap_wpa2_params
+
+    ssid = "smd-ap"
+    passphrase = "1234567890"
+
+    with HWSimRadio(use_mlo=True) as (hapd_radio, hapd_iface), \
+         HWSimRadio(use_mlo=True) as (wpas_radio, wpas_iface):
+        params = eht_mld_ap_wpa2_params(ssid, passphrase, key_mgmt="EPPKE")
+        smd_config_defaults(params)
+        smd_secprof_config(params)
+        __check_smd_ap_sanity(hapd_iface, 0, params, uhr=False, valid=False,
+                               msg="without UHR")
+
+def test_smd_ap_no_secprof(dev, apdev):
+    """SMD AP sanity check - without Security Profile"""
+    ssid = "smd-ap"
+    passphrase = "1234567890"
+
+    with HWSimRadio(use_mlo=True) as (hapd_radio, hapd_iface), \
+         HWSimRadio(use_mlo=True) as (wpas_radio, wpas_iface):
+        params = uhr_mld_ap_wpa2_params(ssid, passphrase, pwe=2,
+                                        key_mgmt="SAE-EXT-KEY")
+        smd_config_defaults(params)
+        __check_smd_ap_sanity(hapd_iface, 0, params, valid=False,
+                               msg="without security profiles")
+
+def test_smd_ap_no_supp_secprof(dev, apdev):
+    """SMD AP sanity check - without supported Security Profile"""
+    ssid = "smd-ap"
+    passphrase = "1234567890"
+
+    with HWSimRadio(use_mlo=True) as (hapd_radio, hapd_iface), \
+         HWSimRadio(use_mlo=True) as (wpas_radio, wpas_iface):
+        params = uhr_mld_ap_wpa2_params(ssid, passphrase, key_mgmt="EPPKE")
+        smd_config_defaults(params)
+        smd_secprof_config(params, secprof="9")
+        __check_smd_ap_sanity(hapd_iface, 0, params, valid=False,
+                               msg="without supported security profile(s)")
+
+def test_smd_ap_ok(dev, apdev):
+    """SMD AP sanity check - calid configuration"""
+    ssid = "smd-ap"
+    passphrase = "1234567890"
+
+    with HWSimRadio(use_mlo=True) as (hapd_radio, hapd_iface), \
+         HWSimRadio(use_mlo=True) as (wpas_radio, wpas_iface):
+        params = uhr_mld_ap_wpa2_params(ssid, passphrase, key_mgmt="EPPKE")
+        smd_config_defaults(params)
+        smd_secprof_config(params)
+        __check_smd_ap_sanity(hapd_iface, 0, params)
+
+def test_smd_assoc_secprof0(dev, apdev):
+    """2-link MLO SMD association using Security Profile 0"""
+    ssid = "smd-assoc-secprof0"
+    passphrase = "1234567890"
+
+    with HWSimRadio(use_mlo=True) as (hapd_radio, hapd_iface), \
+         HWSimRadio(use_mlo=True) as (wpas_radio, wpas_iface):
+        params = uhr_mld_ap_wpa2_params(ssid, passphrase, pwe=None,
+                                        key_mgmt="EPPKE")
+        smd_config_defaults(params)
+        smd_secprof_config(params)
+
+        hapd0 = uhr_mld_enable_ap(hapd_iface, 0, params)
+
+        params['channel'] = "6"
+        hapd1 = uhr_mld_enable_ap(hapd_iface, 1, params)
+
+        if not hapd0 or not hapd1:
+            raise Exception("Failed to start SMD AP")
+
+        wpas = WpaSupplicant(global_iface="/tmp/wpas-wlan5")
+        wpas.interface_add(wpas_iface)
+        enable_sta_security_profiles(wpas, 0)
+
+        wpas.connect(ssid,
+                     psk=passphrase,
+                     key_mgmt="EPPKE",
+                     beacon_prot="1",
+                     ieee80211w="2",
+                     scan_freq="2412 2437",
+                     pmksa_privacy="1",
+                     pairwise="GCMP-256",
+                     group="GCMP-256")
+
+        check_security_profile(hapd0, wpas, 0, akm='00-0f-ac-29')
+
+        eht_verify_status(wpas, hapd0, 2412, 20, is_ht=True, mld=True,
+                          valid_links=3, active_links=3)
+        uhr_verify_status(wpas, hapd0, is_ht=True)
+        uhr_verify_wifi_version(wpas)
+
+        traffic_test(wpas, hapd0)
+        traffic_test(wpas, hapd1)
+
+def test_smd_assoc_secprof1(dev, apdev):
+    """2-link MLO SMD association using Security Profile 1"""
+    ssid = "smd-assoc-secprof1"
+    passphrase = "1234567890"
+
+    with HWSimRadio(use_mlo=True) as (hapd_radio, hapd_iface), \
+         HWSimRadio(use_mlo=True) as (wpas_radio, wpas_iface):
+        params = uhr_mld_ap_wpa2_params(ssid, passphrase, pwe=2,
+                                        key_mgmt="SAE-EXT-KEY EPPKE")
+        smd_config_defaults(params)
+        smd_secprof_config(params, eppke_unauth="0", secprof="1")
+
+        hapd0 = uhr_mld_enable_ap(hapd_iface, 0, params)
+
+        params['channel'] = "6"
+        hapd1 = uhr_mld_enable_ap(hapd_iface, 1, params)
+
+        if not hapd0 or not hapd1:
+            raise Exception("Failed to start SMD AP")
+
+        wpas = WpaSupplicant(global_iface="/tmp/wpas-wlan5")
+        wpas.interface_add(wpas_iface)
+        enable_sta_security_profiles(wpas, 1)
+
+        wpas.set("sae_pwe", "2")
+        wpas.connect(ssid,
+                     psk=passphrase,
+                     key_mgmt="SAE-EXT-KEY EPPKE",
+                     beacon_prot="1",
+                     ieee80211w="2",
+                     scan_freq="2412 2437",
+                     pmksa_privacy="1",
+                     pairwise="GCMP-256",
+                     group="GCMP-256")
+
+        check_security_profile(hapd0, wpas, 1, akm="00-0f-ac-24")
+
+        eht_verify_status(wpas, hapd0, 2412, 20, is_ht=True, mld=True,
+                          valid_links=3, active_links=3)
+        uhr_verify_status(wpas, hapd0, is_ht=True)
+        uhr_verify_wifi_version(wpas)
+
+        traffic_test(wpas, hapd0)
+        traffic_test(wpas, hapd1)
+
+def test_smd_assoc_secprof1_ptkmode1(dev, apdev):
+    """2-link MLO SMD association using Security Profile 1 and SMD PTK Mode 1"""
+    ssid = "smd-assoc-secprof1-ptk1"
+    passphrase = "1234567890"
+
+    with HWSimRadio(use_mlo=True) as (hapd_radio, hapd_iface), \
+         HWSimRadio(use_mlo=True) as (wpas_radio, wpas_iface):
+        params = uhr_mld_ap_wpa2_params(ssid, passphrase, pwe=2,
+                                        key_mgmt="SAE-EXT-KEY EPPKE")
+        smd_config_defaults(params)
+        smd_secprof_config(params, eppke_unauth="0", secprof="1")
+        params['smd_ptk_mode'] = "1"
+
+        hapd0 = uhr_mld_enable_ap(hapd_iface, 0, params)
+
+        params['channel'] = "6"
+        hapd1 = uhr_mld_enable_ap(hapd_iface, 1, params)
+
+        if not hapd0 or not hapd1:
+            raise Exception("Failed to start SMD AP")
+
+        wpas = WpaSupplicant(global_iface="/tmp/wpas-wlan5")
+        wpas.interface_add(wpas_iface)
+        enable_sta_security_profiles(wpas, 1)
+
+        wpas.set("sae_pwe", "2")
+        wpas.connect(ssid,
+                     psk=passphrase,
+                     key_mgmt="SAE-EXT-KEY EPPKE",
+                     beacon_prot="1",
+                     ieee80211w="2",
+                     scan_freq="2412 2437",
+                     pmksa_privacy="1",
+                     pairwise="GCMP-256",
+                     group="GCMP-256")
+
+        check_security_profile(hapd0, wpas, 1, akm="00-0f-ac-24")
+
+        eht_verify_status(wpas, hapd0, 2412, 20, is_ht=True, mld=True,
+                          valid_links=3, active_links=3)
+        uhr_verify_status(wpas, hapd0, is_ht=True)
+        uhr_verify_wifi_version(wpas)
+
+        traffic_test(wpas, hapd0)
+        traffic_test(wpas, hapd1)
-- 
2.34.1




More information about the Hostap mailing list