aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mwifiex
diff options
context:
space:
mode:
authorAvinash Patil <patila@marvell.com>2012-06-15 15:21:52 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-06-22 14:44:04 -0400
commit0fd66be4a369e4a93bfd559c931e689539cc8e5f (patch)
tree87d3f8172496da18724cb9b5653b8804e10d740b /drivers/net/wireless/mwifiex
parentd217249d7279d72b912d3c3a7938a3248b0af2ed (diff)
mwifiex: parse WPA IE and support WPA/WPA2 mixed mode for uAP
Add support for parsing WPA IE from beacon parameter of cfg80211_ap_settings and set it to FW. WPA/WPA2 mixed mode is supported with this patch. 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/mwifiex')
-rw-r--r--drivers/net/wireless/mwifiex/ie.c55
-rw-r--r--drivers/net/wireless/mwifiex/uap_cmd.c17
2 files changed, 49 insertions, 23 deletions
diff --git a/drivers/net/wireless/mwifiex/ie.c b/drivers/net/wireless/mwifiex/ie.c
index ceb82cd749cc..328fb14d9e14 100644
--- a/drivers/net/wireless/mwifiex/ie.c
+++ b/drivers/net/wireless/mwifiex/ie.c
@@ -224,29 +224,46 @@ int mwifiex_set_mgmt_ies(struct mwifiex_private *priv,
224 struct cfg80211_ap_settings *params) 224 struct cfg80211_ap_settings *params)
225{ 225{
226 struct mwifiex_ie *beacon_ie = NULL, *pr_ie = NULL; 226 struct mwifiex_ie *beacon_ie = NULL, *pr_ie = NULL;
227 struct mwifiex_ie *ar_ie = NULL, *rsn_ie = NULL; 227 struct mwifiex_ie *ar_ie = NULL, *gen_ie = NULL;
228 struct ieee_types_header *ie = NULL; 228 struct ieee_types_header *rsn_ie = NULL, *wpa_ie = NULL;
229 u16 beacon_idx = MWIFIEX_AUTO_IDX_MASK, pr_idx = MWIFIEX_AUTO_IDX_MASK; 229 u16 beacon_idx = MWIFIEX_AUTO_IDX_MASK, pr_idx = MWIFIEX_AUTO_IDX_MASK;
230 u16 ar_idx = MWIFIEX_AUTO_IDX_MASK, rsn_idx = MWIFIEX_AUTO_IDX_MASK; 230 u16 ar_idx = MWIFIEX_AUTO_IDX_MASK, rsn_idx = MWIFIEX_AUTO_IDX_MASK;
231 u16 mask; 231 u16 mask, ie_len = 0;
232 const u8 *vendor_ie;
232 int ret = 0; 233 int ret = 0;
233 234
234 if (params->beacon.tail && params->beacon.tail_len) { 235 if (params->beacon.tail && params->beacon.tail_len) {
235 ie = (void *)cfg80211_find_ie(WLAN_EID_RSN, params->beacon.tail, 236 gen_ie = kzalloc(sizeof(struct mwifiex_ie), GFP_KERNEL);
236 params->beacon.tail_len); 237 if (!gen_ie)
237 if (ie) { 238 return -ENOMEM;
238 rsn_ie = kmalloc(sizeof(struct mwifiex_ie), GFP_KERNEL); 239 gen_ie->ie_index = cpu_to_le16(rsn_idx);
239 if (!rsn_ie) 240 mask = MGMT_MASK_BEACON | MGMT_MASK_PROBE_RESP |
240 return -ENOMEM; 241 MGMT_MASK_ASSOC_RESP;
241 242 gen_ie->mgmt_subtype_mask = cpu_to_le16(mask);
242 rsn_ie->ie_index = cpu_to_le16(rsn_idx); 243
243 mask = MGMT_MASK_BEACON | MGMT_MASK_PROBE_RESP | 244 rsn_ie = (void *)cfg80211_find_ie(WLAN_EID_RSN,
244 MGMT_MASK_ASSOC_RESP; 245 params->beacon.tail,
245 rsn_ie->mgmt_subtype_mask = cpu_to_le16(mask); 246 params->beacon.tail_len);
246 rsn_ie->ie_length = cpu_to_le16(ie->len + 2); 247 if (rsn_ie) {
247 memcpy(rsn_ie->ie_buffer, ie, ie->len + 2); 248 memcpy(gen_ie->ie_buffer, rsn_ie, rsn_ie->len + 2);
248 249 ie_len = rsn_ie->len + 2;
249 if (mwifiex_update_uap_custom_ie(priv, rsn_ie, &rsn_idx, 250 gen_ie->ie_length = cpu_to_le16(ie_len);
251 }
252
253 vendor_ie = cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
254 WLAN_OUI_TYPE_MICROSOFT_WPA,
255 params->beacon.tail,
256 params->beacon.tail_len);
257 if (vendor_ie) {
258 wpa_ie = (struct ieee_types_header *)vendor_ie;
259 memcpy(gen_ie->ie_buffer + ie_len,
260 wpa_ie, wpa_ie->len + 2);
261 ie_len += wpa_ie->len + 2;
262 gen_ie->ie_length = cpu_to_le16(ie_len);
263 }
264
265 if (rsn_ie || wpa_ie) {
266 if (mwifiex_update_uap_custom_ie(priv, gen_ie, &rsn_idx,
250 NULL, NULL, 267 NULL, NULL,
251 NULL, NULL)) { 268 NULL, NULL)) {
252 ret = -1; 269 ret = -1;
@@ -319,7 +336,7 @@ done:
319 kfree(beacon_ie); 336 kfree(beacon_ie);
320 kfree(pr_ie); 337 kfree(pr_ie);
321 kfree(ar_ie); 338 kfree(ar_ie);
322 kfree(rsn_ie); 339 kfree(gen_ie);
323 340
324 return ret; 341 return ret;
325} 342}
diff --git a/drivers/net/wireless/mwifiex/uap_cmd.c b/drivers/net/wireless/mwifiex/uap_cmd.c
index abb1322a8ceb..f40e93fe894a 100644
--- a/drivers/net/wireless/mwifiex/uap_cmd.c
+++ b/drivers/net/wireless/mwifiex/uap_cmd.c
@@ -66,7 +66,7 @@ int mwifiex_set_secure_params(struct mwifiex_private *priv,
66 } 66 }
67 if (params->crypto.wpa_versions & 67 if (params->crypto.wpa_versions &
68 NL80211_WPA_VERSION_2) { 68 NL80211_WPA_VERSION_2) {
69 bss_config->protocol = PROTOCOL_WPA2; 69 bss_config->protocol |= PROTOCOL_WPA2;
70 bss_config->key_mgmt = KEY_MGMT_EAP; 70 bss_config->key_mgmt = KEY_MGMT_EAP;
71 } 71 }
72 break; 72 break;
@@ -78,7 +78,7 @@ int mwifiex_set_secure_params(struct mwifiex_private *priv,
78 } 78 }
79 if (params->crypto.wpa_versions & 79 if (params->crypto.wpa_versions &
80 NL80211_WPA_VERSION_2) { 80 NL80211_WPA_VERSION_2) {
81 bss_config->protocol = PROTOCOL_WPA2; 81 bss_config->protocol |= PROTOCOL_WPA2;
82 bss_config->key_mgmt = KEY_MGMT_PSK; 82 bss_config->key_mgmt = KEY_MGMT_PSK;
83 } 83 }
84 break; 84 break;
@@ -92,10 +92,19 @@ int mwifiex_set_secure_params(struct mwifiex_private *priv,
92 case WLAN_CIPHER_SUITE_WEP104: 92 case WLAN_CIPHER_SUITE_WEP104:
93 break; 93 break;
94 case WLAN_CIPHER_SUITE_TKIP: 94 case WLAN_CIPHER_SUITE_TKIP:
95 bss_config->wpa_cfg.pairwise_cipher_wpa = CIPHER_TKIP; 95 if (params->crypto.wpa_versions & NL80211_WPA_VERSION_1)
96 bss_config->wpa_cfg.pairwise_cipher_wpa |=
97 CIPHER_TKIP;
98 if (params->crypto.wpa_versions & NL80211_WPA_VERSION_2)
99 bss_config->wpa_cfg.pairwise_cipher_wpa2 |=
100 CIPHER_TKIP;
96 break; 101 break;
97 case WLAN_CIPHER_SUITE_CCMP: 102 case WLAN_CIPHER_SUITE_CCMP:
98 bss_config->wpa_cfg.pairwise_cipher_wpa2 = 103 if (params->crypto.wpa_versions & NL80211_WPA_VERSION_1)
104 bss_config->wpa_cfg.pairwise_cipher_wpa |=
105 CIPHER_AES_CCMP;
106 if (params->crypto.wpa_versions & NL80211_WPA_VERSION_2)
107 bss_config->wpa_cfg.pairwise_cipher_wpa2 |=
99 CIPHER_AES_CCMP; 108 CIPHER_AES_CCMP;
100 default: 109 default:
101 break; 110 break;