aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/wext.c
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2007-05-10 22:57:23 -0400
committerJohn W. Linville <linville@tuxdriver.com>2007-05-11 14:54:54 -0400
commit889c05bdf3056b029b9fa95096eac4f0dfd3fb6f (patch)
treeefbe9e5abc2ca8197cdd07044a39791725ffd226 /drivers/net/wireless/libertas/wext.c
parent6affe785aaf983253b27e71e67bf5fceaee6ff88 (diff)
[PATCH] libertas: remove WLAN_802_11_WEP_STATUS enum
Also change WEPstatus to "wep_enabled"; it's clearer and consistent with the WPAenabled and WPA2enabled members. Signed-off-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/wext.c')
-rw-r--r--drivers/net/wireless/libertas/wext.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
index 22eacd2b6de4..62d92ff9fc1c 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -1556,8 +1556,7 @@ static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info,
1556 /* If station is WEP enabled, send the 1556 /* If station is WEP enabled, send the
1557 * command to set WEP in firmware 1557 * command to set WEP in firmware
1558 */ 1558 */
1559 if (adapter->secinfo.WEPstatus == 1559 if (adapter->secinfo.wep_enabled) {
1560 wlan802_11WEPenabled) {
1561 lbs_pr_debug(1, "set_freq: WEP enabled\n"); 1560 lbs_pr_debug(1, "set_freq: WEP enabled\n");
1562 ret = libertas_prepare_and_send_command(priv, 1561 ret = libertas_prepare_and_send_command(priv,
1563 cmd_802_11_set_wep, 1562 cmd_802_11_set_wep,
@@ -1786,8 +1785,9 @@ static int wlan_get_encode(struct net_device *dev,
1786 break; 1785 break;
1787 } 1786 }
1788 1787
1789 if ((adapter->secinfo.WEPstatus == wlan802_11WEPenabled) 1788 if ( adapter->secinfo.wep_enabled
1790 || adapter->secinfo.WPAenabled || adapter->secinfo.WPA2enabled) { 1789 || adapter->secinfo.WPAenabled
1790 || adapter->secinfo.WPA2enabled) {
1791 dwrq->flags &= ~IW_ENCODE_DISABLED; 1791 dwrq->flags &= ~IW_ENCODE_DISABLED;
1792 } else { 1792 } else {
1793 dwrq->flags |= IW_ENCODE_DISABLED; 1793 dwrq->flags |= IW_ENCODE_DISABLED;
@@ -1801,8 +1801,7 @@ static int wlan_get_encode(struct net_device *dev,
1801 if (index < 0) 1801 if (index < 0)
1802 index = adapter->wep_tx_keyidx; 1802 index = adapter->wep_tx_keyidx;
1803 1803
1804 if ((adapter->wep_keys[index].len) && 1804 if ((adapter->wep_keys[index].len) && adapter->secinfo.wep_enabled) {
1805 (adapter->secinfo.WEPstatus == wlan802_11WEPenabled)) {
1806 memcpy(extra, adapter->wep_keys[index].key, 1805 memcpy(extra, adapter->wep_keys[index].key,
1807 adapter->wep_keys[index].len); 1806 adapter->wep_keys[index].len);
1808 dwrq->length = adapter->wep_keys[index].len; 1807 dwrq->length = adapter->wep_keys[index].len;
@@ -1886,7 +1885,7 @@ static int wlan_set_wep_key(struct assoc_request *assoc_req,
1886 assoc_req->wep_tx_keyidx = index; 1885 assoc_req->wep_tx_keyidx = index;
1887 } 1886 }
1888 1887
1889 assoc_req->secinfo.WEPstatus = wlan802_11WEPenabled; 1888 assoc_req->secinfo.wep_enabled = 1;
1890 1889
1891 LEAVE(); 1890 LEAVE();
1892 return 0; 1891 return 0;
@@ -1918,7 +1917,7 @@ static void disable_wep(struct assoc_request *assoc_req)
1918 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; 1917 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
1919 1918
1920 /* Clear WEP keys and mark WEP as disabled */ 1919 /* Clear WEP keys and mark WEP as disabled */
1921 assoc_req->secinfo.WEPstatus = wlan802_11WEPdisabled; 1920 assoc_req->secinfo.wep_enabled = 0;
1922 for (i = 0; i < 4; i++) 1921 for (i = 0; i < 4; i++)
1923 assoc_req->wep_keys[i].len = 0; 1922 assoc_req->wep_keys[i].len = 0;
1924 1923
@@ -1970,8 +1969,7 @@ static int wlan_set_encode(struct net_device *dev,
1970 /* If WEP isn't enabled, or if there is no key data but a valid 1969 /* If WEP isn't enabled, or if there is no key data but a valid
1971 * index, set the TX key. 1970 * index, set the TX key.
1972 */ 1971 */
1973 if ((assoc_req->secinfo.WEPstatus != wlan802_11WEPenabled) 1972 if (!assoc_req->secinfo.wep_enabled || (dwrq->length == 0 && !is_default))
1974 || (dwrq->length == 0 && !is_default))
1975 set_tx_key = 1; 1973 set_tx_key = 1;
1976 1974
1977 ret = wlan_set_wep_key(assoc_req, extra, dwrq->length, index, set_tx_key); 1975 ret = wlan_set_wep_key(assoc_req, extra, dwrq->length, index, set_tx_key);
@@ -2046,23 +2044,24 @@ static int wlan_get_encodeext(struct net_device *dev,
2046 dwrq->flags = index + 1; 2044 dwrq->flags = index + 1;
2047 memset(ext, 0, sizeof(*ext)); 2045 memset(ext, 0, sizeof(*ext));
2048 2046
2049 if ((adapter->secinfo.WEPstatus == wlan802_11WEPdisabled) 2047 if ( !adapter->secinfo.wep_enabled
2050 && !adapter->secinfo.WPAenabled && !adapter->secinfo.WPA2enabled) { 2048 && !adapter->secinfo.WPAenabled
2049 && !adapter->secinfo.WPA2enabled) {
2051 ext->alg = IW_ENCODE_ALG_NONE; 2050 ext->alg = IW_ENCODE_ALG_NONE;
2052 ext->key_len = 0; 2051 ext->key_len = 0;
2053 dwrq->flags |= IW_ENCODE_DISABLED; 2052 dwrq->flags |= IW_ENCODE_DISABLED;
2054 } else { 2053 } else {
2055 u8 *key = NULL; 2054 u8 *key = NULL;
2056 2055
2057 if ((adapter->secinfo.WEPstatus == wlan802_11WEPenabled) 2056 if ( adapter->secinfo.wep_enabled
2058 && !adapter->secinfo.WPAenabled 2057 && !adapter->secinfo.WPAenabled
2059 && !adapter->secinfo.WPA2enabled) { 2058 && !adapter->secinfo.WPA2enabled) {
2060 ext->alg = IW_ENCODE_ALG_WEP; 2059 ext->alg = IW_ENCODE_ALG_WEP;
2061 ext->key_len = adapter->wep_keys[index].len; 2060 ext->key_len = adapter->wep_keys[index].len;
2062 key = &adapter->wep_keys[index].key[0]; 2061 key = &adapter->wep_keys[index].key[0];
2063 } else if ((adapter->secinfo.WEPstatus == wlan802_11WEPdisabled) && 2062 } else if ( !adapter->secinfo.wep_enabled
2064 (adapter->secinfo.WPAenabled || 2063 && (adapter->secinfo.WPAenabled ||
2065 adapter->secinfo.WPA2enabled)) { 2064 adapter->secinfo.WPA2enabled)) {
2066 /* WPA */ 2065 /* WPA */
2067 ext->alg = IW_ENCODE_ALG_TKIP; 2066 ext->alg = IW_ENCODE_ALG_TKIP;
2068 ext->key_len = 0; 2067 ext->key_len = 0;
@@ -2132,7 +2131,7 @@ static int wlan_set_encodeext(struct net_device *dev,
2132 /* If WEP isn't enabled, or if there is no key data but a valid 2131 /* If WEP isn't enabled, or if there is no key data but a valid
2133 * index, or if the set-TX-key flag was passed, set the TX key. 2132 * index, or if the set-TX-key flag was passed, set the TX key.
2134 */ 2133 */
2135 if ((assoc_req->secinfo.WEPstatus != wlan802_11WEPenabled) 2134 if ( !assoc_req->secinfo.wep_enabled
2136 || (dwrq->length == 0 && !is_default) 2135 || (dwrq->length == 0 && !is_default)
2137 || (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)) 2136 || (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY))
2138 set_tx_key = 1; 2137 set_tx_key = 1;
@@ -2331,12 +2330,12 @@ static int wlan_set_auth(struct net_device *dev,
2331 } 2330 }
2332 if (dwrq->value & IW_AUTH_WPA_VERSION_WPA) { 2331 if (dwrq->value & IW_AUTH_WPA_VERSION_WPA) {
2333 assoc_req->secinfo.WPAenabled = 1; 2332 assoc_req->secinfo.WPAenabled = 1;
2334 assoc_req->secinfo.WEPstatus = wlan802_11WEPdisabled; 2333 assoc_req->secinfo.wep_enabled = 0;
2335 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; 2334 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
2336 } 2335 }
2337 if (dwrq->value & IW_AUTH_WPA_VERSION_WPA2) { 2336 if (dwrq->value & IW_AUTH_WPA_VERSION_WPA2) {
2338 assoc_req->secinfo.WPA2enabled = 1; 2337 assoc_req->secinfo.WPA2enabled = 1;
2339 assoc_req->secinfo.WEPstatus = wlan802_11WEPdisabled; 2338 assoc_req->secinfo.wep_enabled = 0;
2340 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; 2339 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
2341 } 2340 }
2342 updated = 1; 2341 updated = 1;
@@ -2372,7 +2371,7 @@ static int wlan_set_auth(struct net_device *dev,
2372 !assoc_req->secinfo.WPA2enabled) { 2371 !assoc_req->secinfo.WPA2enabled) {
2373 assoc_req->secinfo.WPAenabled = 1; 2372 assoc_req->secinfo.WPAenabled = 1;
2374 assoc_req->secinfo.WPA2enabled = 1; 2373 assoc_req->secinfo.WPA2enabled = 1;
2375 assoc_req->secinfo.WEPstatus = wlan802_11WEPdisabled; 2374 assoc_req->secinfo.wep_enabled = 0;
2376 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; 2375 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
2377 } 2376 }
2378 } else { 2377 } else {