summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-02-10 20:25:59 (GMT)
committerJohn W. Linville <linville@tuxdriver.com>2009-02-13 18:45:56 (GMT)
commit79420f09e76e8e1dd1149d6ce9c20e06cbb5802a (patch)
tree42adcb9fa34682629050778fa1c2b4d3382b6469
parentd491af19db3adcc1eb1653e60a427fb4df36f361 (diff)
downloadlinux-79420f09e76e8e1dd1149d6ce9c20e06cbb5802a.tar.xz
cfg80211: add more flexible BSS lookup
Add a more flexible BSS lookup function so that mac80211 or other drivers can actually use this for getting the BSS to connect to. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-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 f1d2157..c0d1f5b 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -785,7 +785,17 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
struct ieee80211_channel *channel,
const u8 *bssid,
- const u8 *ssid, size_t ssid_len);
+ const u8 *ssid, size_t ssid_len,
+ u16 capa_mask, u16 capa_val);
+static inline struct cfg80211_bss *
+cfg80211_get_ibss(struct wiphy *wiphy,
+ struct ieee80211_channel *channel,
+ const u8 *ssid, size_t ssid_len)
+{
+ return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
+ WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS);
+}
+
struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
struct ieee80211_channel *channel,
const u8 *meshid, size_t meshidlen,
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index aacccc9..b1893c8 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -116,9 +116,12 @@ static bool is_bss(struct cfg80211_bss *a,
{
const u8 *ssidie;
- if (compare_ether_addr(a->bssid, bssid))
+ if (bssid && compare_ether_addr(a->bssid, bssid))
return false;
+ if (!ssid)
+ return true;
+
ssidie = find_ie(WLAN_EID_SSID,
a->information_elements,
a->len_information_elements);
@@ -199,7 +202,8 @@ static int cmp_bss(struct cfg80211_bss *a,
struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
struct ieee80211_channel *channel,
const u8 *bssid,
- const u8 *ssid, size_t ssid_len)
+ const u8 *ssid, size_t ssid_len,
+ u16 capa_mask, u16 capa_val)
{
struct cfg80211_registered_device *dev = wiphy_to_dev(wiphy);
struct cfg80211_internal_bss *bss, *res = NULL;
@@ -207,6 +211,8 @@ struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
spin_lock_bh(&dev->bss_lock);
list_for_each_entry(bss, &dev->bss_list, list) {
+ if ((bss->pub.capability & capa_mask) != capa_val)
+ continue;
if (channel && bss->pub.channel != channel)
continue;
if (is_bss(&bss->pub, bssid, ssid, ssid_len)) {