diff options
author | Jouni Malinen <j@w1.fi> | 2014-01-14 17:00:47 -0500 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2014-02-04 15:48:07 -0500 |
commit | 1df4a51082df6e5b0b8eb70df81885b9b4c9e6ec (patch) | |
tree | 32e2ae5bd55034770afe0250c58991db04df6747 /net | |
parent | 66e01cf99e0a9d0cbff21b0288c049654d5acf3e (diff) |
cfg80211: Allow BSS hint to be provided for connect
This clarifies the expected driver behavior on the older
NL80211_ATTR_MAC and NL80211_ATTR_WIPHY_FREQ attributes and adds a new
set of similar attributes with _HINT postfix to enable use of a
recommendation of the initial BSS to choose. This can be helpful for
some drivers that can avoid an additional full scan on connection
request if the information is provided to them (user space tools like
wpa_supplicant already has that information available based on earlier
scans).
In addition, this can be used to get more expected behavior for cases
where a specific BSS should be picked first based on operations like
Interworking network selection or WPS. These cases were already easily
addressed with drivers that leave BSS selection to user space, but there
was no convenient way to do this with drivers that take care of BSS
selection internally without using the NL80211_ATTR_MAC which is not
really desired since it is needed for other purposes to force the
association to remain with the same BSS.
Signed-off-by: Jouni Malinen <j@w1.fi>
[add const, fix policy]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/wireless/nl80211.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 7a742594916e..6e7d580ec645 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -382,6 +382,8 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = { | |||
382 | [NL80211_ATTR_VENDOR_DATA] = { .type = NLA_BINARY }, | 382 | [NL80211_ATTR_VENDOR_DATA] = { .type = NLA_BINARY }, |
383 | [NL80211_ATTR_QOS_MAP] = { .type = NLA_BINARY, | 383 | [NL80211_ATTR_QOS_MAP] = { .type = NLA_BINARY, |
384 | .len = IEEE80211_QOS_MAP_LEN_MAX }, | 384 | .len = IEEE80211_QOS_MAP_LEN_MAX }, |
385 | [NL80211_ATTR_MAC_HINT] = { .len = ETH_ALEN }, | ||
386 | [NL80211_ATTR_WIPHY_FREQ_HINT] = { .type = NLA_U32 }, | ||
385 | }; | 387 | }; |
386 | 388 | ||
387 | /* policy for the key attributes */ | 389 | /* policy for the key attributes */ |
@@ -6984,6 +6986,9 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) | |||
6984 | 6986 | ||
6985 | if (info->attrs[NL80211_ATTR_MAC]) | 6987 | if (info->attrs[NL80211_ATTR_MAC]) |
6986 | connect.bssid = nla_data(info->attrs[NL80211_ATTR_MAC]); | 6988 | connect.bssid = nla_data(info->attrs[NL80211_ATTR_MAC]); |
6989 | else if (info->attrs[NL80211_ATTR_MAC_HINT]) | ||
6990 | connect.bssid_hint = | ||
6991 | nla_data(info->attrs[NL80211_ATTR_MAC_HINT]); | ||
6987 | connect.ssid = nla_data(info->attrs[NL80211_ATTR_SSID]); | 6992 | connect.ssid = nla_data(info->attrs[NL80211_ATTR_SSID]); |
6988 | connect.ssid_len = nla_len(info->attrs[NL80211_ATTR_SSID]); | 6993 | connect.ssid_len = nla_len(info->attrs[NL80211_ATTR_SSID]); |
6989 | 6994 | ||
@@ -7008,6 +7013,14 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) | |||
7008 | if (!connect.channel || | 7013 | if (!connect.channel || |
7009 | connect.channel->flags & IEEE80211_CHAN_DISABLED) | 7014 | connect.channel->flags & IEEE80211_CHAN_DISABLED) |
7010 | return -EINVAL; | 7015 | return -EINVAL; |
7016 | } else if (info->attrs[NL80211_ATTR_WIPHY_FREQ_HINT]) { | ||
7017 | connect.channel_hint = | ||
7018 | ieee80211_get_channel(wiphy, | ||
7019 | nla_get_u32( | ||
7020 | info->attrs[NL80211_ATTR_WIPHY_FREQ_HINT])); | ||
7021 | if (!connect.channel_hint || | ||
7022 | connect.channel_hint->flags & IEEE80211_CHAN_DISABLED) | ||
7023 | return -EINVAL; | ||
7011 | } | 7024 | } |
7012 | 7025 | ||
7013 | if (connect.privacy && info->attrs[NL80211_ATTR_KEYS]) { | 7026 | if (connect.privacy && info->attrs[NL80211_ATTR_KEYS]) { |