From 3cf0184089cb159e0f7994994d426bef4fbeabce Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Wed, 30 Jan 2019 11:21:06 -0600 Subject: [PATCH] unit: Add another test with an out-of-order tag --- unit/test-mpdu.c | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/unit/test-mpdu.c b/unit/test-mpdu.c index 531b287c..388a1bc2 100644 --- a/unit/test-mpdu.c +++ b/unit/test-mpdu.c @@ -126,7 +126,7 @@ static const uint8_t probe_req_good2[] = { static const struct test_frame_data probe_req_good2_data = { probe_req_good2, sizeof(probe_req_good2), true }; -static const uint8_t probe_req_bad1[] = { +static const uint8_t probe_req_ie_out_of_order1[] = { /* Header */ 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x50, 0x64, @@ -134,10 +134,12 @@ static const uint8_t probe_req_bad1[] = { 0x00, 0x05, 0x74, 0x65, 0x73, 0x74, 0x31, 0x32, 0x04, 0x30, 0x48, 0x60, 0x6c, 0x01, 0x08, 0x02, 0x04, 0x0b, 0x16, 0x0c, 0x12, 0x18, 0x24, }; -static const struct test_frame_data probe_req_bad1_data = - { probe_req_bad1, sizeof(probe_req_bad1), false }; -static const uint8_t probe_req_bad2[] = { +static const struct test_frame_data probe_req_ie_out_of_order1_data = { + probe_req_ie_out_of_order1, sizeof(probe_req_ie_out_of_order1), true +}; + +static const uint8_t probe_req_ie_out_of_order2[] = { /* Header */ 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x50, 0x64, @@ -146,8 +148,25 @@ static const uint8_t probe_req_bad2[] = { 0x74, 0x31, 0x01, 0x08, 0x02, 0x04, 0x0b, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x32, 0x04, 0x30, 0x48, 0x60, 0x6c, }; -static const struct test_frame_data probe_req_bad2_data = - { probe_req_bad2, sizeof(probe_req_bad2), false }; + +static const struct test_frame_data probe_req_ie_out_of_order2_data = { + probe_req_ie_out_of_order2, sizeof(probe_req_ie_out_of_order2), true +}; + +static const uint8_t probe_req_ie_out_of_order3[] = { + 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xda, 0xa1, + 0x19, 0x11, 0xec, 0x70, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x50, 0x25, + 0x00, 0x00, 0x01, 0x04, 0x02, 0x04, 0x0b, 0x16, 0x32, 0x08, 0x0c, 0x12, + 0x18, 0x24, 0x30, 0x48, 0x60, 0x6c, 0x03, 0x01, 0x06, 0x2d, 0x1a, 0x6e, + 0x01, 0x03, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xdd, 0x07, 0x00, 0x50, 0xf2, 0x08, 0x00, 0x01, 0x00, 0x7f, 0x05, + 0x00, 0x00, 0x0a, 0x02, 0x01, +}; + +static const struct test_frame_data probe_req_ie_out_of_order3_data = { + probe_req_ie_out_of_order3, sizeof(probe_req_ie_out_of_order3), true +}; static void ie_order_test(const void *data) { @@ -165,8 +184,12 @@ int main(int argc, char *argv[]) l_test_add("/IE order/Good 1", ie_order_test, &probe_req_good1_data); l_test_add("/IE order/Good 2", ie_order_test, &probe_req_good2_data); - l_test_add("/IE order/Bad 1", ie_order_test, &probe_req_bad1_data); - l_test_add("/IE order/Bad 2", ie_order_test, &probe_req_bad2_data); + l_test_add("/IE order/Good (Out of Order IE) 1", ie_order_test, + &probe_req_ie_out_of_order1_data); + l_test_add("/IE order/Good (Out of Order IE) 2", ie_order_test, + &probe_req_ie_out_of_order2_data); + l_test_add("/IE order/Good 3", ie_order_test, + &probe_req_ie_out_of_order3_data); return l_test_run(); }