]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: More ieee802_11_vendor_ie_concat() coverage
authorJouni Malinen <j@w1.fi>
Mon, 26 Dec 2016 12:44:44 +0000 (14:44 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 26 Dec 2016 12:44:44 +0000 (14:44 +0200)
Signed-off-by: Jouni Malinen <j@w1.fi>
src/common/common_module_tests.c

index eb41310da88ae411a7bd80c3d24410f54bf43c62..0b596bbcc6313a58e2e140806deb00803e8669d8 100644 (file)
@@ -84,6 +84,7 @@ static const struct ieee802_11_parse_test_data parse_tests[] = {
 static int ieee802_11_parse_tests(void)
 {
        int i, ret = 0;
+       struct wpabuf *buf;
 
        wpa_printf(MSG_INFO, "ieee802_11_parse tests");
 
@@ -109,6 +110,35 @@ static int ieee802_11_parse_tests(void)
                ret = -1;
        }
 
+       buf = ieee802_11_vendor_ie_concat((const u8 *) "\xdd\x05\x11\x22\x33\x44\x01\xdd\x05\x11\x22\x33\x44\x02\x00\x01",
+                                         16, 0x11223344);
+       do {
+               const u8 *pos;
+
+               if (!buf) {
+                       wpa_printf(MSG_ERROR,
+                                  "ieee802_11_vendor_ie_concat test 2 failed");
+                       ret = -1;
+                       break;
+               }
+
+               if (wpabuf_len(buf) != 2) {
+                       wpa_printf(MSG_ERROR,
+                                  "ieee802_11_vendor_ie_concat test 3 failed");
+                       ret = -1;
+                       break;
+               }
+
+               pos = wpabuf_head(buf);
+               if (pos[0] != 0x01 || pos[1] != 0x02) {
+                       wpa_printf(MSG_ERROR,
+                                  "ieee802_11_vendor_ie_concat test 3 failed");
+                       ret = -1;
+                       break;
+               }
+       } while (0);
+       wpabuf_free(buf);
+
        return ret;
 }