diff options
author | Avinash Patil <patila@marvell.com> | 2012-05-08 21:30:26 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-05-16 12:46:36 -0400 |
commit | f752dcd52923b8de82881cf1269f0dc03dbd1088 (patch) | |
tree | 261d4fa07221e2074f24e83aa941b2b2991f42ee /drivers/net/wireless | |
parent | e568634ae7ac379661c90731d480e067929420a1 (diff) |
mwifiex: add WPA2 support for AP
1. Support for parsing security related parameters from
cfg80211_ap_settings in start_ap cfg80211 handler
2. Conversion of these security information into FW understandle TLVs
and setting into FW thru sys_config command
3. key management is done on host. This ensures that FW forwards EAPOL
key packets to host instead of processing on its own.
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Kiran Divekar <dkiran@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/mwifiex/cfg80211.c | 9 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/fw.h | 53 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/ioctl.h | 16 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/main.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/uap_cmd.c | 187 |
5 files changed, 268 insertions, 0 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index e7882e56950d..6c343218d9f0 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -950,6 +950,9 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy, | |||
950 | struct mwifiex_uap_bss_param *bss_cfg; | 950 | struct mwifiex_uap_bss_param *bss_cfg; |
951 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); | 951 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); |
952 | 952 | ||
953 | if (priv->bss_type != MWIFIEX_BSS_TYPE_UAP) | ||
954 | return -1; | ||
955 | |||
953 | bss_cfg = kzalloc(sizeof(struct mwifiex_uap_bss_param), GFP_KERNEL); | 956 | bss_cfg = kzalloc(sizeof(struct mwifiex_uap_bss_param), GFP_KERNEL); |
954 | if (!bss_cfg) | 957 | if (!bss_cfg) |
955 | return -ENOMEM; | 958 | return -ENOMEM; |
@@ -966,6 +969,12 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy, | |||
966 | bss_cfg->ssid.ssid_len = params->ssid_len; | 969 | bss_cfg->ssid.ssid_len = params->ssid_len; |
967 | } | 970 | } |
968 | 971 | ||
972 | if (mwifiex_set_secure_params(priv, bss_cfg, params)) { | ||
973 | kfree(bss_cfg); | ||
974 | wiphy_err(wiphy, "Failed to parse secuirty parameters!\n"); | ||
975 | return -1; | ||
976 | } | ||
977 | |||
969 | if (mwifiex_send_cmd_sync(priv, HostCmd_CMD_UAP_BSS_STOP, | 978 | if (mwifiex_send_cmd_sync(priv, HostCmd_CMD_UAP_BSS_STOP, |
970 | HostCmd_ACT_GEN_SET, 0, NULL)) { | 979 | HostCmd_ACT_GEN_SET, 0, NULL)) { |
971 | wiphy_err(wiphy, "Failed to stop the BSS\n"); | 980 | wiphy_err(wiphy, "Failed to stop the BSS\n"); |
diff --git a/drivers/net/wireless/mwifiex/fw.h b/drivers/net/wireless/mwifiex/fw.h index 77f82fc811e2..57fd0ca6e428 100644 --- a/drivers/net/wireless/mwifiex/fw.h +++ b/drivers/net/wireless/mwifiex/fw.h | |||
@@ -111,6 +111,9 @@ enum MWIFIEX_802_11_PRIVACY_FILTER { | |||
111 | #define TLV_TYPE_UAP_BEACON_PERIOD (PROPRIETARY_TLV_BASE_ID + 44) | 111 | #define TLV_TYPE_UAP_BEACON_PERIOD (PROPRIETARY_TLV_BASE_ID + 44) |
112 | #define TLV_TYPE_UAP_DTIM_PERIOD (PROPRIETARY_TLV_BASE_ID + 45) | 112 | #define TLV_TYPE_UAP_DTIM_PERIOD (PROPRIETARY_TLV_BASE_ID + 45) |
113 | #define TLV_TYPE_UAP_RTS_THRESHOLD (PROPRIETARY_TLV_BASE_ID + 51) | 113 | #define TLV_TYPE_UAP_RTS_THRESHOLD (PROPRIETARY_TLV_BASE_ID + 51) |
114 | #define TLV_TYPE_UAP_WPA_PASSPHRASE (PROPRIETARY_TLV_BASE_ID + 60) | ||
115 | #define TLV_TYPE_UAP_ENCRY_PROTOCOL (PROPRIETARY_TLV_BASE_ID + 64) | ||
116 | #define TLV_TYPE_UAP_AKMP (PROPRIETARY_TLV_BASE_ID + 65) | ||
114 | #define TLV_TYPE_UAP_FRAG_THRESHOLD (PROPRIETARY_TLV_BASE_ID + 70) | 117 | #define TLV_TYPE_UAP_FRAG_THRESHOLD (PROPRIETARY_TLV_BASE_ID + 70) |
115 | #define TLV_TYPE_RATE_DROP_CONTROL (PROPRIETARY_TLV_BASE_ID + 82) | 118 | #define TLV_TYPE_RATE_DROP_CONTROL (PROPRIETARY_TLV_BASE_ID + 82) |
116 | #define TLV_TYPE_RATE_SCOPE (PROPRIETARY_TLV_BASE_ID + 83) | 119 | #define TLV_TYPE_RATE_SCOPE (PROPRIETARY_TLV_BASE_ID + 83) |
@@ -121,6 +124,8 @@ enum MWIFIEX_802_11_PRIVACY_FILTER { | |||
121 | #define TLV_TYPE_MGMT_IE (PROPRIETARY_TLV_BASE_ID + 105) | 124 | #define TLV_TYPE_MGMT_IE (PROPRIETARY_TLV_BASE_ID + 105) |
122 | #define TLV_TYPE_AUTO_DS_PARAM (PROPRIETARY_TLV_BASE_ID + 113) | 125 | #define TLV_TYPE_AUTO_DS_PARAM (PROPRIETARY_TLV_BASE_ID + 113) |
123 | #define TLV_TYPE_PS_PARAM (PROPRIETARY_TLV_BASE_ID + 114) | 126 | #define TLV_TYPE_PS_PARAM (PROPRIETARY_TLV_BASE_ID + 114) |
127 | #define TLV_TYPE_PWK_CIPHER (PROPRIETARY_TLV_BASE_ID + 145) | ||
128 | #define TLV_TYPE_GWK_CIPHER (PROPRIETARY_TLV_BASE_ID + 146) | ||
124 | 129 | ||
125 | #define MWIFIEX_TX_DATA_BUF_SIZE_2K 2048 | 130 | #define MWIFIEX_TX_DATA_BUF_SIZE_2K 2048 |
126 | 131 | ||
@@ -235,6 +240,19 @@ enum MWIFIEX_802_11_PRIVACY_FILTER { | |||
235 | #define HostCmd_CMD_SET_BSS_MODE 0x00f7 | 240 | #define HostCmd_CMD_SET_BSS_MODE 0x00f7 |
236 | #define HostCmd_CMD_PCIE_DESC_DETAILS 0x00fa | 241 | #define HostCmd_CMD_PCIE_DESC_DETAILS 0x00fa |
237 | 242 | ||
243 | #define PROTOCOL_NO_SECURITY 0x01 | ||
244 | #define PROTOCOL_STATIC_WEP 0x02 | ||
245 | #define PROTOCOL_WPA 0x08 | ||
246 | #define PROTOCOL_WPA2 0x20 | ||
247 | #define PROTOCOL_WPA2_MIXED 0x28 | ||
248 | #define PROTOCOL_EAP 0x40 | ||
249 | #define KEY_MGMT_NONE 0x04 | ||
250 | #define KEY_MGMT_PSK 0x02 | ||
251 | #define KEY_MGMT_EAP 0x01 | ||
252 | #define CIPHER_TKIP 0x04 | ||
253 | #define CIPHER_AES_CCMP 0x08 | ||
254 | #define VALID_CIPHER_BITMAP 0x0c | ||
255 | |||
238 | enum ENH_PS_MODES { | 256 | enum ENH_PS_MODES { |
239 | EN_PS = 1, | 257 | EN_PS = 1, |
240 | DIS_PS = 2, | 258 | DIS_PS = 2, |
@@ -1139,6 +1157,41 @@ struct host_cmd_ds_sys_config { | |||
1139 | __le16 action; | 1157 | __le16 action; |
1140 | u8 tlv[0]; | 1158 | u8 tlv[0]; |
1141 | }; | 1159 | }; |
1160 | |||
1161 | struct host_cmd_tlv_akmp { | ||
1162 | struct host_cmd_tlv tlv; | ||
1163 | __le16 key_mgmt; | ||
1164 | __le16 key_mgmt_operation; | ||
1165 | } __packed; | ||
1166 | |||
1167 | struct host_cmd_tlv_pwk_cipher { | ||
1168 | struct host_cmd_tlv tlv; | ||
1169 | __le16 proto; | ||
1170 | u8 cipher; | ||
1171 | u8 reserved; | ||
1172 | } __packed; | ||
1173 | |||
1174 | struct host_cmd_tlv_gwk_cipher { | ||
1175 | struct host_cmd_tlv tlv; | ||
1176 | u8 cipher; | ||
1177 | u8 reserved; | ||
1178 | } __packed; | ||
1179 | |||
1180 | struct host_cmd_tlv_passphrase { | ||
1181 | struct host_cmd_tlv tlv; | ||
1182 | u8 passphrase[0]; | ||
1183 | } __packed; | ||
1184 | |||
1185 | struct host_cmd_tlv_auth_type { | ||
1186 | struct host_cmd_tlv tlv; | ||
1187 | u8 auth_type; | ||
1188 | } __packed; | ||
1189 | |||
1190 | struct host_cmd_tlv_encrypt_protocol { | ||
1191 | struct host_cmd_tlv tlv; | ||
1192 | __le16 proto; | ||
1193 | } __packed; | ||
1194 | |||
1142 | struct host_cmd_tlv_ssid { | 1195 | struct host_cmd_tlv_ssid { |
1143 | struct host_cmd_tlv tlv; | 1196 | struct host_cmd_tlv tlv; |
1144 | u8 ssid[0]; | 1197 | u8 ssid[0]; |
diff --git a/drivers/net/wireless/mwifiex/ioctl.h b/drivers/net/wireless/mwifiex/ioctl.h index 99a7168022d0..eb14f558b118 100644 --- a/drivers/net/wireless/mwifiex/ioctl.h +++ b/drivers/net/wireless/mwifiex/ioctl.h | |||
@@ -62,6 +62,17 @@ enum { | |||
62 | BAND_AN = 16, | 62 | BAND_AN = 16, |
63 | }; | 63 | }; |
64 | 64 | ||
65 | #define MWIFIEX_WPA_PASSHPHRASE_LEN 64 | ||
66 | struct wpa_param { | ||
67 | u8 pairwise_cipher_wpa; | ||
68 | u8 pairwise_cipher_wpa2; | ||
69 | u8 group_cipher; | ||
70 | u32 length; | ||
71 | u8 passphrase[MWIFIEX_WPA_PASSHPHRASE_LEN]; | ||
72 | }; | ||
73 | |||
74 | #define KEY_MGMT_ON_HOST 0x03 | ||
75 | #define MWIFIEX_AUTH_MODE_AUTO 0xFF | ||
65 | #define BAND_CONFIG_MANUAL 0x00 | 76 | #define BAND_CONFIG_MANUAL 0x00 |
66 | struct mwifiex_uap_bss_param { | 77 | struct mwifiex_uap_bss_param { |
67 | u8 channel; | 78 | u8 channel; |
@@ -74,6 +85,11 @@ struct mwifiex_uap_bss_param { | |||
74 | u8 radio_ctl; | 85 | u8 radio_ctl; |
75 | u8 dtim_period; | 86 | u8 dtim_period; |
76 | u16 beacon_period; | 87 | u16 beacon_period; |
88 | u16 auth_mode; | ||
89 | u16 protocol; | ||
90 | u16 key_mgmt; | ||
91 | u16 key_mgmt_operation; | ||
92 | struct wpa_param wpa_cfg; | ||
77 | }; | 93 | }; |
78 | 94 | ||
79 | enum { | 95 | enum { |
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index b0a8338d2c8a..824bd436c3ae 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
@@ -826,6 +826,9 @@ int mwifiex_ret_get_hw_spec(struct mwifiex_private *priv, | |||
826 | int is_command_pending(struct mwifiex_adapter *adapter); | 826 | int is_command_pending(struct mwifiex_adapter *adapter); |
827 | void mwifiex_init_priv_params(struct mwifiex_private *priv, | 827 | void mwifiex_init_priv_params(struct mwifiex_private *priv, |
828 | struct net_device *dev); | 828 | struct net_device *dev); |
829 | int mwifiex_set_secure_params(struct mwifiex_private *priv, | ||
830 | struct mwifiex_uap_bss_param *bss_config, | ||
831 | struct cfg80211_ap_settings *params); | ||
829 | 832 | ||
830 | /* | 833 | /* |
831 | * This function checks if the queuing is RA based or not. | 834 | * This function checks if the queuing is RA based or not. |
diff --git a/drivers/net/wireless/mwifiex/uap_cmd.c b/drivers/net/wireless/mwifiex/uap_cmd.c index 66047cff7eb7..0cfe88849e94 100644 --- a/drivers/net/wireless/mwifiex/uap_cmd.c +++ b/drivers/net/wireless/mwifiex/uap_cmd.c | |||
@@ -19,12 +19,105 @@ | |||
19 | 19 | ||
20 | #include "main.h" | 20 | #include "main.h" |
21 | 21 | ||
22 | /* This function parses security related parameters from cfg80211_ap_settings | ||
23 | * and sets into FW understandable bss_config structure. | ||
24 | */ | ||
25 | int mwifiex_set_secure_params(struct mwifiex_private *priv, | ||
26 | struct mwifiex_uap_bss_param *bss_config, | ||
27 | struct cfg80211_ap_settings *params) { | ||
28 | int i; | ||
29 | |||
30 | switch (params->auth_type) { | ||
31 | case NL80211_AUTHTYPE_OPEN_SYSTEM: | ||
32 | bss_config->auth_mode = WLAN_AUTH_OPEN; | ||
33 | break; | ||
34 | case NL80211_AUTHTYPE_SHARED_KEY: | ||
35 | bss_config->auth_mode = WLAN_AUTH_SHARED_KEY; | ||
36 | break; | ||
37 | case NL80211_AUTHTYPE_NETWORK_EAP: | ||
38 | bss_config->auth_mode = WLAN_AUTH_LEAP; | ||
39 | break; | ||
40 | default: | ||
41 | bss_config->auth_mode = MWIFIEX_AUTH_MODE_AUTO; | ||
42 | break; | ||
43 | } | ||
44 | |||
45 | bss_config->key_mgmt_operation |= KEY_MGMT_ON_HOST; | ||
46 | |||
47 | for (i = 0; i < params->crypto.n_akm_suites; i++) { | ||
48 | switch (params->crypto.akm_suites[i]) { | ||
49 | case WLAN_AKM_SUITE_8021X: | ||
50 | if (params->crypto.wpa_versions & | ||
51 | NL80211_WPA_VERSION_1) { | ||
52 | bss_config->protocol = PROTOCOL_WPA; | ||
53 | bss_config->key_mgmt = KEY_MGMT_EAP; | ||
54 | } | ||
55 | if (params->crypto.wpa_versions & | ||
56 | NL80211_WPA_VERSION_2) { | ||
57 | bss_config->protocol = PROTOCOL_WPA2; | ||
58 | bss_config->key_mgmt = KEY_MGMT_EAP; | ||
59 | } | ||
60 | break; | ||
61 | case WLAN_AKM_SUITE_PSK: | ||
62 | if (params->crypto.wpa_versions & | ||
63 | NL80211_WPA_VERSION_1) { | ||
64 | bss_config->protocol = PROTOCOL_WPA; | ||
65 | bss_config->key_mgmt = KEY_MGMT_PSK; | ||
66 | } | ||
67 | if (params->crypto.wpa_versions & | ||
68 | NL80211_WPA_VERSION_2) { | ||
69 | bss_config->protocol = PROTOCOL_WPA2; | ||
70 | bss_config->key_mgmt = KEY_MGMT_PSK; | ||
71 | } | ||
72 | break; | ||
73 | default: | ||
74 | break; | ||
75 | } | ||
76 | } | ||
77 | for (i = 0; i < params->crypto.n_ciphers_pairwise; i++) { | ||
78 | switch (params->crypto.ciphers_pairwise[i]) { | ||
79 | case WLAN_CIPHER_SUITE_WEP40: | ||
80 | case WLAN_CIPHER_SUITE_WEP104: | ||
81 | break; | ||
82 | case WLAN_CIPHER_SUITE_TKIP: | ||
83 | bss_config->wpa_cfg.pairwise_cipher_wpa = CIPHER_TKIP; | ||
84 | break; | ||
85 | case WLAN_CIPHER_SUITE_CCMP: | ||
86 | bss_config->wpa_cfg.pairwise_cipher_wpa2 = | ||
87 | CIPHER_AES_CCMP; | ||
88 | default: | ||
89 | break; | ||
90 | } | ||
91 | } | ||
92 | |||
93 | switch (params->crypto.cipher_group) { | ||
94 | case WLAN_CIPHER_SUITE_WEP40: | ||
95 | case WLAN_CIPHER_SUITE_WEP104: | ||
96 | break; | ||
97 | case WLAN_CIPHER_SUITE_TKIP: | ||
98 | bss_config->wpa_cfg.group_cipher = CIPHER_TKIP; | ||
99 | break; | ||
100 | case WLAN_CIPHER_SUITE_CCMP: | ||
101 | bss_config->wpa_cfg.group_cipher = CIPHER_AES_CCMP; | ||
102 | break; | ||
103 | default: | ||
104 | break; | ||
105 | } | ||
106 | |||
107 | return 0; | ||
108 | } | ||
109 | |||
22 | /* This function initializes some of mwifiex_uap_bss_param variables. | 110 | /* This function initializes some of mwifiex_uap_bss_param variables. |
23 | * This helps FW in ignoring invalid values. These values may or may not | 111 | * This helps FW in ignoring invalid values. These values may or may not |
24 | * be get updated to valid ones at later stage. | 112 | * be get updated to valid ones at later stage. |
25 | */ | 113 | */ |
26 | void mwifiex_set_sys_config_invalid_data(struct mwifiex_uap_bss_param *config) | 114 | void mwifiex_set_sys_config_invalid_data(struct mwifiex_uap_bss_param *config) |
27 | { | 115 | { |
116 | config->bcast_ssid_ctl = 0x7F; | ||
117 | config->radio_ctl = 0x7F; | ||
118 | config->dtim_period = 0x7F; | ||
119 | config->beacon_period = 0x7FFF; | ||
120 | config->auth_mode = 0x7F; | ||
28 | config->rts_threshold = 0x7FFF; | 121 | config->rts_threshold = 0x7FFF; |
29 | config->frag_threshold = 0x7FFF; | 122 | config->frag_threshold = 0x7FFF; |
30 | config->retry_limit = 0x7F; | 123 | config->retry_limit = 0x7F; |
@@ -45,6 +138,12 @@ static int mwifiex_cmd_uap_sys_config(struct host_cmd_ds_command *cmd, | |||
45 | struct host_cmd_tlv_frag_threshold *frag_threshold; | 138 | struct host_cmd_tlv_frag_threshold *frag_threshold; |
46 | struct host_cmd_tlv_rts_threshold *rts_threshold; | 139 | struct host_cmd_tlv_rts_threshold *rts_threshold; |
47 | struct host_cmd_tlv_retry_limit *retry_limit; | 140 | struct host_cmd_tlv_retry_limit *retry_limit; |
141 | struct host_cmd_tlv_pwk_cipher *pwk_cipher; | ||
142 | struct host_cmd_tlv_gwk_cipher *gwk_cipher; | ||
143 | struct host_cmd_tlv_encrypt_protocol *encrypt_protocol; | ||
144 | struct host_cmd_tlv_auth_type *auth_type; | ||
145 | struct host_cmd_tlv_passphrase *passphrase; | ||
146 | struct host_cmd_tlv_akmp *tlv_akmp; | ||
48 | struct mwifiex_uap_bss_param *bss_cfg = cmd_buf; | 147 | struct mwifiex_uap_bss_param *bss_cfg = cmd_buf; |
49 | u16 cmd_size; | 148 | u16 cmd_size; |
50 | 149 | ||
@@ -131,6 +230,94 @@ static int mwifiex_cmd_uap_sys_config(struct host_cmd_ds_command *cmd, | |||
131 | cmd_size += sizeof(struct host_cmd_tlv_retry_limit); | 230 | cmd_size += sizeof(struct host_cmd_tlv_retry_limit); |
132 | tlv += sizeof(struct host_cmd_tlv_retry_limit); | 231 | tlv += sizeof(struct host_cmd_tlv_retry_limit); |
133 | } | 232 | } |
233 | if ((bss_cfg->protocol & PROTOCOL_WPA) || | ||
234 | (bss_cfg->protocol & PROTOCOL_WPA2) || | ||
235 | (bss_cfg->protocol & PROTOCOL_EAP)) { | ||
236 | tlv_akmp = (struct host_cmd_tlv_akmp *)tlv; | ||
237 | tlv_akmp->tlv.type = cpu_to_le16(TLV_TYPE_UAP_AKMP); | ||
238 | tlv_akmp->tlv.len = | ||
239 | cpu_to_le16(sizeof(struct host_cmd_tlv_akmp) - | ||
240 | sizeof(struct host_cmd_tlv)); | ||
241 | tlv_akmp->key_mgmt_operation = | ||
242 | cpu_to_le16(bss_cfg->key_mgmt_operation); | ||
243 | tlv_akmp->key_mgmt = cpu_to_le16(bss_cfg->key_mgmt); | ||
244 | cmd_size += sizeof(struct host_cmd_tlv_akmp); | ||
245 | tlv += sizeof(struct host_cmd_tlv_akmp); | ||
246 | |||
247 | if (bss_cfg->wpa_cfg.pairwise_cipher_wpa & | ||
248 | VALID_CIPHER_BITMAP) { | ||
249 | pwk_cipher = (struct host_cmd_tlv_pwk_cipher *)tlv; | ||
250 | pwk_cipher->tlv.type = | ||
251 | cpu_to_le16(TLV_TYPE_PWK_CIPHER); | ||
252 | pwk_cipher->tlv.len = cpu_to_le16( | ||
253 | sizeof(struct host_cmd_tlv_pwk_cipher) - | ||
254 | sizeof(struct host_cmd_tlv)); | ||
255 | pwk_cipher->proto = cpu_to_le16(PROTOCOL_WPA); | ||
256 | pwk_cipher->cipher = | ||
257 | bss_cfg->wpa_cfg.pairwise_cipher_wpa; | ||
258 | cmd_size += sizeof(struct host_cmd_tlv_pwk_cipher); | ||
259 | tlv += sizeof(struct host_cmd_tlv_pwk_cipher); | ||
260 | } | ||
261 | if (bss_cfg->wpa_cfg.pairwise_cipher_wpa2 & | ||
262 | VALID_CIPHER_BITMAP) { | ||
263 | pwk_cipher = (struct host_cmd_tlv_pwk_cipher *)tlv; | ||
264 | pwk_cipher->tlv.type = cpu_to_le16(TLV_TYPE_PWK_CIPHER); | ||
265 | pwk_cipher->tlv.len = cpu_to_le16( | ||
266 | sizeof(struct host_cmd_tlv_pwk_cipher) - | ||
267 | sizeof(struct host_cmd_tlv)); | ||
268 | pwk_cipher->proto = cpu_to_le16(PROTOCOL_WPA2); | ||
269 | pwk_cipher->cipher = | ||
270 | bss_cfg->wpa_cfg.pairwise_cipher_wpa2; | ||
271 | cmd_size += sizeof(struct host_cmd_tlv_pwk_cipher); | ||
272 | tlv += sizeof(struct host_cmd_tlv_pwk_cipher); | ||
273 | } | ||
274 | if (bss_cfg->wpa_cfg.group_cipher & VALID_CIPHER_BITMAP) { | ||
275 | gwk_cipher = (struct host_cmd_tlv_gwk_cipher *)tlv; | ||
276 | gwk_cipher->tlv.type = cpu_to_le16(TLV_TYPE_GWK_CIPHER); | ||
277 | gwk_cipher->tlv.len = cpu_to_le16( | ||
278 | sizeof(struct host_cmd_tlv_gwk_cipher) - | ||
279 | sizeof(struct host_cmd_tlv)); | ||
280 | gwk_cipher->cipher = bss_cfg->wpa_cfg.group_cipher; | ||
281 | cmd_size += sizeof(struct host_cmd_tlv_gwk_cipher); | ||
282 | tlv += sizeof(struct host_cmd_tlv_gwk_cipher); | ||
283 | } | ||
284 | if (bss_cfg->wpa_cfg.length) { | ||
285 | passphrase = (struct host_cmd_tlv_passphrase *)tlv; | ||
286 | passphrase->tlv.type = | ||
287 | cpu_to_le16(TLV_TYPE_UAP_WPA_PASSPHRASE); | ||
288 | passphrase->tlv.len = | ||
289 | cpu_to_le16(bss_cfg->wpa_cfg.length); | ||
290 | memcpy(passphrase->passphrase, | ||
291 | bss_cfg->wpa_cfg.passphrase, | ||
292 | bss_cfg->wpa_cfg.length); | ||
293 | cmd_size += sizeof(struct host_cmd_tlv) + | ||
294 | bss_cfg->wpa_cfg.length; | ||
295 | tlv += sizeof(struct host_cmd_tlv) + | ||
296 | bss_cfg->wpa_cfg.length; | ||
297 | } | ||
298 | } | ||
299 | if ((bss_cfg->auth_mode <= WLAN_AUTH_SHARED_KEY) || | ||
300 | (bss_cfg->auth_mode == MWIFIEX_AUTH_MODE_AUTO)) { | ||
301 | auth_type = (struct host_cmd_tlv_auth_type *)tlv; | ||
302 | auth_type->tlv.type = cpu_to_le16(TLV_TYPE_AUTH_TYPE); | ||
303 | auth_type->tlv.len = | ||
304 | cpu_to_le16(sizeof(struct host_cmd_tlv_auth_type) - | ||
305 | sizeof(struct host_cmd_tlv)); | ||
306 | auth_type->auth_type = (u8)bss_cfg->auth_mode; | ||
307 | cmd_size += sizeof(struct host_cmd_tlv_auth_type); | ||
308 | tlv += sizeof(struct host_cmd_tlv_auth_type); | ||
309 | } | ||
310 | if (bss_cfg->protocol) { | ||
311 | encrypt_protocol = (struct host_cmd_tlv_encrypt_protocol *)tlv; | ||
312 | encrypt_protocol->tlv.type = | ||
313 | cpu_to_le16(TLV_TYPE_UAP_ENCRY_PROTOCOL); | ||
314 | encrypt_protocol->tlv.len = | ||
315 | cpu_to_le16(sizeof(struct host_cmd_tlv_encrypt_protocol) | ||
316 | - sizeof(struct host_cmd_tlv)); | ||
317 | encrypt_protocol->proto = cpu_to_le16(bss_cfg->protocol); | ||
318 | cmd_size += sizeof(struct host_cmd_tlv_encrypt_protocol); | ||
319 | tlv += sizeof(struct host_cmd_tlv_encrypt_protocol); | ||
320 | } | ||
134 | 321 | ||
135 | cmd->size = cpu_to_le16(cmd_size); | 322 | cmd->size = cpu_to_le16(cmd_size); |
136 | return 0; | 323 | return 0; |