Skip to content

Commit

Permalink
cfg80211: Disallow HT/WEP in IBSS mode
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sujith Manoharan authored and Johannes Berg committed Oct 18, 2012
1 parent f53c6a0 commit de7044e
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions net/wireless/nl80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ static int nl80211_parse_key(struct genl_info *info, struct key_parse *k)

static struct cfg80211_cached_keys *
nl80211_parse_connkeys(struct cfg80211_registered_device *rdev,
struct nlattr *keys)
struct nlattr *keys, bool *no_ht)
{
struct key_parse parse;
struct nlattr *key;
Expand Down Expand Up @@ -735,6 +735,12 @@ nl80211_parse_connkeys(struct cfg80211_registered_device *rdev,
result->params[parse.idx].key_len = parse.p.key_len;
result->params[parse.idx].key = result->data[parse.idx];
memcpy(result->data[parse.idx], parse.p.key, parse.p.key_len);

if (parse.p.cipher == WLAN_CIPHER_SUITE_WEP40 ||
parse.p.cipher == WLAN_CIPHER_SUITE_WEP104) {
if (no_ht)
*no_ht = true;
}
}

return result;
Expand Down Expand Up @@ -5406,10 +5412,18 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info)
return -EINVAL;

if (ibss.privacy && info->attrs[NL80211_ATTR_KEYS]) {
bool no_ht = false;

connkeys = nl80211_parse_connkeys(rdev,
info->attrs[NL80211_ATTR_KEYS]);
info->attrs[NL80211_ATTR_KEYS],
&no_ht);
if (IS_ERR(connkeys))
return PTR_ERR(connkeys);

if ((ibss.channel_type != NL80211_CHAN_NO_HT) && no_ht) {
kfree(connkeys);
return -EINVAL;
}
}

ibss.control_port =
Expand Down Expand Up @@ -5710,7 +5724,7 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info)

if (connect.privacy && info->attrs[NL80211_ATTR_KEYS]) {
connkeys = nl80211_parse_connkeys(rdev,
info->attrs[NL80211_ATTR_KEYS]);
info->attrs[NL80211_ATTR_KEYS], NULL);
if (IS_ERR(connkeys))
return PTR_ERR(connkeys);
}
Expand Down

0 comments on commit de7044e

Please sign in to comment.