diff options
author | Amitkumar Karwar <akarwar@marvell.com> | 2010-02-25 20:16:36 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-03-24 16:02:37 -0400 |
commit | 921ca03c8f8e982f27fc406bc301caf2196b99f7 (patch) | |
tree | 3ec4576e19f066a843a63e6eab1fd2ba90370937 /drivers/net/wireless/libertas | |
parent | e1572c5eeca8ef87a250322364584458b2dadb35 (diff) |
libertas: add auto auth mode feature
Auto auth mode is enabled by default. If user doesn't specify the
auth mode, while association driver will first try with open mode
and then with shared key mode. If user specifies an auth mode,
auto auth is disabled and driver will not try association with
another auth mode.
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/libertas')
-rw-r--r-- | drivers/net/wireless/libertas/assoc.c | 22 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/dev.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/main.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/wext.c | 4 |
4 files changed, 27 insertions, 1 deletions
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index f03d5e4e59c3..95d3d4c5e08b 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c | |||
@@ -31,6 +31,9 @@ u8 lbs_bg_rates[MAX_RATES] = | |||
31 | 0x00, 0x00 }; | 31 | 0x00, 0x00 }; |
32 | 32 | ||
33 | 33 | ||
34 | static int assoc_helper_wep_keys(struct lbs_private *priv, | ||
35 | struct assoc_request *assoc_req); | ||
36 | |||
34 | /** | 37 | /** |
35 | * @brief This function finds common rates between rates and card rates. | 38 | * @brief This function finds common rates between rates and card rates. |
36 | * | 39 | * |
@@ -610,7 +613,7 @@ static int lbs_assoc_post(struct lbs_private *priv, | |||
610 | 613 | ||
611 | if (status_code) { | 614 | if (status_code) { |
612 | lbs_mac_event_disconnected(priv); | 615 | lbs_mac_event_disconnected(priv); |
613 | ret = -1; | 616 | ret = status_code; |
614 | goto done; | 617 | goto done; |
615 | } | 618 | } |
616 | 619 | ||
@@ -813,7 +816,24 @@ static int lbs_try_associate(struct lbs_private *priv, | |||
813 | goto out; | 816 | goto out; |
814 | 817 | ||
815 | ret = lbs_associate(priv, assoc_req, CMD_802_11_ASSOCIATE); | 818 | ret = lbs_associate(priv, assoc_req, CMD_802_11_ASSOCIATE); |
819 | /* If the association fails with current auth mode, let's | ||
820 | * try by changing the auth mode | ||
821 | */ | ||
822 | if ((priv->authtype_auto) && | ||
823 | (ret == WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG) && | ||
824 | (assoc_req->secinfo.wep_enabled) && | ||
825 | (priv->connect_status != LBS_CONNECTED)) { | ||
826 | if (priv->secinfo.auth_mode == IW_AUTH_ALG_OPEN_SYSTEM) | ||
827 | priv->secinfo.auth_mode = IW_AUTH_ALG_SHARED_KEY; | ||
828 | else | ||
829 | priv->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; | ||
830 | if (!assoc_helper_wep_keys(priv, assoc_req)) | ||
831 | ret = lbs_associate(priv, assoc_req, | ||
832 | CMD_802_11_ASSOCIATE); | ||
833 | } | ||
816 | 834 | ||
835 | if (ret) | ||
836 | ret = -1; | ||
817 | out: | 837 | out: |
818 | lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); | 838 | lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); |
819 | return ret; | 839 | return ret; |
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index 6977ee820214..058d1720242e 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h | |||
@@ -133,6 +133,7 @@ struct lbs_private { | |||
133 | u8 wpa_ie_len; | 133 | u8 wpa_ie_len; |
134 | u16 wep_tx_keyidx; | 134 | u16 wep_tx_keyidx; |
135 | struct enc_key wep_keys[4]; | 135 | struct enc_key wep_keys[4]; |
136 | u8 authtype_auto; | ||
136 | 137 | ||
137 | /* Wake On LAN */ | 138 | /* Wake On LAN */ |
138 | uint32_t wol_criteria; | 139 | uint32_t wol_criteria; |
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 28a1c9d1627a..3c889f43d909 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c | |||
@@ -835,6 +835,7 @@ static int lbs_init_adapter(struct lbs_private *priv) | |||
835 | priv->is_auto_deep_sleep_enabled = 0; | 835 | priv->is_auto_deep_sleep_enabled = 0; |
836 | priv->wakeup_dev_required = 0; | 836 | priv->wakeup_dev_required = 0; |
837 | init_waitqueue_head(&priv->ds_awake_q); | 837 | init_waitqueue_head(&priv->ds_awake_q); |
838 | priv->authtype_auto = 1; | ||
838 | 839 | ||
839 | mutex_init(&priv->lock); | 840 | mutex_init(&priv->lock); |
840 | 841 | ||
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index 71f88a08e090..aad6263dee6d 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c | |||
@@ -1440,8 +1440,10 @@ static int lbs_set_encode(struct net_device *dev, | |||
1440 | set_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags); | 1440 | set_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags); |
1441 | 1441 | ||
1442 | if (dwrq->flags & IW_ENCODE_RESTRICTED) { | 1442 | if (dwrq->flags & IW_ENCODE_RESTRICTED) { |
1443 | priv->authtype_auto = 0; | ||
1443 | assoc_req->secinfo.auth_mode = IW_AUTH_ALG_SHARED_KEY; | 1444 | assoc_req->secinfo.auth_mode = IW_AUTH_ALG_SHARED_KEY; |
1444 | } else if (dwrq->flags & IW_ENCODE_OPEN) { | 1445 | } else if (dwrq->flags & IW_ENCODE_OPEN) { |
1446 | priv->authtype_auto = 0; | ||
1445 | assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; | 1447 | assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; |
1446 | } | 1448 | } |
1447 | 1449 | ||
@@ -1620,8 +1622,10 @@ static int lbs_set_encodeext(struct net_device *dev, | |||
1620 | goto out; | 1622 | goto out; |
1621 | 1623 | ||
1622 | if (dwrq->flags & IW_ENCODE_RESTRICTED) { | 1624 | if (dwrq->flags & IW_ENCODE_RESTRICTED) { |
1625 | priv->authtype_auto = 0; | ||
1623 | assoc_req->secinfo.auth_mode = IW_AUTH_ALG_SHARED_KEY; | 1626 | assoc_req->secinfo.auth_mode = IW_AUTH_ALG_SHARED_KEY; |
1624 | } else if (dwrq->flags & IW_ENCODE_OPEN) { | 1627 | } else if (dwrq->flags & IW_ENCODE_OPEN) { |
1628 | priv->authtype_auto = 0; | ||
1625 | assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; | 1629 | assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; |
1626 | } | 1630 | } |
1627 | 1631 | ||