diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-07-02 11:18:40 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-07-10 15:01:53 -0400 |
commit | 517357c685ccc4b5783cc7dbdae8824ada19a97f (patch) | |
tree | 1e3532ca39233dd59b106011788f68a21ffc88c4 /net | |
parent | 0eb14647fc6b56f73efb28a72ca0c7cc03a653f9 (diff) |
cfg80211: assimilate and export ieee80211_bss_get_ie
This function from mac80211 seems generally useful, and
I will need it in cfg80211 soon.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/mlme.c | 25 | ||||
-rw-r--r-- | net/wireless/util.c | 21 |
2 files changed, 24 insertions, 22 deletions
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 | ||
49 | static 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 | |||
69 | static int ieee80211_compatible_rates(struct ieee80211_bss *bss, | 49 | static 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 | } |
504 | EXPORT_SYMBOL(cfg80211_classify8021d); | 504 | EXPORT_SYMBOL(cfg80211_classify8021d); |
505 | |||
506 | const 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 | } | ||
525 | EXPORT_SYMBOL(ieee80211_bss_get_ie); | ||