]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Fix eap_proto special cases for EAP ID
authorJouni Malinen <quic_jouni@quicinc.com>
Thu, 20 Mar 2025 21:18:52 +0000 (23:18 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 20 Mar 2025 21:18:52 +0000 (23:18 +0200)
The EAP-Success cases with id off by 2 or 3 need to handle the special
cases where the id wraps around over the maximum value to avoid failures
when the random id value from hostapd ends up being close enough to the
maximum value.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
tests/hwsim/test_eap_proto.py

index bd6e78f459c6c91cac8bed37e19d26a81a606354..747af17a12aeed6f91867ba3c2af553d131c6a10 100644 (file)
@@ -204,7 +204,7 @@ def test_eap_proto(dev, apdev):
         idx += 1
         if ctx['num'] == idx:
             logger.info("Test: EAP-Success - id off by 2")
-            return struct.pack(">BBH", EAP_CODE_SUCCESS, id + 1, 4)
+            return struct.pack(">BBH", EAP_CODE_SUCCESS, (id + 1) % 256, 4)
 
         idx += 1
         if ctx['num'] == idx:
@@ -216,7 +216,7 @@ def test_eap_proto(dev, apdev):
         idx += 1
         if ctx['num'] == idx:
             logger.info("Test: EAP-Success - id off by 3")
-            return struct.pack(">BBH", EAP_CODE_SUCCESS, id + 2, 4)
+            return struct.pack(">BBH", EAP_CODE_SUCCESS, (id + 2) % 256, 4)
 
         idx += 1
         if ctx['num'] == idx: