Skip to content

Commit 9e9ea43

Browse files
egrumbachjmberg-intel
authored andcommitted
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 <[email protected]> Signed-off-by: Luca Coelho <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
1 parent f631a77 commit 9e9ea43

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

include/net/cfg80211.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3893,7 +3893,7 @@ const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len);
38933893
* cfg80211_find_vendor_ie - find vendor specific information element in data
38943894
*
38953895
* @oui: vendor OUI
3896-
* @oui_type: vendor-specific OUI type
3896+
* @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
38973897
* @ies: data consisting of IEs
38983898
* @len: length of data
38993899
*
@@ -3905,7 +3905,7 @@ const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len);
39053905
* Note: There are no checks on the element length other than having to fit into
39063906
* the given data.
39073907
*/
3908-
const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type,
3908+
const u8 *cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
39093909
const u8 *ies, int len);
39103910

39113911
/**

net/wireless/scan.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,13 +364,16 @@ const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
364364
}
365365
EXPORT_SYMBOL(cfg80211_find_ie);
366366

367-
const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type,
367+
const u8 *cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
368368
const u8 *ies, int len)
369369
{
370370
struct ieee80211_vendor_ie *ie;
371371
const u8 *pos = ies, *end = ies + len;
372372
int ie_oui;
373373

374+
if (WARN_ON(oui_type > 0xff))
375+
return NULL;
376+
374377
while (pos < end) {
375378
pos = cfg80211_find_ie(WLAN_EID_VENDOR_SPECIFIC, pos,
376379
end - pos);
@@ -386,7 +389,8 @@ const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type,
386389
goto cont;
387390

388391
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))
390394
return pos;
391395
cont:
392396
pos += 2 + ie->len;

0 commit comments

Comments
 (0)