]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
ndis: Use the new get_ie() helper to avoid duplicated code
authorJouni Malinen <j@w1.fi>
Sun, 21 Feb 2016 15:07:47 +0000 (17:07 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 21 Feb 2016 15:32:47 +0000 (17:32 +0200)
This removes more duplicated implementation of finding the first IE
based on the id.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/drivers/driver_ndis.c

index fd32134c733d749fc6b2f04f6bd354f4175052c5..9440f0127235a2ceb11b6655492e08a897aa0f6d 100644 (file)
@@ -35,6 +35,7 @@ int close(int fd);
 #include "driver.h"
 #include "eloop.h"
 #include "common/ieee802_11_defs.h"
+#include "common/ieee802_11_common.h"
 #include "driver_ndis.h"
 
 int wpa_driver_register_event_cb(struct wpa_driver_ndis_data *drv);
@@ -780,20 +781,7 @@ static int wpa_driver_ndis_scan(void *priv,
 
 static const u8 * wpa_scan_get_ie(const struct wpa_scan_res *res, u8 ie)
 {
-       const u8 *end, *pos;
-
-       pos = (const u8 *) (res + 1);
-       end = pos + res->ie_len;
-
-       while (end - pos > 1) {
-               if (2 + pos[1] > end - pos)
-                       break;
-               if (pos[0] == ie)
-                       return pos;
-               pos += 2 + pos[1];
-       }
-
-       return NULL;
+       return get_ie((const u8 *) (res + 1), res->ie_len, ie);
 }