aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mwifiex
diff options
context:
space:
mode:
authorAmitkumar Karwar <akarwar@marvell.com>2012-02-25 00:36:05 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-03-05 15:20:47 -0500
commita0f6d6caef4033aa9c3e2ea2ceae256c4347a419 (patch)
tree1f1e5b20fa6633f217fd8e13da505265bdc4101c /drivers/net/wireless/mwifiex
parentc288ec614e264b46853c65d3db9ccf91d53c9484 (diff)
mwifiex: handle auto authentication mode correctly
When authentication type is configured to NL80211_AUTHTYPE_AUTOMATIC, driver tries to connect using open mode. The association is failed if AP is configured in shared mode. This patch adds code to try association using shared mode as well if open mode association fails. Now since we returned exact error code in association response handler (instead of -1), corresponding changes are done in mwifiex_process_cmdresp(). Signed-off-by: Amitkumar Karwar <akarwar@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/cfg80211.c10
-rw-r--r--drivers/net/wireless/mwifiex/cmdevt.c8
-rw-r--r--drivers/net/wireless/mwifiex/join.c2
-rw-r--r--drivers/net/wireless/mwifiex/main.h1
-rw-r--r--drivers/net/wireless/mwifiex/sta_ioctl.c11
5 files changed, 22 insertions, 10 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index a460fb0cc503..6a81101bab44 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -873,6 +873,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid,
873 priv->sec_info.wpa2_enabled = false; 873 priv->sec_info.wpa2_enabled = false;
874 priv->wep_key_curr_index = 0; 874 priv->wep_key_curr_index = 0;
875 priv->sec_info.encryption_mode = 0; 875 priv->sec_info.encryption_mode = 0;
876 priv->sec_info.is_authtype_auto = 0;
876 ret = mwifiex_set_encode(priv, NULL, 0, 0, 1); 877 ret = mwifiex_set_encode(priv, NULL, 0, 0, 1);
877 878
878 if (mode == NL80211_IFTYPE_ADHOC) { 879 if (mode == NL80211_IFTYPE_ADHOC) {
@@ -894,11 +895,12 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid,
894 } 895 }
895 896
896 /* Now handle infra mode. "sme" is valid for infra mode only */ 897 /* Now handle infra mode. "sme" is valid for infra mode only */
897 if (sme->auth_type == NL80211_AUTHTYPE_AUTOMATIC 898 if (sme->auth_type == NL80211_AUTHTYPE_AUTOMATIC) {
898 || sme->auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM)
899 auth_type = NL80211_AUTHTYPE_OPEN_SYSTEM; 899 auth_type = NL80211_AUTHTYPE_OPEN_SYSTEM;
900 else if (sme->auth_type == NL80211_AUTHTYPE_SHARED_KEY) 900 priv->sec_info.is_authtype_auto = 1;
901 auth_type = NL80211_AUTHTYPE_SHARED_KEY; 901 } else {
902 auth_type = sme->auth_type;
903 }
902 904
903 if (sme->crypto.n_ciphers_pairwise) { 905 if (sme->crypto.n_ciphers_pairwise) {
904 priv->sec_info.encryption_mode = 906 priv->sec_info.encryption_mode =
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c
index 6623db69e157..c82eb7ff2fa2 100644
--- a/drivers/net/wireless/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/mwifiex/cmdevt.c
@@ -771,7 +771,7 @@ int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter)
771 771
772 /* Check init command response */ 772 /* Check init command response */
773 if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) { 773 if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) {
774 if (ret == -1) { 774 if (ret) {
775 dev_err(adapter->dev, "%s: cmd %#x failed during " 775 dev_err(adapter->dev, "%s: cmd %#x failed during "
776 "initialization\n", __func__, cmdresp_no); 776 "initialization\n", __func__, cmdresp_no);
777 mwifiex_init_fw_complete(adapter); 777 mwifiex_init_fw_complete(adapter);
@@ -781,10 +781,8 @@ int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter)
781 } 781 }
782 782
783 if (adapter->curr_cmd) { 783 if (adapter->curr_cmd) {
784 if (adapter->curr_cmd->wait_q_enabled && (!ret)) 784 if (adapter->curr_cmd->wait_q_enabled)
785 adapter->cmd_wait_q.status = 0; 785 adapter->cmd_wait_q.status = ret;
786 else if (adapter->curr_cmd->wait_q_enabled && (ret == -1))
787 adapter->cmd_wait_q.status = -1;
788 786
789 /* Clean up and put current command back to cmd_free_q */ 787 /* Clean up and put current command back to cmd_free_q */
790 mwifiex_insert_cmd_to_free_q(adapter, adapter->curr_cmd); 788 mwifiex_insert_cmd_to_free_q(adapter, adapter->curr_cmd);
diff --git a/drivers/net/wireless/mwifiex/join.c b/drivers/net/wireless/mwifiex/join.c
index ee439fc2f4f3..5c95e4839004 100644
--- a/drivers/net/wireless/mwifiex/join.c
+++ b/drivers/net/wireless/mwifiex/join.c
@@ -585,7 +585,7 @@ int mwifiex_ret_802_11_associate(struct mwifiex_private *priv,
585 le16_to_cpu(assoc_rsp->cap_info_bitmap), 585 le16_to_cpu(assoc_rsp->cap_info_bitmap),
586 le16_to_cpu(assoc_rsp->a_id)); 586 le16_to_cpu(assoc_rsp->a_id));
587 587
588 ret = -1; 588 ret = le16_to_cpu(assoc_rsp->status_code);
589 goto done; 589 goto done;
590 } 590 }
591 591
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index 4c8621706278..dddb5563398a 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -219,6 +219,7 @@ struct mwifiex_802_11_security {
219 u8 wapi_key_on; 219 u8 wapi_key_on;
220 u8 wep_enabled; 220 u8 wep_enabled;
221 u32 authentication_mode; 221 u32 authentication_mode;
222 u8 is_authtype_auto;
222 u32 encryption_mode; 223 u32 encryption_mode;
223}; 224};
224 225
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c
index 866026ecca44..e10161f5894c 100644
--- a/drivers/net/wireless/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/mwifiex/sta_ioctl.c
@@ -249,6 +249,17 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss,
249 * application retrieval */ 249 * application retrieval */
250 priv->assoc_rsp_size = 0; 250 priv->assoc_rsp_size = 0;
251 ret = mwifiex_associate(priv, bss_desc); 251 ret = mwifiex_associate(priv, bss_desc);
252
253 /* If auth type is auto and association fails using open mode,
254 * try to connect using shared mode */
255 if (ret == WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG &&
256 priv->sec_info.is_authtype_auto &&
257 priv->sec_info.wep_enabled) {
258 priv->sec_info.authentication_mode =
259 NL80211_AUTHTYPE_SHARED_KEY;
260 ret = mwifiex_associate(priv, bss_desc);
261 }
262
252 if (bss) 263 if (bss)
253 cfg80211_put_bss(bss); 264 cfg80211_put_bss(bss);
254 } else { 265 } else {