diff options
Diffstat (limited to 'net/wireless/scan.c')
| -rw-r--r-- | net/wireless/scan.c | 66 | 
1 files changed, 40 insertions, 26 deletions
| diff --git a/net/wireless/scan.c b/net/wireless/scan.c index 11c68b159324..22e92be61938 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c @@ -383,7 +383,7 @@ static bool is_bss(struct cfg80211_bss *a, const u8 *bssid,  		   const u8 *ssid, size_t ssid_len)  {  	const struct cfg80211_bss_ies *ies; -	const u8 *ssidie; +	const struct element *ssid_elem;  	if (bssid && !ether_addr_equal(a->bssid, bssid))  		return false; @@ -394,12 +394,12 @@ static bool is_bss(struct cfg80211_bss *a, const u8 *bssid,  	ies = rcu_access_pointer(a->ies);  	if (!ies)  		return false; -	ssidie = cfg80211_find_ie(WLAN_EID_SSID, ies->data, ies->len); -	if (!ssidie) +	ssid_elem = cfg80211_find_elem(WLAN_EID_SSID, ies->data, ies->len); +	if (!ssid_elem)  		return false; -	if (ssidie[1] != ssid_len) +	if (ssid_elem->datalen != ssid_len)  		return false; -	return memcmp(ssidie + 2, ssid, ssid_len) == 0; +	return memcmp(ssid_elem->data, ssid, ssid_len) == 0;  }  static int @@ -418,14 +418,17 @@ cfg80211_add_nontrans_list(struct cfg80211_bss *trans_bss,  	}  	ssid_len = ssid[1];  	ssid = ssid + 2; -	rcu_read_unlock();  	/* check if nontrans_bss is in the list */  	list_for_each_entry(bss, &trans_bss->nontrans_list, nontrans_list) { -		if (is_bss(bss, nontrans_bss->bssid, ssid, ssid_len)) +		if (is_bss(bss, nontrans_bss->bssid, ssid, ssid_len)) { +			rcu_read_unlock();  			return 0; +		}  	} +	rcu_read_unlock(); +  	/* add to the list */  	list_add_tail(&nontrans_bss->nontrans_list, &trans_bss->nontrans_list);  	return 0; @@ -1791,25 +1794,13 @@ cfg80211_bss_update(struct cfg80211_registered_device *rdev,  	return NULL;  } -/* - * Update RX channel information based on the available frame payload - * information. This is mainly for the 2.4 GHz band where frames can be received - * from neighboring channels and the Beacon frames use the DSSS Parameter Set - * element to indicate the current (transmitting) channel, but this might also - * be needed on other bands if RX frequency does not match with the actual - * operating channel of a BSS. - */ -static struct ieee80211_channel * -cfg80211_get_bss_channel(struct wiphy *wiphy, const u8 *ie, size_t ielen, -			 struct ieee80211_channel *channel, -			 enum nl80211_bss_scan_width scan_width) +int cfg80211_get_ies_channel_number(const u8 *ie, size_t ielen, +				    enum nl80211_band band)  {  	const u8 *tmp; -	u32 freq;  	int channel_number = -1; -	struct ieee80211_channel *alt_channel; -	if (channel->band == NL80211_BAND_S1GHZ) { +	if (band == NL80211_BAND_S1GHZ) {  		tmp = cfg80211_find_ie(WLAN_EID_S1G_OPERATION, ie, ielen);  		if (tmp && tmp[1] >= sizeof(struct ieee80211_s1g_oper_ie)) {  			struct ieee80211_s1g_oper_ie *s1gop = (void *)(tmp + 2); @@ -1830,6 +1821,29 @@ cfg80211_get_bss_channel(struct wiphy *wiphy, const u8 *ie, size_t ielen,  		}  	} +	return channel_number; +} +EXPORT_SYMBOL(cfg80211_get_ies_channel_number); + +/* + * Update RX channel information based on the available frame payload + * information. This is mainly for the 2.4 GHz band where frames can be received + * from neighboring channels and the Beacon frames use the DSSS Parameter Set + * element to indicate the current (transmitting) channel, but this might also + * be needed on other bands if RX frequency does not match with the actual + * operating channel of a BSS. + */ +static struct ieee80211_channel * +cfg80211_get_bss_channel(struct wiphy *wiphy, const u8 *ie, size_t ielen, +			 struct ieee80211_channel *channel, +			 enum nl80211_bss_scan_width scan_width) +{ +	u32 freq; +	int channel_number; +	struct ieee80211_channel *alt_channel; + +	channel_number = cfg80211_get_ies_channel_number(ie, ielen, channel->band); +  	if (channel_number < 0) {  		/* No channel information in frame payload */  		return channel; @@ -2072,12 +2086,12 @@ static void cfg80211_parse_mbssid_data(struct wiphy *wiphy,  	if (!non_tx_data)  		return; -	if (!cfg80211_find_ie(WLAN_EID_MULTIPLE_BSSID, ie, ielen)) +	if (!cfg80211_find_elem(WLAN_EID_MULTIPLE_BSSID, ie, ielen))  		return;  	if (!wiphy->support_mbssid)  		return;  	if (wiphy->support_only_he_mbssid && -	    !cfg80211_find_ext_ie(WLAN_EID_EXT_HE_CAPABILITY, ie, ielen)) +	    !cfg80211_find_ext_elem(WLAN_EID_EXT_HE_CAPABILITY, ie, ielen))  		return;  	new_ie = kmalloc(IEEE80211_MAX_DATA_LEN, gfp); @@ -2444,10 +2458,10 @@ cfg80211_inform_bss_frame_data(struct wiphy *wiphy,  	res = cfg80211_inform_single_bss_frame_data(wiphy, data, mgmt,  						    len, gfp);  	if (!res || !wiphy->support_mbssid || -	    !cfg80211_find_ie(WLAN_EID_MULTIPLE_BSSID, ie, ielen)) +	    !cfg80211_find_elem(WLAN_EID_MULTIPLE_BSSID, ie, ielen))  		return res;  	if (wiphy->support_only_he_mbssid && -	    !cfg80211_find_ext_ie(WLAN_EID_EXT_HE_CAPABILITY, ie, ielen)) +	    !cfg80211_find_ext_elem(WLAN_EID_EXT_HE_CAPABILITY, ie, ielen))  		return res;  	non_tx_data.tx_bss = res; |