nl80211/cfg80211: Add crypto settings into NEW_BEACON
PATCH 2/3 nl80211/cfg80211: Add crypto settings into NEW_BEACON
This removes need from drivers to parse the beacon tail/head data to figure out what crypto settings are to be used in AP mode in case the Beacon and Probe Response frames are fully constructed in the driver/firmware.
Signed-off-by Jouni Malinen <[email protected]>
--- include/linux/nl80211.h | 25 ++++++++++------- include/net/cfg80211.h | 66 +++++++++++++++++++++++++--------------------- net/wireless/nl80211.c | 21 +++++++++++++++ 3 files changed, 72 insertions(+), 40 deletions(-)
include/linux/nl80211.h +15 -10
@@ -163,7 +163,10 @@* %NL80211_ATTR_BEACON_HEAD and %NL80211_ATTR_BEACON_TAIL attributes. * Following attributes are provided for drivers that generate full Beacon * and Probe Response frames internally: %NL80211_ATTR_SSID, -* %NL80211_ATTR_HIDDEN_SSID. +* %NL80211_ATTR_HIDDEN_SSID, %NL80211_ATTR_CIPHERS_PAIRWISE, +* %NL80211_ATTR_CIPHER_GROUP, %NL80211_ATTR_WPA_VERSIONS, +* %NL80211_ATTR_AKM_SUITES, %NL80211_ATTR_PRIVACY, +* %NL80211_ATTR_AUTH_TYPE. * @NL80211_CMD_NEW_BEACON: add a new beacon to an access point interface, * parameters are like for %NL80211_CMD_SET_BEACON. * @NL80211_CMD_DEL_BEACON: remove the beacon, stop sending it
@@ -845,18 +848,20 @@ enum nl80211_commands {* @NL80211_ATTR_STATUS_CODE: StatusCode for the %NL80211_CMD_CONNECT * event (u16) * @NL80211_ATTR_PRIVACY: Flag attribute, used with connect(), indicating -* that protected APs should be used. +* that protected APs should be used. This is also used with NEW_BEACON to +* indicate that the BSS is to use protection. * -* @NL80211_ATTR_CIPHERS_PAIRWISE: Used with CONNECT and ASSOCIATE to -* indicate which unicast key ciphers will be used with the connection +* @NL80211_ATTR_CIPHERS_PAIRWISE: Used with CONNECT, ASSOCIATE, and NEW_BEACON +* to indicate which unicast key ciphers will be used with the connection * (an array of u32). -* @NL80211_ATTR_CIPHER_GROUP: Used with CONNECT and ASSOCIATE to indicate -* which group key cipher will be used with the connection (a u32). -* @NL80211_ATTR_WPA_VERSIONS: Used with CONNECT and ASSOCIATE to indicate -* which WPA version(s) the AP we want to associate with is using +* @NL80211_ATTR_CIPHER_GROUP: Used with CONNECT, ASSOCIATE, and NEW_BEACON to +* indicate which group key cipher will be used with the connection (a +* u32). +* @NL80211_ATTR_WPA_VERSIONS: Used with CONNECT, ASSOCIATE, and NEW_BEACON to +* indicate which WPA version(s) the AP we want to associate with is using * (a u32 with flags from &enum nl80211_wpa_versions). -* @NL80211_ATTR_AKM_SUITES: Used with CONNECT and ASSOCIATE to indicate -* which key management algorithm(s) to use (an array of u32). +* @NL80211_ATTR_AKM_SUITES: Used with CONNECT, ASSOCIATE, and NEW_BEACON to +* indicate which key management algorithm(s) to use (an array of u32). * * @NL80211_ATTR_REQ_IE: (Re)association request information elements as * sent out by the card, for ROAM and successful CONNECT events.
include/net/cfg80211.h +36 -30
90 lines not on this page · raw message
net/wireless/nl80211.c +21 -0
@@ -23,6 +23,12 @@#include "nl80211.h" #include "reg.h" +static bool nl80211_valid_auth_type (enum nl80211_auth_type auth_type); +static int nl80211_crypto_settings (struct cfg80211_registered_device *rdev, +struct genl_info *info, +struct cfg80211_crypto_settings *settings, +int cipher_limit); +static int nl80211_pre_doit (struct genl_ops *ops,struct sk_buff *skb,struct genl_info *info); static void nl80211_post_doit(struct genl_ops *ops, struct sk_buff *skb,
@@ -2039,6 +2045,21 @@ static int nl80211_addset_beacon(struct sk_buff *skb, struct genl_info *info)return -EINVAL ; } + params.privacy = !!info->attrs[NL80211_ATTR_PRIVACY ]; + +if (info->attrs[NL80211_ATTR_AUTH_TYPE ]) { + params.auth_type =nla_get_u32 ( + info->attrs[NL80211_ATTR_AUTH_TYPE ]); +if (!nl80211_valid_auth_type (params.auth_type)) +return -EINVAL ; + }else + params.auth_type =NL80211_AUTHTYPE_AUTOMATIC ; + + err =nl80211_crypto_settings (rdev, info, ¶ms.crypto, +NL80211_MAX_NR_CIPHER_SUITES ); +if (err) +return err; + call = rdev->ops->add_beacon;break ;case NL80211_CMD_SET_BEACON :
Signature · 5 lines
1.7.4.1 -- Jouni Malinen PGP id EFC895FA