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 <j@w1.fi>
This commit is contained in:
parent
231b04b6cb
commit
a15995819a
1 changed files with 2 additions and 14 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue