tests: Fix EAP-SIM/AKA protocol tests to use full header
authorJouni Malinen <j@w1.fi>
Sun, 3 May 2015 08:17:06 +0000 (11:17 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 3 May 2015 13:32:59 +0000 (16:32 +0300)
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>
tests/hwsim/test_eap_proto.py

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