aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2011-08-10 16:54:35 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-08-12 13:45:04 -0400
commit5fb628e9105eef6796789b1ae93289e1566ccdf0 (patch)
tree3d1e9eef06be596bdd0ab936b8527202afac42e7
parent32e9de846be885444358b67267f837088c05e0c2 (diff)
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 <jouni@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--include/linux/nl80211.h25
-rw-r--r--include/net/cfg80211.h66
-rw-r--r--net/wireless/nl80211.c21
3 files changed, 72 insertions, 40 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 227ee9a0ff1a..580fcdceed2c 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -163,7 +163,10 @@
163 * %NL80211_ATTR_BEACON_HEAD and %NL80211_ATTR_BEACON_TAIL attributes. 163 * %NL80211_ATTR_BEACON_HEAD and %NL80211_ATTR_BEACON_TAIL attributes.
164 * Following attributes are provided for drivers that generate full Beacon 164 * Following attributes are provided for drivers that generate full Beacon
165 * and Probe Response frames internally: %NL80211_ATTR_SSID, 165 * and Probe Response frames internally: %NL80211_ATTR_SSID,
166 * %NL80211_ATTR_HIDDEN_SSID. 166 * %NL80211_ATTR_HIDDEN_SSID, %NL80211_ATTR_CIPHERS_PAIRWISE,
167 * %NL80211_ATTR_CIPHER_GROUP, %NL80211_ATTR_WPA_VERSIONS,
168 * %NL80211_ATTR_AKM_SUITES, %NL80211_ATTR_PRIVACY,
169 * %NL80211_ATTR_AUTH_TYPE.
167 * @NL80211_CMD_NEW_BEACON: add a new beacon to an access point interface, 170 * @NL80211_CMD_NEW_BEACON: add a new beacon to an access point interface,
168 * parameters are like for %NL80211_CMD_SET_BEACON. 171 * parameters are like for %NL80211_CMD_SET_BEACON.
169 * @NL80211_CMD_DEL_BEACON: remove the beacon, stop sending it 172 * @NL80211_CMD_DEL_BEACON: remove the beacon, stop sending it
@@ -845,18 +848,20 @@ enum nl80211_commands {
845 * @NL80211_ATTR_STATUS_CODE: StatusCode for the %NL80211_CMD_CONNECT 848 * @NL80211_ATTR_STATUS_CODE: StatusCode for the %NL80211_CMD_CONNECT
846 * event (u16) 849 * event (u16)
847 * @NL80211_ATTR_PRIVACY: Flag attribute, used with connect(), indicating 850 * @NL80211_ATTR_PRIVACY: Flag attribute, used with connect(), indicating
848 * that protected APs should be used. 851 * that protected APs should be used. This is also used with NEW_BEACON to
852 * indicate that the BSS is to use protection.
849 * 853 *
850 * @NL80211_ATTR_CIPHERS_PAIRWISE: Used with CONNECT and ASSOCIATE to 854 * @NL80211_ATTR_CIPHERS_PAIRWISE: Used with CONNECT, ASSOCIATE, and NEW_BEACON
851 * indicate which unicast key ciphers will be used with the connection 855 * to indicate which unicast key ciphers will be used with the connection
852 * (an array of u32). 856 * (an array of u32).
853 * @NL80211_ATTR_CIPHER_GROUP: Used with CONNECT and ASSOCIATE to indicate 857 * @NL80211_ATTR_CIPHER_GROUP: Used with CONNECT, ASSOCIATE, and NEW_BEACON to
854 * which group key cipher will be used with the connection (a u32). 858 * indicate which group key cipher will be used with the connection (a
855 * @NL80211_ATTR_WPA_VERSIONS: Used with CONNECT and ASSOCIATE to indicate 859 * u32).
856 * which WPA version(s) the AP we want to associate with is using 860 * @NL80211_ATTR_WPA_VERSIONS: Used with CONNECT, ASSOCIATE, and NEW_BEACON to
861 * indicate which WPA version(s) the AP we want to associate with is using
857 * (a u32 with flags from &enum nl80211_wpa_versions). 862 * (a u32 with flags from &enum nl80211_wpa_versions).
858 * @NL80211_ATTR_AKM_SUITES: Used with CONNECT and ASSOCIATE to indicate 863 * @NL80211_ATTR_AKM_SUITES: Used with CONNECT, ASSOCIATE, and NEW_BEACON to
859 * which key management algorithm(s) to use (an array of u32). 864 * indicate which key management algorithm(s) to use (an array of u32).
860 * 865 *
861 * @NL80211_ATTR_REQ_IE: (Re)association request information elements as 866 * @NL80211_ATTR_REQ_IE: (Re)association request information elements as
862 * sent out by the card, for ROAM and successful CONNECT events. 867 * sent out by the card, for ROAM and successful CONNECT events.
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 9ee93e7f0e31..6fcd0bf4dc62 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -334,6 +334,36 @@ struct survey_info {
334}; 334};
335 335
336/** 336/**
337 * struct cfg80211_crypto_settings - Crypto settings
338 * @wpa_versions: indicates which, if any, WPA versions are enabled
339 * (from enum nl80211_wpa_versions)
340 * @cipher_group: group key cipher suite (or 0 if unset)
341 * @n_ciphers_pairwise: number of AP supported unicast ciphers
342 * @ciphers_pairwise: unicast key cipher suites
343 * @n_akm_suites: number of AKM suites
344 * @akm_suites: AKM suites
345 * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
346 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
347 * required to assume that the port is unauthorized until authorized by
348 * user space. Otherwise, port is marked authorized by default.
349 * @control_port_ethertype: the control port protocol that should be
350 * allowed through even on unauthorized ports
351 * @control_port_no_encrypt: TRUE to prevent encryption of control port
352 * protocol frames.
353 */
354struct cfg80211_crypto_settings {
355 u32 wpa_versions;
356 u32 cipher_group;
357 int n_ciphers_pairwise;
358 u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
359 int n_akm_suites;
360 u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
361 bool control_port;
362 __be16 control_port_ethertype;
363 bool control_port_no_encrypt;
364};
365
366/**
337 * struct beacon_parameters - beacon parameters 367 * struct beacon_parameters - beacon parameters
338 * 368 *
339 * Used to configure the beacon for an interface. 369 * Used to configure the beacon for an interface.
@@ -350,6 +380,9 @@ struct survey_info {
350 * user space) 380 * user space)
351 * @ssid_len: length of @ssid 381 * @ssid_len: length of @ssid
352 * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames 382 * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
383 * @crypto: crypto settings
384 * @privacy: the BSS uses privacy
385 * @auth_type: Authentication type (algorithm)
353 */ 386 */
354struct beacon_parameters { 387struct beacon_parameters {
355 u8 *head, *tail; 388 u8 *head, *tail;
@@ -358,6 +391,9 @@ struct beacon_parameters {
358 const u8 *ssid; 391 const u8 *ssid;
359 size_t ssid_len; 392 size_t ssid_len;
360 enum nl80211_hidden_ssid hidden_ssid; 393 enum nl80211_hidden_ssid hidden_ssid;
394 struct cfg80211_crypto_settings crypto;
395 bool privacy;
396 enum nl80211_auth_type auth_type;
361}; 397};
362 398
363/** 399/**
@@ -913,36 +949,6 @@ const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
913 949
914 950
915/** 951/**
916 * struct cfg80211_crypto_settings - Crypto settings
917 * @wpa_versions: indicates which, if any, WPA versions are enabled
918 * (from enum nl80211_wpa_versions)
919 * @cipher_group: group key cipher suite (or 0 if unset)
920 * @n_ciphers_pairwise: number of AP supported unicast ciphers
921 * @ciphers_pairwise: unicast key cipher suites
922 * @n_akm_suites: number of AKM suites
923 * @akm_suites: AKM suites
924 * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
925 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
926 * required to assume that the port is unauthorized until authorized by
927 * user space. Otherwise, port is marked authorized by default.
928 * @control_port_ethertype: the control port protocol that should be
929 * allowed through even on unauthorized ports
930 * @control_port_no_encrypt: TRUE to prevent encryption of control port
931 * protocol frames.
932 */
933struct cfg80211_crypto_settings {
934 u32 wpa_versions;
935 u32 cipher_group;
936 int n_ciphers_pairwise;
937 u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
938 int n_akm_suites;
939 u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
940 bool control_port;
941 __be16 control_port_ethertype;
942 bool control_port_no_encrypt;
943};
944
945/**
946 * struct cfg80211_auth_request - Authentication request data 952 * struct cfg80211_auth_request - Authentication request data
947 * 953 *
948 * This structure provides information needed to complete IEEE 802.11 954 * This structure provides information needed to complete IEEE 802.11
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index fbb63d3ddc78..6e57a3afb609 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -23,6 +23,12 @@
23#include "nl80211.h" 23#include "nl80211.h"
24#include "reg.h" 24#include "reg.h"
25 25
26static bool nl80211_valid_auth_type(enum nl80211_auth_type auth_type);
27static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev,
28 struct genl_info *info,
29 struct cfg80211_crypto_settings *settings,
30 int cipher_limit);
31
26static int nl80211_pre_doit(struct genl_ops *ops, struct sk_buff *skb, 32static int nl80211_pre_doit(struct genl_ops *ops, struct sk_buff *skb,
27 struct genl_info *info); 33 struct genl_info *info);
28static void nl80211_post_doit(struct genl_ops *ops, struct sk_buff *skb, 34static 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)
2039 return -EINVAL; 2045 return -EINVAL;
2040 } 2046 }
2041 2047
2048 params.privacy = !!info->attrs[NL80211_ATTR_PRIVACY];
2049
2050 if (info->attrs[NL80211_ATTR_AUTH_TYPE]) {
2051 params.auth_type = nla_get_u32(
2052 info->attrs[NL80211_ATTR_AUTH_TYPE]);
2053 if (!nl80211_valid_auth_type(params.auth_type))
2054 return -EINVAL;
2055 } else
2056 params.auth_type = NL80211_AUTHTYPE_AUTOMATIC;
2057
2058 err = nl80211_crypto_settings(rdev, info, &params.crypto,
2059 NL80211_MAX_NR_CIPHER_SUITES);
2060 if (err)
2061 return err;
2062
2042 call = rdev->ops->add_beacon; 2063 call = rdev->ops->add_beacon;
2043 break; 2064 break;
2044 case NL80211_CMD_SET_BEACON: 2065 case NL80211_CMD_SET_BEACON: