From: Johannes Berg <johannes@sipsolutions.net>
To: John Linville <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH 3/4] cfg80211: add more flexible BSS lookup
Date: Sat, 07 Feb 2009 16:08:49 +0100 [thread overview]
Message-ID: <20090207150935.196151941@sipsolutions.net> (raw)
In-Reply-To: 20090207150846.951229208@sipsolutions.net
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>
---
include/net/cfg80211.h | 12 +++++++++++-
net/wireless/scan.c | 10 ++++++++--
2 files changed, 19 insertions(+), 3 deletions(-)
--- wireless-testing.orig/include/net/cfg80211.h 2009-02-07 15:40:54.000000000 +0100
+++ wireless-testing/include/net/cfg80211.h 2009-02-07 15:41:28.000000000 +0100
@@ -785,7 +785,17 @@ cfg80211_inform_bss_frame(struct 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,
--- wireless-testing.orig/net/wireless/scan.c 2009-02-07 15:40:54.000000000 +0100
+++ wireless-testing/net/wireless/scan.c 2009-02-07 15:41:28.000000000 +0100
@@ -116,9 +116,12 @@ static bool is_bss(struct cfg80211_bss *
{
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 *
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(st
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)) {
--
next prev parent reply other threads:[~2009-02-07 15:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-07 15:08 [PATCH 0/4] mac80211/cfg80211 BSS handling improvements Johannes Berg
2009-02-07 15:08 ` [PATCH 1/4] mac80211: dont add BSS when creating IBSS Johannes Berg
2009-02-07 15:20 ` Alina Friedrichsen
2009-02-07 15:08 ` [PATCH 2/4] cfg80211: free_priv for BSS info Johannes Berg
2009-02-07 15:08 ` Johannes Berg [this message]
2009-02-07 15:08 ` [PATCH 4/4] mac80211: use cfg80211s BSS infrastructure Johannes Berg
2009-02-10 9:50 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090207150935.196151941@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.