diff options
author | Johannes Berg <johannes.berg@intel.com> | 2013-02-21 11:36:01 -0500 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-03-06 10:35:47 -0500 |
commit | ee2aca343c9aa64d277a75a5df043299dc84cfd9 (patch) | |
tree | 697ac55d4d0119e97ead3a530ebac8cf37922f78 /net/wireless/nl80211.c | |
parent | c8bb93f5f5d478a01db66127844d1d2dd30abec7 (diff) |
cfg80211: add ability to override VHT capabilities
For testing it's sometimes useful to be able to
override certain VHT capability advertisement,
add the ability to do that in cfg80211.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/nl80211.c')
-rw-r--r-- | net/wireless/nl80211.c | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 0e5176784b42..6a5893f5e481 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -371,6 +371,10 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = { | |||
371 | [NL80211_ATTR_STA_CAPABILITY] = { .type = NLA_U16 }, | 371 | [NL80211_ATTR_STA_CAPABILITY] = { .type = NLA_U16 }, |
372 | [NL80211_ATTR_STA_EXT_CAPABILITY] = { .type = NLA_BINARY, }, | 372 | [NL80211_ATTR_STA_EXT_CAPABILITY] = { .type = NLA_BINARY, }, |
373 | [NL80211_ATTR_SPLIT_WIPHY_DUMP] = { .type = NLA_FLAG, }, | 373 | [NL80211_ATTR_SPLIT_WIPHY_DUMP] = { .type = NLA_FLAG, }, |
374 | [NL80211_ATTR_DISABLE_VHT] = { .type = NLA_FLAG }, | ||
375 | [NL80211_ATTR_VHT_CAPABILITY_MASK] = { | ||
376 | .len = NL80211_VHT_CAPABILITY_LEN, | ||
377 | }, | ||
374 | }; | 378 | }; |
375 | 379 | ||
376 | /* policy for the key attributes */ | 380 | /* policy for the key attributes */ |
@@ -1522,6 +1526,12 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, | |||
1522 | dev->wiphy.extended_capabilities_mask))) | 1526 | dev->wiphy.extended_capabilities_mask))) |
1523 | goto nla_put_failure; | 1527 | goto nla_put_failure; |
1524 | 1528 | ||
1529 | if (dev->wiphy.vht_capa_mod_mask && | ||
1530 | nla_put(msg, NL80211_ATTR_VHT_CAPABILITY_MASK, | ||
1531 | sizeof(*dev->wiphy.vht_capa_mod_mask), | ||
1532 | dev->wiphy.vht_capa_mod_mask)) | ||
1533 | goto nla_put_failure; | ||
1534 | |||
1525 | /* done */ | 1535 | /* done */ |
1526 | *split_start = 0; | 1536 | *split_start = 0; |
1527 | break; | 1537 | break; |
@@ -5982,6 +5992,8 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info) | |||
5982 | u32 flags = 0; | 5992 | u32 flags = 0; |
5983 | struct ieee80211_ht_cap *ht_capa = NULL; | 5993 | struct ieee80211_ht_cap *ht_capa = NULL; |
5984 | struct ieee80211_ht_cap *ht_capa_mask = NULL; | 5994 | struct ieee80211_ht_cap *ht_capa_mask = NULL; |
5995 | struct ieee80211_vht_cap *vht_capa = NULL; | ||
5996 | struct ieee80211_vht_cap *vht_capa_mask = NULL; | ||
5985 | 5997 | ||
5986 | if (!is_valid_ie_attr(info->attrs[NL80211_ATTR_IE])) | 5998 | if (!is_valid_ie_attr(info->attrs[NL80211_ATTR_IE])) |
5987 | return -EINVAL; | 5999 | return -EINVAL; |
@@ -6038,12 +6050,25 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info) | |||
6038 | ht_capa = nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY]); | 6050 | ht_capa = nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY]); |
6039 | } | 6051 | } |
6040 | 6052 | ||
6053 | if (nla_get_flag(info->attrs[NL80211_ATTR_DISABLE_VHT])) | ||
6054 | flags |= ASSOC_REQ_DISABLE_VHT; | ||
6055 | |||
6056 | if (info->attrs[NL80211_ATTR_VHT_CAPABILITY_MASK]) | ||
6057 | vht_capa_mask = | ||
6058 | nla_data(info->attrs[NL80211_ATTR_VHT_CAPABILITY_MASK]); | ||
6059 | |||
6060 | if (info->attrs[NL80211_ATTR_VHT_CAPABILITY]) { | ||
6061 | if (!vht_capa_mask) | ||
6062 | return -EINVAL; | ||
6063 | vht_capa = nla_data(info->attrs[NL80211_ATTR_VHT_CAPABILITY]); | ||
6064 | } | ||
6065 | |||
6041 | err = nl80211_crypto_settings(rdev, info, &crypto, 1); | 6066 | err = nl80211_crypto_settings(rdev, info, &crypto, 1); |
6042 | if (!err) | 6067 | if (!err) |
6043 | err = cfg80211_mlme_assoc(rdev, dev, chan, bssid, prev_bssid, | 6068 | err = cfg80211_mlme_assoc(rdev, dev, chan, bssid, prev_bssid, |
6044 | ssid, ssid_len, ie, ie_len, use_mfp, | 6069 | ssid, ssid_len, ie, ie_len, use_mfp, |
6045 | &crypto, flags, ht_capa, | 6070 | &crypto, flags, ht_capa, ht_capa_mask, |
6046 | ht_capa_mask); | 6071 | vht_capa, vht_capa_mask); |
6047 | 6072 | ||
6048 | return err; | 6073 | return err; |
6049 | } | 6074 | } |
@@ -6623,6 +6648,24 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) | |||
6623 | sizeof(connect.ht_capa)); | 6648 | sizeof(connect.ht_capa)); |
6624 | } | 6649 | } |
6625 | 6650 | ||
6651 | if (nla_get_flag(info->attrs[NL80211_ATTR_DISABLE_VHT])) | ||
6652 | connect.flags |= ASSOC_REQ_DISABLE_VHT; | ||
6653 | |||
6654 | if (info->attrs[NL80211_ATTR_VHT_CAPABILITY_MASK]) | ||
6655 | memcpy(&connect.vht_capa_mask, | ||
6656 | nla_data(info->attrs[NL80211_ATTR_VHT_CAPABILITY_MASK]), | ||
6657 | sizeof(connect.vht_capa_mask)); | ||
6658 | |||
6659 | if (info->attrs[NL80211_ATTR_VHT_CAPABILITY]) { | ||
6660 | if (!info->attrs[NL80211_ATTR_VHT_CAPABILITY_MASK]) { | ||
6661 | kfree(connkeys); | ||
6662 | return -EINVAL; | ||
6663 | } | ||
6664 | memcpy(&connect.vht_capa, | ||
6665 | nla_data(info->attrs[NL80211_ATTR_VHT_CAPABILITY]), | ||
6666 | sizeof(connect.vht_capa)); | ||
6667 | } | ||
6668 | |||
6626 | err = cfg80211_connect(rdev, dev, &connect, connkeys); | 6669 | err = cfg80211_connect(rdev, dev, &connect, connkeys); |
6627 | if (err) | 6670 | if (err) |
6628 | kfree(connkeys); | 6671 | kfree(connkeys); |