aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-03-31 12:12:05 +0200
committerJohn W. Linville <linville@tuxdriver.com>2009-04-22 16:54:39 -0400
commit18a8365992a8041aa178ae9ad5f0d951d0457230 (patch)
treecb7a461139269feb191e5f5d03c4438cfa9335f2 /net
parentath5k: sparse fix ath5k_led_on needs to be static (diff)
downloadlinux-dev-18a8365992a8041aa178ae9ad5f0d951d0457230.tar.xz
linux-dev-18a8365992a8041aa178ae9ad5f0d951d0457230.zip
cfg80211: introduce scan IE limit attribute
This patch introduces a new attribute for a wiphy that tells userspace how long the information elements added to a probe request frame can be at most. It also updates the at76 to advertise that it cannot support that, and, for now until I can fix that, iwlwifi too. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/main.c13
-rw-r--r--net/mac80211/util.c2
-rw-r--r--net/wireless/nl80211.c7
3 files changed, 21 insertions, 1 deletions
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index fbcbed6cad01..ee58a7873699 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -728,7 +728,18 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
return NULL;
wiphy->privid = mac80211_wiphy_privid;
- wiphy->max_scan_ssids = 4;
+
+ if (!ops->hw_scan) {
+ /* For hw_scan, driver needs to set these up. */
+ wiphy->max_scan_ssids = 4;
+
+ /* we support a maximum of 32 rates in cfg80211 */
+ wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN
+ - 2 - 32 /* SSID */
+ - 4 - 32 /* (ext) supp rates */;
+
+ }
+
/* Yes, putting cfg80211_bss into ieee80211_bss is a hack */
wiphy->bss_priv_size = sizeof(struct ieee80211_bss) -
sizeof(struct cfg80211_bss);
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index fdf432f14554..05caf34f31da 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -890,6 +890,8 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
*pos = rate->bitrate / 5;
}
+ /* if adding more here, adjust max_scan_ie_len */
+
if (ie)
memcpy(skb_put(skb, ie_len), ie, ie_len);
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 1394115cde95..447fa1790b4e 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -181,6 +181,8 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags,
NLA_PUT_STRING(msg, NL80211_ATTR_WIPHY_NAME, wiphy_name(&dev->wiphy));
NLA_PUT_U8(msg, NL80211_ATTR_MAX_NUM_SCAN_SSIDS,
dev->wiphy.max_scan_ssids);
+ NLA_PUT_U16(msg, NL80211_ATTR_MAX_SCAN_IE_LEN,
+ dev->wiphy.max_scan_ie_len);
nl_modes = nla_nest_start(msg, NL80211_ATTR_SUPPORTED_IFTYPES);
if (!nl_modes)
@@ -2528,6 +2530,11 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
else
ie_len = 0;
+ if (ie_len > wiphy->max_scan_ie_len) {
+ err = -EINVAL;
+ goto out;
+ }
+
request = kzalloc(sizeof(*request)
+ sizeof(*ssid) * n_ssids
+ sizeof(channel) * n_channels