]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: WFA generational capabilities indication (automatic)
authorJouni Malinen <quic_jouni@quicinc.com>
Wed, 6 Nov 2024 17:45:37 +0000 (19:45 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 6 Nov 2024 17:48:01 +0000 (19:48 +0200)
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
tests/hwsim/test_wfa_capab.py

index 2f783052edd377a4c621a6d6cb6edd7c12fc2b98..862514556082893cc1a92b055e5a644532ec2788 100644 (file)
@@ -39,16 +39,30 @@ def test_wfa_gen_capa_unprotected_cert(dev, apdev):
     finally:
         dev[0].set("wfa_gen_capa", "0")
 
-def run_wfa_gen_capa(dev, apdev, cert=False):
+def test_wfa_gen_capa_automatic(dev, apdev):
+    """WFA generational capabilities indication (automatic)"""
+    try:
+        dev[0].set("wfa_gen_capa", "1")
+        run_wfa_gen_capa(dev, apdev, automatic=True)
+    finally:
+        dev[0].set("wfa_gen_capa", "0")
+
+def run_wfa_gen_capa(dev, apdev, cert=False, automatic=False):
     check_sae_capab(dev[0])
 
     params = hostapd.wpa3_params(ssid="wfa-capab", password="12345678")
     hapd = hostapd.add_ap(apdev[0], params)
 
     dev[0].set("sae_groups", "")
-    dev[0].set("wfa_gen_capa_supp", "07")
-    if cert:
-        dev[0].set("wfa_gen_capa_cert", "07")
+    if automatic:
+        dev[0].set("wfa_gen_capa_supp", "")
+        dev[0].set("wfa_gen_capa_cert", "")
+    else:
+        dev[0].set("wfa_gen_capa_supp", "07")
+        if cert:
+            dev[0].set("wfa_gen_capa_cert", "07")
+        else:
+            dev[0].set("wfa_gen_capa_cert", "")
     dev[0].connect("wfa-capab", sae_password="12345678", key_mgmt="SAE",
                    ieee80211w="2", scan_freq="2412")
     ev = hapd.wait_event(["WFA-GEN-CAPAB"], timeout=10)
@@ -57,5 +71,9 @@ def run_wfa_gen_capa(dev, apdev, cert=False):
     _, addr, val = ev.split()
     if addr != dev[0].own_addr():
         raise Exception("Unexpected STA address in the indication")
-    if val != ("01070107" if cert else "0107"):
-        raise Exception("Unexpected indication value: " + val)
+    if automatic:
+        if not val.startswith("01"):
+            raise Exception("Unexpected indication value: " + val)
+    else:
+        if val != ("01070107" if cert else "0107"):
+            raise Exception("Unexpected indication value: " + val)