2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-14 08:13:56 +08:00

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>
This commit is contained in:
Emmanuel Grumbach 2016-05-03 16:08:07 +03:00 committed by Johannes Berg
parent f631a77ba9
commit 9e9ea43905
2 changed files with 8 additions and 4 deletions

View File

@ -3893,7 +3893,7 @@ const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len);
* cfg80211_find_vendor_ie - find vendor specific information element in data * cfg80211_find_vendor_ie - find vendor specific information element in data
* *
* @oui: vendor OUI * @oui: vendor OUI
* @oui_type: vendor-specific OUI type * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
* @ies: data consisting of IEs * @ies: data consisting of IEs
* @len: length of data * @len: length of data
* *
@ -3905,7 +3905,7 @@ const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len);
* Note: There are no checks on the element length other than having to fit into * Note: There are no checks on the element length other than having to fit into
* the given data. * the given data.
*/ */
const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type, const u8 *cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
const u8 *ies, int len); const u8 *ies, int len);
/** /**

View File

@ -364,13 +364,16 @@ const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
} }
EXPORT_SYMBOL(cfg80211_find_ie); EXPORT_SYMBOL(cfg80211_find_ie);
const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type, const u8 *cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
const u8 *ies, int len) const u8 *ies, int len)
{ {
struct ieee80211_vendor_ie *ie; struct ieee80211_vendor_ie *ie;
const u8 *pos = ies, *end = ies + len; const u8 *pos = ies, *end = ies + len;
int ie_oui; int ie_oui;
if (WARN_ON(oui_type > 0xff))
return NULL;
while (pos < end) { while (pos < end) {
pos = cfg80211_find_ie(WLAN_EID_VENDOR_SPECIFIC, pos, pos = cfg80211_find_ie(WLAN_EID_VENDOR_SPECIFIC, pos,
end - pos); end - pos);
@ -386,7 +389,8 @@ const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type,
goto cont; goto cont;
ie_oui = ie->oui[0] << 16 | ie->oui[1] << 8 | ie->oui[2]; ie_oui = ie->oui[0] << 16 | ie->oui[1] << 8 | ie->oui[2];
if (ie_oui == oui && ie->oui_type == oui_type) if (ie_oui == oui &&
(oui_type < 0 || ie->oui_type == oui_type))
return pos; return pos;
cont: cont:
pos += 2 + ie->len; pos += 2 + ie->len;