aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-03-31 06:12:05 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-04-22 16:54:39 -0400
commit18a8365992a8041aa178ae9ad5f0d951d0457230 (patch)
treecb7a461139269feb191e5f5d03c4438cfa9335f2
parent75c2148fa5330c6de741fc96e3308f57d846a6b4 (diff)
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>
-rw-r--r--drivers/net/wireless/at76c50x-usb.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c1
-rw-r--r--include/linux/nl80211.h4
-rw-r--r--include/net/wireless.h1
-rw-r--r--net/mac80211/main.c13
-rw-r--r--net/mac80211/util.c2
-rw-r--r--net/wireless/nl80211.c7
7 files changed, 28 insertions, 1 deletions
diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c
index 69248ded5102..55f947ac56d1 100644
--- a/drivers/net/wireless/at76c50x-usb.c
+++ b/drivers/net/wireless/at76c50x-usb.c
@@ -2250,6 +2250,7 @@ static int at76_init_new_device(struct at76_priv *priv,
2250 2250
2251 /* mac80211 initialisation */ 2251 /* mac80211 initialisation */
2252 priv->hw->wiphy->max_scan_ssids = 1; 2252 priv->hw->wiphy->max_scan_ssids = 1;
2253 priv->hw->wiphy->max_scan_ie_len = 0;
2253 priv->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); 2254 priv->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
2254 priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &at76_supported_band; 2255 priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &at76_supported_band;
2255 priv->hw->flags = IEEE80211_HW_RX_INCLUDES_FCS | 2256 priv->hw->flags = IEEE80211_HW_RX_INCLUDES_FCS |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 82abb1f9087f..ef55f91374a1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -1306,6 +1306,7 @@ int iwl_setup_mac(struct iwl_priv *priv)
1306 1306
1307 hw->wiphy->custom_regulatory = true; 1307 hw->wiphy->custom_regulatory = true;
1308 hw->wiphy->max_scan_ssids = 1; 1308 hw->wiphy->max_scan_ssids = 1;
1309 hw->wiphy->max_scan_ie_len = 0; /* XXX for now */
1309 1310
1310 /* Default value; 4 EDCA QOS priorities */ 1311 /* Default value; 4 EDCA QOS priorities */
1311 hw->queues = 4; 1312 hw->queues = 4;
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 27f230f063b3..209cacee5285 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -390,6 +390,8 @@ enum nl80211_commands {
390 * 390 *
391 * @NL80211_ATTR_MAX_NUM_SCAN_SSIDS: number of SSIDs you can scan with 391 * @NL80211_ATTR_MAX_NUM_SCAN_SSIDS: number of SSIDs you can scan with
392 * a single scan request, a wiphy attribute. 392 * a single scan request, a wiphy attribute.
393 * @NL80211_ATTR_MAX_SCAN_IE_LEN: maximum length of information elements
394 * that can be added to a scan request
393 * 395 *
394 * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz) 396 * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz)
395 * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive 397 * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive
@@ -507,6 +509,8 @@ enum nl80211_attrs {
507 509
508 NL80211_ATTR_KEY_TYPE, 510 NL80211_ATTR_KEY_TYPE,
509 511
512 NL80211_ATTR_MAX_SCAN_IE_LEN,
513
510 /* add attributes here, update the policy in nl80211.c */ 514 /* add attributes here, update the policy in nl80211.c */
511 515
512 __NL80211_ATTR_AFTER_LAST, 516 __NL80211_ATTR_AFTER_LAST,
diff --git a/include/net/wireless.h b/include/net/wireless.h
index 64a76208580c..2bcdeda46d81 100644
--- a/include/net/wireless.h
+++ b/include/net/wireless.h
@@ -222,6 +222,7 @@ struct wiphy {
222 222
223 int bss_priv_size; 223 int bss_priv_size;
224 u8 max_scan_ssids; 224 u8 max_scan_ssids;
225 u16 max_scan_ie_len;
225 226
226 /* If multiple wiphys are registered and you're handed e.g. 227 /* If multiple wiphys are registered and you're handed e.g.
227 * a regular netdev with assigned ieee80211_ptr, you won't 228 * a regular netdev with assigned ieee80211_ptr, you won't
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,
728 return NULL; 728 return NULL;
729 729
730 wiphy->privid = mac80211_wiphy_privid; 730 wiphy->privid = mac80211_wiphy_privid;
731 wiphy->max_scan_ssids = 4; 731
732 if (!ops->hw_scan) {
733 /* For hw_scan, driver needs to set these up. */
734 wiphy->max_scan_ssids = 4;
735
736 /* we support a maximum of 32 rates in cfg80211 */
737 wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN
738 - 2 - 32 /* SSID */
739 - 4 - 32 /* (ext) supp rates */;
740
741 }
742
732 /* Yes, putting cfg80211_bss into ieee80211_bss is a hack */ 743 /* Yes, putting cfg80211_bss into ieee80211_bss is a hack */
733 wiphy->bss_priv_size = sizeof(struct ieee80211_bss) - 744 wiphy->bss_priv_size = sizeof(struct ieee80211_bss) -
734 sizeof(struct cfg80211_bss); 745 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,
890 *pos = rate->bitrate / 5; 890 *pos = rate->bitrate / 5;
891 } 891 }
892 892
893 /* if adding more here, adjust max_scan_ie_len */
894
893 if (ie) 895 if (ie)
894 memcpy(skb_put(skb, ie_len), ie, ie_len); 896 memcpy(skb_put(skb, ie_len), ie, ie_len);
895 897
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,
181 NLA_PUT_STRING(msg, NL80211_ATTR_WIPHY_NAME, wiphy_name(&dev->wiphy)); 181 NLA_PUT_STRING(msg, NL80211_ATTR_WIPHY_NAME, wiphy_name(&dev->wiphy));
182 NLA_PUT_U8(msg, NL80211_ATTR_MAX_NUM_SCAN_SSIDS, 182 NLA_PUT_U8(msg, NL80211_ATTR_MAX_NUM_SCAN_SSIDS,
183 dev->wiphy.max_scan_ssids); 183 dev->wiphy.max_scan_ssids);
184 NLA_PUT_U16(msg, NL80211_ATTR_MAX_SCAN_IE_LEN,
185 dev->wiphy.max_scan_ie_len);
184 186
185 nl_modes = nla_nest_start(msg, NL80211_ATTR_SUPPORTED_IFTYPES); 187 nl_modes = nla_nest_start(msg, NL80211_ATTR_SUPPORTED_IFTYPES);
186 if (!nl_modes) 188 if (!nl_modes)
@@ -2528,6 +2530,11 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
2528 else 2530 else
2529 ie_len = 0; 2531 ie_len = 0;
2530 2532
2533 if (ie_len > wiphy->max_scan_ie_len) {
2534 err = -EINVAL;
2535 goto out;
2536 }
2537
2531 request = kzalloc(sizeof(*request) 2538 request = kzalloc(sizeof(*request)
2532 + sizeof(*ssid) * n_ssids 2539 + sizeof(*ssid) * n_ssids
2533 + sizeof(channel) * n_channels 2540 + sizeof(channel) * n_channels