From b9f4b19e3b17a7901acea53928612b0a4a47dc42 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 20 Mar 2025 23:18:52 +0200 Subject: [PATCH] tests: Fix eap_proto special cases for EAP ID 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 --- tests/hwsim/test_eap_proto.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/hwsim/test_eap_proto.py b/tests/hwsim/test_eap_proto.py index bd6e78f45..747af17a1 100644 --- a/tests/hwsim/test_eap_proto.py +++ b/tests/hwsim/test_eap_proto.py @@ -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: -- 2.47.3