From: Jouni Malinen Date: Sun, 21 Feb 2016 15:07:47 +0000 (+0200) Subject: ndis: Use the new get_ie() helper to avoid duplicated code X-Git-Tag: hostap_2_6~863 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a15995819a27bee9285a0a3c3a6c853d1e9af680;p=thirdparty%2Fhostap.git ndis: Use the new get_ie() helper to avoid duplicated code This removes more duplicated implementation of finding the first IE based on the id. Signed-off-by: Jouni Malinen --- diff --git a/src/drivers/driver_ndis.c b/src/drivers/driver_ndis.c index fd32134c7..9440f0127 100644 --- a/src/drivers/driver_ndis.c +++ b/src/drivers/driver_ndis.c @@ -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); }