tests: Fix EAP-SIM/AKA protocol tests to use full header

Couple of the EAP-SIM/AKA protocol test cases were leaving out the
Reserved field. This was not intentional since these test cases were
targeting a specific Subtype processing instead of verifying truncated
header case (which is covered separately). Add the Reserved field to
allow the implementation to add an explicit, earlier check for this.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2015-05-03 11:17:06 +03:00
parent f5ed40010c
commit f0174bff85

View file

@ -2123,9 +2123,9 @@ def test_eap_proto_aka(dev, apdev):
idx += 1 idx += 1
if ctx['num'] == idx: if ctx['num'] == idx:
logger.info("Test: Unknown subtype") logger.info("Test: Unknown subtype")
return struct.pack(">BBHBB", EAP_CODE_REQUEST, ctx['id'], return struct.pack(">BBHBBH", EAP_CODE_REQUEST, ctx['id'],
4 + 1 + 1, 4 + 1 + 3,
EAP_TYPE_AKA, 255) EAP_TYPE_AKA, 255, 0)
idx += 1 idx += 1
if ctx['num'] == idx: if ctx['num'] == idx:
logger.info("Test: EAP-Failure") logger.info("Test: EAP-Failure")
@ -2134,9 +2134,9 @@ def test_eap_proto_aka(dev, apdev):
idx += 1 idx += 1
if ctx['num'] == idx: if ctx['num'] == idx:
logger.info("Test: Client Error") logger.info("Test: Client Error")
return struct.pack(">BBHBB", EAP_CODE_REQUEST, ctx['id'], return struct.pack(">BBHBBH", EAP_CODE_REQUEST, ctx['id'],
4 + 1 + 1, 4 + 1 + 3,
EAP_TYPE_AKA, EAP_AKA_SUBTYPE_CLIENT_ERROR) EAP_TYPE_AKA, EAP_AKA_SUBTYPE_CLIENT_ERROR, 0)
idx += 1 idx += 1
if ctx['num'] == idx: if ctx['num'] == idx:
logger.info("Test: EAP-Failure") logger.info("Test: EAP-Failure")
@ -2791,6 +2791,7 @@ def test_eap_proto_aka(dev, apdev):
if ev is None: if ev is None:
raise Exception("Timeout on EAP failure") raise Exception("Timeout on EAP failure")
dev[0].request("REMOVE_NETWORK all") dev[0].request("REMOVE_NETWORK all")
dev[0].dump_monitor()
finally: finally:
stop_radius_server(srv) stop_radius_server(srv)
@ -3135,6 +3136,7 @@ def test_eap_proto_aka_prime(dev, apdev):
if ev is None: if ev is None:
raise Exception("Timeout on EAP failure") raise Exception("Timeout on EAP failure")
dev[0].request("REMOVE_NETWORK all") dev[0].request("REMOVE_NETWORK all")
dev[0].dump_monitor()
finally: finally:
stop_radius_server(srv) stop_radius_server(srv)
@ -3496,9 +3498,9 @@ def test_eap_proto_sim(dev, apdev):
idx += 1 idx += 1
if ctx['num'] == idx: if ctx['num'] == idx:
logger.info("Test: Client Error") logger.info("Test: Client Error")
return struct.pack(">BBHBB", EAP_CODE_REQUEST, ctx['id'], return struct.pack(">BBHBBH", EAP_CODE_REQUEST, ctx['id'],
4 + 1 + 1, 4 + 1 + 3,
EAP_TYPE_SIM, EAP_SIM_SUBTYPE_CLIENT_ERROR) EAP_TYPE_SIM, EAP_SIM_SUBTYPE_CLIENT_ERROR, 0)
idx += 1 idx += 1
if ctx['num'] == idx: if ctx['num'] == idx:
logger.info("Test: EAP-Failure") logger.info("Test: EAP-Failure")
@ -3507,9 +3509,9 @@ def test_eap_proto_sim(dev, apdev):
idx += 1 idx += 1
if ctx['num'] == idx: if ctx['num'] == idx:
logger.info("Test: Unknown subtype") logger.info("Test: Unknown subtype")
return struct.pack(">BBHBB", EAP_CODE_REQUEST, ctx['id'], return struct.pack(">BBHBBH", EAP_CODE_REQUEST, ctx['id'],
4 + 1 + 1, 4 + 1 + 3,
EAP_TYPE_SIM, 255) EAP_TYPE_SIM, 255, 0)
idx += 1 idx += 1
if ctx['num'] == idx: if ctx['num'] == idx:
logger.info("Test: EAP-Failure") logger.info("Test: EAP-Failure")
@ -3539,6 +3541,7 @@ def test_eap_proto_sim(dev, apdev):
if ev is None: if ev is None:
raise Exception("Timeout on EAP failure") raise Exception("Timeout on EAP failure")
dev[0].request("REMOVE_NETWORK all") dev[0].request("REMOVE_NETWORK all")
dev[0].dump_monitor()
finally: finally:
stop_radius_server(srv) stop_radius_server(srv)