Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Johannes Berg and committed by
John W. Linville
517357c6 0eb14647

+33 -22
+9
include/net/cfg80211.h
··· 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 + */ 613 + const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie); 614 + 615 + 616 + /** 608 617 * struct cfg80211_crypto_settings - Crypto settings 609 618 * @wpa_versions: indicates which, if any, WPA versions are enabled 610 619 * (from enum nl80211_wpa_versions)
+3 -22
net/mac80211/mlme.c
··· 46 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 49 static int ieee80211_compatible_rates(struct ieee80211_bss *bss, 70 50 struct ieee80211_supported_band *sband, 71 51 u32 *rates) ··· 161 181 struct ieee80211_local *local = sdata->local; 162 182 struct sk_buff *skb; 163 183 struct ieee80211_mgmt *mgmt; 164 - u8 *pos, *ies, *ht_ie; 184 + u8 *pos; 185 + const u8 *ies, *ht_ie; 165 186 int i, len, count, rates_len, supp_rates_len; 166 187 u16 capab; 167 188 struct ieee80211_bss *bss; ··· 326 345 */ 327 346 if (wmm && (ifmgd->flags & IEEE80211_STA_WMM_ENABLED) && 328 347 sband->ht_cap.ht_supported && 329 - (ht_ie = ieee80211_bss_get_ie(bss, WLAN_EID_HT_INFORMATION)) && 348 + (ht_ie = ieee80211_bss_get_ie(&bss->cbss, WLAN_EID_HT_INFORMATION)) && 330 349 ht_ie[1] >= sizeof(struct ieee80211_ht_info) && 331 350 (!(ifmgd->flags & IEEE80211_STA_DISABLE_11N))) { 332 351 struct ieee80211_ht_info *ht_info =
+21
net/wireless/util.c
··· 502 502 return dscp >> 5; 503 503 } 504 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);