[PATCH v2 11/14] tests: Add PASN test with comeback flow

Ilan Peer ilan.peer at intel.com
Wed Dec 16 06:01:02 EST 2020


Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
 tests/hwsim/test_pasn.py | 42 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/tests/hwsim/test_pasn.py b/tests/hwsim/test_pasn.py
index d2e839d649..e681ba190a 100644
--- a/tests/hwsim/test_pasn.py
+++ b/tests/hwsim/test_pasn.py
@@ -21,6 +21,7 @@ from utils import HwsimSkip
 from hwsim import HWSimRadio
 from test_erp import check_erp_capa, start_erp_as
 from test_fils import check_fils_capa
+import re
 
 def check_pasn_capab(dev):
     if "PASN" not in dev.get_capability("auth_alg"):
@@ -533,3 +534,44 @@ def test_pasn_fils_sha256_connected_diff_channel(dev, apdev, params):
 def test_pasn_fils_sha384_connected_diff_channel(dev, apdev, params):
     """PASN FILS authentication using SHA-384 while connected diff channel"""
     check_pasn_fils_connected_diff_channel(dev, apdev, params, "FILS-SHA384")
+
+ at remote_compatible
+def test_pasn_comeback(dev, apdev, params):
+    """ PASN authentication with comeback flow """
+    check_pasn_capab(dev[0])
+
+    params = pasn_ap_params("PASN", "CCMP", "19")
+    params['anti_clogging_threshold'] = '0'
+    hapd = hostapd.add_ap(apdev[0], params)
+
+    dev[0].scan(type="ONLY", freq=2412)
+    cmd = "PASN_START bssid=%s akmp=PASN cipher=CCMP group=19" % (hapd.own_addr())
+
+    resp = dev[0].request(cmd)
+    if "OK" not in resp:
+        raise Exception("Failed to start PASN authentication")
+
+    ev = dev[0].wait_event(["PASN-AUTH-STATUS"], 3)
+    if not ev:
+        raise Exception("PASN: PASN-AUTH-STATUS not seen")
+
+    if hapd.own_addr() + " akmp=PASN, status=30 comeback_after=" not in ev:
+        raise Exception("PASN: unexpected status")
+
+    comeback = re.split("comeback=", ev)[1]
+
+    cmd = "PASN_START bssid=%s akmp=PASN cipher=CCMP group=19 comeback=%s" % \
+            (hapd.own_addr(), comeback)
+
+    resp = dev[0].request(cmd)
+    if "OK" not in resp:
+        raise Exception("Failed to start PASN authentication")
+
+    ev = dev[0].wait_event(["PASN-AUTH-STATUS"], 3)
+    if not ev:
+        raise Exception("PASN: PASN-AUTH-STATUS not seen")
+
+    if hapd.own_addr() + " akmp=PASN, status=0" not in ev:
+        raise Exception("PASN: unexpected status with comeback token")
+
+    check_pasn_ptk(dev[0], hapd, "CCMP")
-- 
2.17.1




More information about the Hostap mailing list