aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/scan.c
diff options
context:
space:
mode:
authorAvraham Stern <avraham.stern@intel.com>2016-02-15 14:53:17 (GMT)
committerJouni Malinen <j@w1.fi>2016-02-21 15:14:56 (GMT)
commit231b04b6cbe876006c6291a5a0cb7bfd8380f943 (patch)
tree472561be289861bf42eb3664e79734ea6bffc924 /wpa_supplicant/scan.c
parentea69d9737cfdf42610ad8134b05ecbf9daf1c289 (diff)
downloadhostap-231b04b6cbe876006c6291a5a0cb7bfd8380f943.zip
hostap-231b04b6cbe876006c6291a5a0cb7bfd8380f943.tar.gz
hostap-231b04b6cbe876006c6291a5a0cb7bfd8380f943.tar.bz2
utils: Share a single helper function to get IE by ID
Add a helper function to find a certain IE inside IEs buffer by ID and use this function in several places that implemented similar functionality locally. Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Diffstat (limited to 'wpa_supplicant/scan.c')
-rw-r--r--wpa_supplicant/scan.c15
1 files changed, 1 insertions, 14 deletions
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index f4f2c20..30bec2c 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -1535,20 +1535,7 @@ static int wpa_scan_get_max_rate(const struct wpa_scan_res *res)
*/
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);
}