aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2016-05-03 09:08:07 -0400
committerJohannes Berg <johannes.berg@intel.com>2016-05-12 05:15:42 -0400
commit9e9ea43905597d9ba79b421b87c7851b8350717c (patch)
tree575e79ad116adda4309dc00c298bb9079642acb7 /net/wireless
parentf631a77ba920f7153a1094d09cd8f2ebbffd0328 (diff)
cfg80211: allow finding vendor with OUI without specifying the OUI type
This allows finding vendor IE from a specific vendor. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/scan.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index abdf651a70d9..ef2955c89a00 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -364,13 +364,16 @@ const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
364} 364}
365EXPORT_SYMBOL(cfg80211_find_ie); 365EXPORT_SYMBOL(cfg80211_find_ie);
366 366
367const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type, 367const u8 *cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
368 const u8 *ies, int len) 368 const u8 *ies, int len)
369{ 369{
370 struct ieee80211_vendor_ie *ie; 370 struct ieee80211_vendor_ie *ie;
371 const u8 *pos = ies, *end = ies + len; 371 const u8 *pos = ies, *end = ies + len;
372 int ie_oui; 372 int ie_oui;
373 373
374 if (WARN_ON(oui_type > 0xff))
375 return NULL;
376
374 while (pos < end) { 377 while (pos < end) {
375 pos = cfg80211_find_ie(WLAN_EID_VENDOR_SPECIFIC, pos, 378 pos = cfg80211_find_ie(WLAN_EID_VENDOR_SPECIFIC, pos,
376 end - pos); 379 end - pos);
@@ -386,7 +389,8 @@ const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type,
386 goto cont; 389 goto cont;
387 390
388 ie_oui = ie->oui[0] << 16 | ie->oui[1] << 8 | ie->oui[2]; 391 ie_oui = ie->oui[0] << 16 | ie->oui[1] << 8 | ie->oui[2];
389 if (ie_oui == oui && ie->oui_type == oui_type) 392 if (ie_oui == oui &&
393 (oui_type < 0 || ie->oui_type == oui_type))
390 return pos; 394 return pos;
391cont: 395cont:
392 pos += 2 + ie->len; 396 pos += 2 + ie->len;