diff options
author | John W. Linville <linville@tuxdriver.com> | 2006-02-17 08:15:58 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2006-02-17 08:15:58 -0500 |
commit | 5b69e69d4e6386bcb6592c75af897e5e79641602 (patch) | |
tree | bf9a153ad062629454ba877df224112a6bb5581b /drivers/net/wireless | |
parent | 750b50ab5687125d8a1dc946d931b00acf016e2c (diff) | |
parent | 7345137930907ba747781636c60112f7c2789aa8 (diff) |
Merge branch 'upstream-fixes'
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/atmel.c | 98 |
1 files changed, 59 insertions, 39 deletions
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index 98a76f10a0f7..dfc24016ba81 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c | |||
@@ -1872,7 +1872,7 @@ static int atmel_set_encodeext(struct net_device *dev, | |||
1872 | struct atmel_private *priv = netdev_priv(dev); | 1872 | struct atmel_private *priv = netdev_priv(dev); |
1873 | struct iw_point *encoding = &wrqu->encoding; | 1873 | struct iw_point *encoding = &wrqu->encoding; |
1874 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; | 1874 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; |
1875 | int idx, key_len; | 1875 | int idx, key_len, alg = ext->alg, set_key = 1; |
1876 | 1876 | ||
1877 | /* Determine and validate the key index */ | 1877 | /* Determine and validate the key index */ |
1878 | idx = encoding->flags & IW_ENCODE_INDEX; | 1878 | idx = encoding->flags & IW_ENCODE_INDEX; |
@@ -1883,39 +1883,42 @@ static int atmel_set_encodeext(struct net_device *dev, | |||
1883 | } else | 1883 | } else |
1884 | idx = priv->default_key; | 1884 | idx = priv->default_key; |
1885 | 1885 | ||
1886 | if ((encoding->flags & IW_ENCODE_DISABLED) || | 1886 | if (encoding->flags & IW_ENCODE_DISABLED) |
1887 | ext->alg == IW_ENCODE_ALG_NONE) { | 1887 | alg = IW_ENCODE_ALG_NONE; |
1888 | priv->wep_is_on = 0; | ||
1889 | priv->encryption_level = 0; | ||
1890 | priv->pairwise_cipher_suite = CIPHER_SUITE_NONE; | ||
1891 | } | ||
1892 | 1888 | ||
1893 | if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) | 1889 | if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { |
1894 | priv->default_key = idx; | 1890 | priv->default_key = idx; |
1891 | set_key = ext->key_len > 0 ? 1 : 0; | ||
1892 | } | ||
1895 | 1893 | ||
1896 | /* Set the requested key */ | 1894 | if (set_key) { |
1897 | switch (ext->alg) { | 1895 | /* Set the requested key first */ |
1898 | case IW_ENCODE_ALG_NONE: | 1896 | switch (alg) { |
1899 | break; | 1897 | case IW_ENCODE_ALG_NONE: |
1900 | case IW_ENCODE_ALG_WEP: | 1898 | priv->wep_is_on = 0; |
1901 | if (ext->key_len > 5) { | 1899 | priv->encryption_level = 0; |
1902 | priv->wep_key_len[idx] = 13; | 1900 | priv->pairwise_cipher_suite = CIPHER_SUITE_NONE; |
1903 | priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_128; | 1901 | break; |
1904 | priv->encryption_level = 2; | 1902 | case IW_ENCODE_ALG_WEP: |
1905 | } else if (ext->key_len > 0) { | 1903 | if (ext->key_len > 5) { |
1906 | priv->wep_key_len[idx] = 5; | 1904 | priv->wep_key_len[idx] = 13; |
1907 | priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_64; | 1905 | priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_128; |
1908 | priv->encryption_level = 1; | 1906 | priv->encryption_level = 2; |
1909 | } else { | 1907 | } else if (ext->key_len > 0) { |
1908 | priv->wep_key_len[idx] = 5; | ||
1909 | priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_64; | ||
1910 | priv->encryption_level = 1; | ||
1911 | } else { | ||
1912 | return -EINVAL; | ||
1913 | } | ||
1914 | priv->wep_is_on = 1; | ||
1915 | memset(priv->wep_keys[idx], 0, 13); | ||
1916 | key_len = min ((int)ext->key_len, priv->wep_key_len[idx]); | ||
1917 | memcpy(priv->wep_keys[idx], ext->key, key_len); | ||
1918 | break; | ||
1919 | default: | ||
1910 | return -EINVAL; | 1920 | return -EINVAL; |
1911 | } | 1921 | } |
1912 | priv->wep_is_on = 1; | ||
1913 | memset(priv->wep_keys[idx], 0, 13); | ||
1914 | key_len = min ((int)ext->key_len, priv->wep_key_len[idx]); | ||
1915 | memcpy(priv->wep_keys[idx], ext->key, key_len); | ||
1916 | break; | ||
1917 | default: | ||
1918 | return -EINVAL; | ||
1919 | } | 1922 | } |
1920 | 1923 | ||
1921 | return -EINPROGRESS; | 1924 | return -EINPROGRESS; |
@@ -3061,17 +3064,26 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) | |||
3061 | } | 3064 | } |
3062 | 3065 | ||
3063 | if (status == C80211_MGMT_SC_Success && priv->wep_is_on) { | 3066 | if (status == C80211_MGMT_SC_Success && priv->wep_is_on) { |
3067 | int should_associate = 0; | ||
3064 | /* WEP */ | 3068 | /* WEP */ |
3065 | if (trans_seq_no != priv->ExpectedAuthentTransactionSeqNum) | 3069 | if (trans_seq_no != priv->ExpectedAuthentTransactionSeqNum) |
3066 | return; | 3070 | return; |
3067 | 3071 | ||
3068 | if (trans_seq_no == 0x0002 && | 3072 | if (system == C80211_MGMT_AAN_OPENSYSTEM) { |
3069 | auth->el_id == C80211_MGMT_ElementID_ChallengeText) { | 3073 | if (trans_seq_no == 0x0002) { |
3070 | send_authentication_request(priv, system, auth->chall_text, auth->chall_text_len); | 3074 | should_associate = 1; |
3071 | return; | 3075 | } |
3076 | } else if (system == C80211_MGMT_AAN_SHAREDKEY) { | ||
3077 | if (trans_seq_no == 0x0002 && | ||
3078 | auth->el_id == C80211_MGMT_ElementID_ChallengeText) { | ||
3079 | send_authentication_request(priv, system, auth->chall_text, auth->chall_text_len); | ||
3080 | return; | ||
3081 | } else if (trans_seq_no == 0x0004) { | ||
3082 | should_associate = 1; | ||
3083 | } | ||
3072 | } | 3084 | } |
3073 | 3085 | ||
3074 | if (trans_seq_no == 0x0004) { | 3086 | if (should_associate) { |
3075 | if(priv->station_was_associated) { | 3087 | if(priv->station_was_associated) { |
3076 | atmel_enter_state(priv, STATION_STATE_REASSOCIATING); | 3088 | atmel_enter_state(priv, STATION_STATE_REASSOCIATING); |
3077 | send_association_request(priv, 1); | 3089 | send_association_request(priv, 1); |
@@ -3084,11 +3096,13 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) | |||
3084 | } | 3096 | } |
3085 | } | 3097 | } |
3086 | 3098 | ||
3087 | if (status == C80211_MGMT_SC_AuthAlgNotSupported) { | 3099 | if (status == WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG) { |
3088 | /* Do opensystem first, then try sharedkey */ | 3100 | /* Do opensystem first, then try sharedkey */ |
3089 | if (system == C80211_MGMT_AAN_OPENSYSTEM) { | 3101 | if (system == WLAN_AUTH_OPEN) { |
3090 | priv->CurrentAuthentTransactionSeqNum = 0x001; | 3102 | priv->CurrentAuthentTransactionSeqNum = 0x001; |
3091 | send_authentication_request(priv, C80211_MGMT_AAN_SHAREDKEY, NULL, 0); | 3103 | priv->exclude_unencrypted = 1; |
3104 | send_authentication_request(priv, WLAN_AUTH_SHARED_KEY, NULL, 0); | ||
3105 | return; | ||
3092 | } else if (priv->connect_to_any_BSS) { | 3106 | } else if (priv->connect_to_any_BSS) { |
3093 | int bss_index; | 3107 | int bss_index; |
3094 | 3108 | ||
@@ -3439,10 +3453,13 @@ static void atmel_management_timer(u_long a) | |||
3439 | priv->AuthenticationRequestRetryCnt = 0; | 3453 | priv->AuthenticationRequestRetryCnt = 0; |
3440 | restart_search(priv); | 3454 | restart_search(priv); |
3441 | } else { | 3455 | } else { |
3456 | int auth = C80211_MGMT_AAN_OPENSYSTEM; | ||
3442 | priv->AuthenticationRequestRetryCnt++; | 3457 | priv->AuthenticationRequestRetryCnt++; |
3443 | priv->CurrentAuthentTransactionSeqNum = 0x0001; | 3458 | priv->CurrentAuthentTransactionSeqNum = 0x0001; |
3444 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); | 3459 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); |
3445 | send_authentication_request(priv, C80211_MGMT_AAN_OPENSYSTEM, NULL, 0); | 3460 | if (priv->wep_is_on && priv->exclude_unencrypted) |
3461 | auth = C80211_MGMT_AAN_SHAREDKEY; | ||
3462 | send_authentication_request(priv, auth, NULL, 0); | ||
3446 | } | 3463 | } |
3447 | break; | 3464 | break; |
3448 | 3465 | ||
@@ -3541,12 +3558,15 @@ static void atmel_command_irq(struct atmel_private *priv) | |||
3541 | priv->station_was_associated = priv->station_is_associated; | 3558 | priv->station_was_associated = priv->station_is_associated; |
3542 | atmel_enter_state(priv, STATION_STATE_READY); | 3559 | atmel_enter_state(priv, STATION_STATE_READY); |
3543 | } else { | 3560 | } else { |
3561 | int auth = C80211_MGMT_AAN_OPENSYSTEM; | ||
3544 | priv->AuthenticationRequestRetryCnt = 0; | 3562 | priv->AuthenticationRequestRetryCnt = 0; |
3545 | atmel_enter_state(priv, STATION_STATE_AUTHENTICATING); | 3563 | atmel_enter_state(priv, STATION_STATE_AUTHENTICATING); |
3546 | 3564 | ||
3547 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); | 3565 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); |
3548 | priv->CurrentAuthentTransactionSeqNum = 0x0001; | 3566 | priv->CurrentAuthentTransactionSeqNum = 0x0001; |
3549 | send_authentication_request(priv, C80211_MGMT_AAN_SHAREDKEY, NULL, 0); | 3567 | if (priv->wep_is_on && priv->exclude_unencrypted) |
3568 | auth = C80211_MGMT_AAN_SHAREDKEY; | ||
3569 | send_authentication_request(priv, auth, NULL, 0); | ||
3550 | } | 3570 | } |
3551 | return; | 3571 | return; |
3552 | } | 3572 | } |