From: Jouni Malinen Date: Thu, 20 Mar 2025 21:18:52 +0000 (+0200) Subject: tests: Fix eap_proto special cases for EAP ID X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9f4b19e3b17a7901acea53928612b0a4a47dc42;p=thirdparty%2Fhostap.git 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 --- 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: