]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Fix eap_proto_sake_server with Session ID = 255
authorJouni Malinen <jouni@codeaurora.org>
Thu, 6 May 2021 20:49:12 +0000 (23:49 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 6 May 2021 20:49:12 +0000 (23:49 +0300)
Need to wrap back to 0 when changing value 255 to avoid generating a too
large value to fit an octet field. This was resulting in errors due to a
python exception (likely for about every 256th run).

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
tests/hwsim/test_eap_proto.py

index afdc45d70ee2026c176aa0485a4780d133008faf..a8f4aeb3648324115f89c9e433124ced097c8812 100644 (file)
@@ -983,7 +983,7 @@ def test_eap_proto_sake_server(dev, apdev):
     # Unknown session
     # --> EAP-SAKE: Session ID mismatch
     sess, = struct.unpack('B', binascii.unhexlify(resp[20:22]))
-    sess = binascii.hexlify(struct.pack('B', sess + 1)).decode()
+    sess = binascii.hexlify(struct.pack('B', (sess + 1) % 256)).decode()
     msg = resp[0:4] + "0008" + resp[8:12] + "0008" + "3002" + sess + "00"
     tx_msg(dev[0], hapd, msg)
     # Unknown subtype