aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2009-09-11 13:36:59 (GMT)
committerJouni Malinen <j@w1.fi>2009-09-11 13:36:59 (GMT)
commitabad3ccb1e78faed242883d55d540fd4bb70c106 (patch)
tree58ca64da881d977fda30305ed65036e275232d6c /hostapd
parent630a843f59da496d1413d8d79a4ee7165796bdd2 (diff)
downloadhostap-abad3ccb1e78faed242883d55d540fd4bb70c106.zip
hostap-abad3ccb1e78faed242883d55d540fd4bb70c106.tar.gz
hostap-abad3ccb1e78faed242883d55d540fd4bb70c106.tar.bz2
Convert WPS IE concat routine to a generic helper
This may also be needed in wpa_supplicant and potentially for other IE types, too.
Diffstat (limited to 'hostapd')
-rw-r--r--hostapd/wps_hostapd.c33
1 files changed, 2 insertions, 31 deletions
diff --git a/hostapd/wps_hostapd.c b/hostapd/wps_hostapd.c
index 5ecf3a4..42568cd 100644
--- a/hostapd/wps_hostapd.c
+++ b/hostapd/wps_hostapd.c
@@ -20,6 +20,7 @@
#include "uuid.h"
#include "wpa_ctrl.h"
#include "ieee802_11_defs.h"
+#include "ieee802_11_common.h"
#include "sta_info.h"
#include "eapol_sm.h"
#include "wps/wps.h"
@@ -793,44 +794,14 @@ static void hostapd_wps_probe_req_rx(void *ctx, const u8 *addr,
{
struct hostapd_data *hapd = ctx;
struct wpabuf *wps_ie;
- const u8 *end, *pos, *wps;
if (hapd->wps == NULL)
return;
- pos = ie;
- end = ie + ie_len;
- wps = NULL;
-
- while (pos + 1 < end) {
- if (pos + 2 + pos[1] > end)
- return;
- if (pos[0] == WLAN_EID_VENDOR_SPECIFIC && pos[1] >= 4 &&
- WPA_GET_BE32(&pos[2]) == WPS_DEV_OUI_WFA) {
- wps = pos;
- break;
- }
- pos += 2 + pos[1];
- }
-
- if (wps == NULL)
- return; /* No WPS IE in Probe Request */
-
- wps_ie = wpabuf_alloc(ie_len);
+ wps_ie = ieee802_11_vendor_ie_concat(ie, ie_len, WPS_DEV_OUI_WFA);
if (wps_ie == NULL)
return;
- /* There may be multiple WPS IEs in the message, so need to concatenate
- * their WPS Data fields */
- while (pos + 1 < end) {
- if (pos + 2 + pos[1] > end)
- break;
- if (pos[0] == WLAN_EID_VENDOR_SPECIFIC && pos[1] >= 4 &&
- WPA_GET_BE32(&pos[2]) == WPS_DEV_OUI_WFA)
- wpabuf_put_data(wps_ie, pos + 6, pos[1] - 4);
- pos += 2 + pos[1];
- }
-
if (wpabuf_len(wps_ie) > 0) {
wps_registrar_probe_req_rx(hapd->wps->registrar, addr, wps_ie);
#ifdef CONFIG_WPS_UPNP