aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/cfg80211.h12
-rw-r--r--net/wireless/scan.c10
2 files changed, 19 insertions, 3 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index f1d21570e6cb..c0d1f5b708c5 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -785,7 +785,17 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
785struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, 785struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
786 struct ieee80211_channel *channel, 786 struct ieee80211_channel *channel,
787 const u8 *bssid, 787 const u8 *bssid,
788 const u8 *ssid, size_t ssid_len); 788 const u8 *ssid, size_t ssid_len,
789 u16 capa_mask, u16 capa_val);
790static inline struct cfg80211_bss *
791cfg80211_get_ibss(struct wiphy *wiphy,
792 struct ieee80211_channel *channel,
793 const u8 *ssid, size_t ssid_len)
794{
795 return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
796 WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS);
797}
798
789struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy, 799struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
790 struct ieee80211_channel *channel, 800 struct ieee80211_channel *channel,
791 const u8 *meshid, size_t meshidlen, 801 const u8 *meshid, size_t meshidlen,
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index aacccc9ab6ca..b1893c863b97 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -116,9 +116,12 @@ static bool is_bss(struct cfg80211_bss *a,
116{ 116{
117 const u8 *ssidie; 117 const u8 *ssidie;
118 118
119 if (compare_ether_addr(a->bssid, bssid)) 119 if (bssid && compare_ether_addr(a->bssid, bssid))
120 return false; 120 return false;
121 121
122 if (!ssid)
123 return true;
124
122 ssidie = find_ie(WLAN_EID_SSID, 125 ssidie = find_ie(WLAN_EID_SSID,
123 a->information_elements, 126 a->information_elements,
124 a->len_information_elements); 127 a->len_information_elements);
@@ -199,7 +202,8 @@ static int cmp_bss(struct cfg80211_bss *a,
199struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, 202struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
200 struct ieee80211_channel *channel, 203 struct ieee80211_channel *channel,
201 const u8 *bssid, 204 const u8 *bssid,
202 const u8 *ssid, size_t ssid_len) 205 const u8 *ssid, size_t ssid_len,
206 u16 capa_mask, u16 capa_val)
203{ 207{
204 struct cfg80211_registered_device *dev = wiphy_to_dev(wiphy); 208 struct cfg80211_registered_device *dev = wiphy_to_dev(wiphy);
205 struct cfg80211_internal_bss *bss, *res = NULL; 209 struct cfg80211_internal_bss *bss, *res = NULL;
@@ -207,6 +211,8 @@ struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
207 spin_lock_bh(&dev->bss_lock); 211 spin_lock_bh(&dev->bss_lock);
208 212
209 list_for_each_entry(bss, &dev->bss_list, list) { 213 list_for_each_entry(bss, &dev->bss_list, list) {
214 if ((bss->pub.capability & capa_mask) != capa_val)
215 continue;
210 if (channel && bss->pub.channel != channel) 216 if (channel && bss->pub.channel != channel)
211 continue; 217 continue;
212 if (is_bss(&bss->pub, bssid, ssid, ssid_len)) { 218 if (is_bss(&bss->pub, bssid, ssid, ssid_len)) {