[PATCH 03/26] wpa_supplicant: Add wpa_bss_get_vendor_ie_subtype()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add wpa_bss_get_vendor_ie_subtype() that can be used to
fetch a vendor IE with a specific type and subtype.

Signed-off-by: Ilan Peer <ilan.peer@xxxxxxxxx>
---
 wpa_supplicant/bss.c | 28 ++++++++++++++++++++++++++++
 wpa_supplicant/bss.h |  2 ++
 2 files changed, 30 insertions(+)

diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c
index 24cc986..dcfa12f 100644
--- a/wpa_supplicant/bss.c
+++ b/wpa_supplicant/bss.c
@@ -1103,6 +1103,34 @@ const u8 * wpa_bss_get_vendor_ie_beacon(const struct wpa_bss *bss,
 
 
 /**
+ * wpa_bss_get_vendor_ie_subtype - Fetch an information element that is a
+ * subtype of a vendor information element from a BSS entry.
+ * @bss: BSS table entry
+ * @vendor_type: Vendor type (four octets starting the IE payload)
+ * @subtype: the requested subtype
+ * Returns: Pointer to the information element (id field) or %NULL if not found
+ */
+const u8 *wpa_bss_get_vendor_ie_subtype(const struct wpa_bss *bss,
+					u32 vendor_type, u32 subtype)
+{
+	const u8 *end, *pos;
+
+	pos = (const u8 *)(bss + 1);
+	end = pos + bss->ie_len;
+
+	while (pos + 1 < end) {
+		if (pos[0] == WLAN_EID_VENDOR_SPECIFIC && pos[1] >= 4 &&
+		    vendor_type == WPA_GET_BE24(&pos[2]) &&
+		    subtype == pos[5])
+			return pos;
+		pos += 2 + pos[1];
+	}
+
+	return NULL;
+}
+
+
+/**
  * wpa_bss_get_vendor_ie_multi - Fetch vendor IE data from a BSS entry
  * @bss: BSS table entry
  * @vendor_type: Vendor type (four octets starting the IE payload)
diff --git a/wpa_supplicant/bss.h b/wpa_supplicant/bss.h
index f7f72f3..d923598 100644
--- a/wpa_supplicant/bss.h
+++ b/wpa_supplicant/bss.h
@@ -134,6 +134,8 @@ const u8 * wpa_bss_get_ie(const struct wpa_bss *bss, u8 ie);
 const u8 * wpa_bss_get_vendor_ie(const struct wpa_bss *bss, u32 vendor_type);
 const u8 * wpa_bss_get_vendor_ie_beacon(const struct wpa_bss *bss,
 					u32 vendor_type);
+const u8 *wpa_bss_get_vendor_ie_subtype(const struct wpa_bss *bss,
+					u32 vendor_type, u32 subtype);
 struct wpabuf * wpa_bss_get_vendor_ie_multi(const struct wpa_bss *bss,
 					    u32 vendor_type);
 struct wpabuf * wpa_bss_get_vendor_ie_multi_beacon(const struct wpa_bss *bss,
-- 
1.9.1


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux