diff options
author | Sujith Manoharan <c_manoha@qti.qualcomm.com> | 2012-10-18 00:49:28 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2012-10-18 03:26:44 -0400 |
commit | de7044ee85a9ba9e8529b0250f2882724407c977 (patch) | |
tree | 2886d1451d77134306ea57d51744b30cfcdf86cb /net/wireless | |
parent | f53c6a0d74dffd6e82defe195bd5b97c7d384341 (diff) |
cfg80211: Disallow HT/WEP in IBSS mode
Currently, a user is allowed to choose a HT operating channel
with WEP when creating an IBSS network. WEP is not allowed
in HT configuration - this patch ensures that such requests
are denied.
Signed-off-by: Sujith Manoharan <c_manoha@qti.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/nl80211.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 9e5a7206b0b4..48d754c9adb8 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -692,7 +692,7 @@ static int nl80211_parse_key(struct genl_info *info, struct key_parse *k) | |||
692 | 692 | ||
693 | static struct cfg80211_cached_keys * | 693 | static struct cfg80211_cached_keys * |
694 | nl80211_parse_connkeys(struct cfg80211_registered_device *rdev, | 694 | nl80211_parse_connkeys(struct cfg80211_registered_device *rdev, |
695 | struct nlattr *keys) | 695 | struct nlattr *keys, bool *no_ht) |
696 | { | 696 | { |
697 | struct key_parse parse; | 697 | struct key_parse parse; |
698 | struct nlattr *key; | 698 | struct nlattr *key; |
@@ -735,6 +735,12 @@ nl80211_parse_connkeys(struct cfg80211_registered_device *rdev, | |||
735 | result->params[parse.idx].key_len = parse.p.key_len; | 735 | result->params[parse.idx].key_len = parse.p.key_len; |
736 | result->params[parse.idx].key = result->data[parse.idx]; | 736 | result->params[parse.idx].key = result->data[parse.idx]; |
737 | memcpy(result->data[parse.idx], parse.p.key, parse.p.key_len); | 737 | memcpy(result->data[parse.idx], parse.p.key, parse.p.key_len); |
738 | |||
739 | if (parse.p.cipher == WLAN_CIPHER_SUITE_WEP40 || | ||
740 | parse.p.cipher == WLAN_CIPHER_SUITE_WEP104) { | ||
741 | if (no_ht) | ||
742 | *no_ht = true; | ||
743 | } | ||
738 | } | 744 | } |
739 | 745 | ||
740 | return result; | 746 | return result; |
@@ -5406,10 +5412,18 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info) | |||
5406 | return -EINVAL; | 5412 | return -EINVAL; |
5407 | 5413 | ||
5408 | if (ibss.privacy && info->attrs[NL80211_ATTR_KEYS]) { | 5414 | if (ibss.privacy && info->attrs[NL80211_ATTR_KEYS]) { |
5415 | bool no_ht = false; | ||
5416 | |||
5409 | connkeys = nl80211_parse_connkeys(rdev, | 5417 | connkeys = nl80211_parse_connkeys(rdev, |
5410 | info->attrs[NL80211_ATTR_KEYS]); | 5418 | info->attrs[NL80211_ATTR_KEYS], |
5419 | &no_ht); | ||
5411 | if (IS_ERR(connkeys)) | 5420 | if (IS_ERR(connkeys)) |
5412 | return PTR_ERR(connkeys); | 5421 | return PTR_ERR(connkeys); |
5422 | |||
5423 | if ((ibss.channel_type != NL80211_CHAN_NO_HT) && no_ht) { | ||
5424 | kfree(connkeys); | ||
5425 | return -EINVAL; | ||
5426 | } | ||
5413 | } | 5427 | } |
5414 | 5428 | ||
5415 | ibss.control_port = | 5429 | ibss.control_port = |
@@ -5710,7 +5724,7 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) | |||
5710 | 5724 | ||
5711 | if (connect.privacy && info->attrs[NL80211_ATTR_KEYS]) { | 5725 | if (connect.privacy && info->attrs[NL80211_ATTR_KEYS]) { |
5712 | connkeys = nl80211_parse_connkeys(rdev, | 5726 | connkeys = nl80211_parse_connkeys(rdev, |
5713 | info->attrs[NL80211_ATTR_KEYS]); | 5727 | info->attrs[NL80211_ATTR_KEYS], NULL); |
5714 | if (IS_ERR(connkeys)) | 5728 | if (IS_ERR(connkeys)) |
5715 | return PTR_ERR(connkeys); | 5729 | return PTR_ERR(connkeys); |
5716 | } | 5730 | } |