cfg80211: allow finding vendor with OUI without specifying the OUI type
[cascardo/linux.git] / net / wireless / scan.c
index 50ea8e3..ef2955c 100644 (file)
@@ -364,13 +364,16 @@ const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
 }
 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)
 {
        struct ieee80211_vendor_ie *ie;
        const u8 *pos = ies, *end = ies + len;
        int ie_oui;
 
+       if (WARN_ON(oui_type > 0xff))
+               return NULL;
+
        while (pos < end) {
                pos = cfg80211_find_ie(WLAN_EID_VENDOR_SPECIFIC, pos,
                                       end - pos);
@@ -386,7 +389,8 @@ const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type,
                        goto cont;
 
                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;
 cont:
                pos += 2 + ie->len;
@@ -531,7 +535,7 @@ static int cmp_bss(struct cfg80211_bss *a,
 }
 
 static bool cfg80211_bss_type_match(u16 capability,
-                                   enum ieee80211_band band,
+                                   enum nl80211_band band,
                                    enum ieee80211_bss_type bss_type)
 {
        bool ret = true;
@@ -540,7 +544,7 @@ static bool cfg80211_bss_type_match(u16 capability,
        if (bss_type == IEEE80211_BSS_TYPE_ANY)
                return ret;
 
-       if (band == IEEE80211_BAND_60GHZ) {
+       if (band == NL80211_BAND_60GHZ) {
                mask = WLAN_CAPABILITY_DMG_TYPE_MASK;
                switch (bss_type) {
                case IEEE80211_BSS_TYPE_ESS:
@@ -1006,7 +1010,7 @@ cfg80211_inform_bss_data(struct wiphy *wiphy,
        if (!res)
                return NULL;
 
-       if (channel->band == IEEE80211_BAND_60GHZ) {
+       if (channel->band == NL80211_BAND_60GHZ) {
                bss_type = res->pub.capability & WLAN_CAPABILITY_DMG_TYPE_MASK;
                if (bss_type == WLAN_CAPABILITY_DMG_TYPE_AP ||
                    bss_type == WLAN_CAPABILITY_DMG_TYPE_PBSS)
@@ -1089,7 +1093,7 @@ cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
        if (!res)
                return NULL;
 
-       if (channel->band == IEEE80211_BAND_60GHZ) {
+       if (channel->band == NL80211_BAND_60GHZ) {
                bss_type = res->pub.capability & WLAN_CAPABILITY_DMG_TYPE_MASK;
                if (bss_type == WLAN_CAPABILITY_DMG_TYPE_AP ||
                    bss_type == WLAN_CAPABILITY_DMG_TYPE_PBSS)
@@ -1185,7 +1189,7 @@ int cfg80211_wext_siwscan(struct net_device *dev,
        struct iw_scan_req *wreq = NULL;
        struct cfg80211_scan_request *creq = NULL;
        int i, err, n_channels = 0;
-       enum ieee80211_band band;
+       enum nl80211_band band;
 
        if (!netif_running(dev))
                return -ENETDOWN;
@@ -1229,7 +1233,7 @@ int cfg80211_wext_siwscan(struct net_device *dev,
 
        /* translate "Scan on frequencies" request */
        i = 0;
-       for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+       for (band = 0; band < NUM_NL80211_BANDS; band++) {
                int j;
 
                if (!wiphy->bands[band])
@@ -1289,7 +1293,7 @@ int cfg80211_wext_siwscan(struct net_device *dev,
                        creq->n_ssids = 0;
        }
 
-       for (i = 0; i < IEEE80211_NUM_BANDS; i++)
+       for (i = 0; i < NUM_NL80211_BANDS; i++)
                if (wiphy->bands[i])
                        creq->rates[i] = (1 << wiphy->bands[i]->n_bitrates) - 1;