aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/cfg80211.h9
-rw-r--r--net/mac80211/mlme.c25
-rw-r--r--net/wireless/util.c21
3 files changed, 33 insertions, 22 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index fe87819954a5..eb026541f928 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -605,6 +605,15 @@ struct cfg80211_bss {
605}; 605};
606 606
607/** 607/**
608 * ieee80211_bss_get_ie - find IE with given ID
609 * @bss: the bss to search
610 * @ie: the IE ID
611 * Returns %NULL if not found.
612 */
613const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
614
615
616/**
608 * struct cfg80211_crypto_settings - Crypto settings 617 * struct cfg80211_crypto_settings - Crypto settings
609 * @wpa_versions: indicates which, if any, WPA versions are enabled 618 * @wpa_versions: indicates which, if any, WPA versions are enabled
610 * (from enum nl80211_wpa_versions) 619 * (from enum nl80211_wpa_versions)
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 2d9b6663253c..5748cda659c2 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -46,26 +46,6 @@ static int ecw2cw(int ecw)
46 return (1 << ecw) - 1; 46 return (1 << ecw) - 1;
47} 47}
48 48
49static u8 *ieee80211_bss_get_ie(struct ieee80211_bss *bss, u8 ie)
50{
51 u8 *end, *pos;
52
53 pos = bss->cbss.information_elements;
54 if (pos == NULL)
55 return NULL;
56 end = pos + bss->cbss.len_information_elements;
57
58 while (pos + 1 < end) {
59 if (pos + 2 + pos[1] > end)
60 break;
61 if (pos[0] == ie)
62 return pos;
63 pos += 2 + pos[1];
64 }
65
66 return NULL;
67}
68
69static int ieee80211_compatible_rates(struct ieee80211_bss *bss, 49static int ieee80211_compatible_rates(struct ieee80211_bss *bss,
70 struct ieee80211_supported_band *sband, 50 struct ieee80211_supported_band *sband,
71 u32 *rates) 51 u32 *rates)
@@ -181,7 +161,8 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)
181 struct ieee80211_local *local = sdata->local; 161 struct ieee80211_local *local = sdata->local;
182 struct sk_buff *skb; 162 struct sk_buff *skb;
183 struct ieee80211_mgmt *mgmt; 163 struct ieee80211_mgmt *mgmt;
184 u8 *pos, *ies, *ht_ie; 164 u8 *pos;
165 const u8 *ies, *ht_ie;
185 int i, len, count, rates_len, supp_rates_len; 166 int i, len, count, rates_len, supp_rates_len;
186 u16 capab; 167 u16 capab;
187 struct ieee80211_bss *bss; 168 struct ieee80211_bss *bss;
@@ -345,7 +326,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)
345 */ 326 */
346 if (wmm && (ifmgd->flags & IEEE80211_STA_WMM_ENABLED) && 327 if (wmm && (ifmgd->flags & IEEE80211_STA_WMM_ENABLED) &&
347 sband->ht_cap.ht_supported && 328 sband->ht_cap.ht_supported &&
348 (ht_ie = ieee80211_bss_get_ie(bss, WLAN_EID_HT_INFORMATION)) && 329 (ht_ie = ieee80211_bss_get_ie(&bss->cbss, WLAN_EID_HT_INFORMATION)) &&
349 ht_ie[1] >= sizeof(struct ieee80211_ht_info) && 330 ht_ie[1] >= sizeof(struct ieee80211_ht_info) &&
350 (!(ifmgd->flags & IEEE80211_STA_DISABLE_11N))) { 331 (!(ifmgd->flags & IEEE80211_STA_DISABLE_11N))) {
351 struct ieee80211_ht_info *ht_info = 332 struct ieee80211_ht_info *ht_info =
diff --git a/net/wireless/util.c b/net/wireless/util.c
index 25550692dda6..28f8f96801d4 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -502,3 +502,24 @@ unsigned int cfg80211_classify8021d(struct sk_buff *skb)
502 return dscp >> 5; 502 return dscp >> 5;
503} 503}
504EXPORT_SYMBOL(cfg80211_classify8021d); 504EXPORT_SYMBOL(cfg80211_classify8021d);
505
506const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie)
507{
508 u8 *end, *pos;
509
510 pos = bss->information_elements;
511 if (pos == NULL)
512 return NULL;
513 end = pos + bss->len_information_elements;
514
515 while (pos + 1 < end) {
516 if (pos + 2 + pos[1] > end)
517 break;
518 if (pos[0] == ie)
519 return pos;
520 pos += 2 + pos[1];
521 }
522
523 return NULL;
524}
525EXPORT_SYMBOL(ieee80211_bss_get_ie);