Merge branch 'upstream-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6

+60 -40
+60 -40
drivers/net/wireless/atmel.c
··· 1872 struct atmel_private *priv = netdev_priv(dev); 1873 struct iw_point *encoding = &wrqu->encoding; 1874 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; 1875 - int idx, key_len; 1876 1877 /* Determine and validate the key index */ 1878 idx = encoding->flags & IW_ENCODE_INDEX; ··· 1883 } else 1884 idx = priv->default_key; 1885 1886 - if ((encoding->flags & IW_ENCODE_DISABLED) || 1887 - ext->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 1893 - if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) 1894 - priv->default_key = idx; 1895 - 1896 - /* Set the requested key */ 1897 - switch (ext->alg) { 1898 - case IW_ENCODE_ALG_NONE: 1899 - break; 1900 - case IW_ENCODE_ALG_WEP: 1901 - if (ext->key_len > 5) { 1902 - priv->wep_key_len[idx] = 13; 1903 - priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_128; 1904 - priv->encryption_level = 2; 1905 - } else if (ext->key_len > 0) { 1906 - priv->wep_key_len[idx] = 5; 1907 - priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_64; 1908 - priv->encryption_level = 1; 1909 - } else { 1910 return -EINVAL; 1911 } 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 } 1920 1921 return -EINPROGRESS; ··· 3064 } 3065 3066 if (status == C80211_MGMT_SC_Success && priv->wep_is_on) { 3067 /* WEP */ 3068 if (trans_seq_no != priv->ExpectedAuthentTransactionSeqNum) 3069 return; 3070 3071 - if (trans_seq_no == 0x0002 && 3072 - auth->el_id == C80211_MGMT_ElementID_ChallengeText) { 3073 - send_authentication_request(priv, system, auth->chall_text, auth->chall_text_len); 3074 - return; 3075 } 3076 3077 - if (trans_seq_no == 0x0004) { 3078 if(priv->station_was_associated) { 3079 atmel_enter_state(priv, STATION_STATE_REASSOCIATING); 3080 send_association_request(priv, 1); ··· 3096 } 3097 } 3098 3099 - if (status == C80211_MGMT_SC_AuthAlgNotSupported) { 3100 /* Do opensystem first, then try sharedkey */ 3101 - if (system == C80211_MGMT_AAN_OPENSYSTEM) { 3102 priv->CurrentAuthentTransactionSeqNum = 0x001; 3103 - send_authentication_request(priv, C80211_MGMT_AAN_SHAREDKEY, NULL, 0); 3104 } else if (priv->connect_to_any_BSS) { 3105 int bss_index; 3106 ··· 3453 priv->AuthenticationRequestRetryCnt = 0; 3454 restart_search(priv); 3455 } else { 3456 priv->AuthenticationRequestRetryCnt++; 3457 priv->CurrentAuthentTransactionSeqNum = 0x0001; 3458 mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); 3459 - send_authentication_request(priv, C80211_MGMT_AAN_OPENSYSTEM, NULL, 0); 3460 } 3461 break; 3462 ··· 3558 priv->station_was_associated = priv->station_is_associated; 3559 atmel_enter_state(priv, STATION_STATE_READY); 3560 } else { 3561 priv->AuthenticationRequestRetryCnt = 0; 3562 atmel_enter_state(priv, STATION_STATE_AUTHENTICATING); 3563 3564 mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); 3565 priv->CurrentAuthentTransactionSeqNum = 0x0001; 3566 - send_authentication_request(priv, C80211_MGMT_AAN_SHAREDKEY, NULL, 0); 3567 } 3568 return; 3569 }
··· 1872 struct atmel_private *priv = netdev_priv(dev); 1873 struct iw_point *encoding = &wrqu->encoding; 1874 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; 1875 + int idx, key_len, alg = ext->alg, set_key = 1; 1876 1877 /* Determine and validate the key index */ 1878 idx = encoding->flags & IW_ENCODE_INDEX; ··· 1883 } else 1884 idx = priv->default_key; 1885 1886 + if (encoding->flags & IW_ENCODE_DISABLED) 1887 + alg = IW_ENCODE_ALG_NONE; 1888 + 1889 + if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { 1890 + priv->default_key = idx; 1891 + set_key = ext->key_len > 0 ? 1 : 0; 1892 } 1893 1894 + if (set_key) { 1895 + /* Set the requested key first */ 1896 + switch (alg) { 1897 + case IW_ENCODE_ALG_NONE: 1898 + priv->wep_is_on = 0; 1899 + priv->encryption_level = 0; 1900 + priv->pairwise_cipher_suite = CIPHER_SUITE_NONE; 1901 + break; 1902 + case IW_ENCODE_ALG_WEP: 1903 + if (ext->key_len > 5) { 1904 + priv->wep_key_len[idx] = 13; 1905 + priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_128; 1906 + priv->encryption_level = 2; 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: 1920 return -EINVAL; 1921 } 1922 } 1923 1924 return -EINPROGRESS; ··· 3061 } 3062 3063 if (status == C80211_MGMT_SC_Success && priv->wep_is_on) { 3064 + int should_associate = 0; 3065 /* WEP */ 3066 if (trans_seq_no != priv->ExpectedAuthentTransactionSeqNum) 3067 return; 3068 3069 + if (system == C80211_MGMT_AAN_OPENSYSTEM) { 3070 + if (trans_seq_no == 0x0002) { 3071 + should_associate = 1; 3072 + } 3073 + } else if (system == C80211_MGMT_AAN_SHAREDKEY) { 3074 + if (trans_seq_no == 0x0002 && 3075 + auth->el_id == C80211_MGMT_ElementID_ChallengeText) { 3076 + send_authentication_request(priv, system, auth->chall_text, auth->chall_text_len); 3077 + return; 3078 + } else if (trans_seq_no == 0x0004) { 3079 + should_associate = 1; 3080 + } 3081 } 3082 3083 + if (should_associate) { 3084 if(priv->station_was_associated) { 3085 atmel_enter_state(priv, STATION_STATE_REASSOCIATING); 3086 send_association_request(priv, 1); ··· 3084 } 3085 } 3086 3087 + if (status == WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG) { 3088 /* Do opensystem first, then try sharedkey */ 3089 + if (system == WLAN_AUTH_OPEN) { 3090 priv->CurrentAuthentTransactionSeqNum = 0x001; 3091 + priv->exclude_unencrypted = 1; 3092 + send_authentication_request(priv, WLAN_AUTH_SHARED_KEY, NULL, 0); 3093 + return; 3094 } else if (priv->connect_to_any_BSS) { 3095 int bss_index; 3096 ··· 3439 priv->AuthenticationRequestRetryCnt = 0; 3440 restart_search(priv); 3441 } else { 3442 + int auth = C80211_MGMT_AAN_OPENSYSTEM; 3443 priv->AuthenticationRequestRetryCnt++; 3444 priv->CurrentAuthentTransactionSeqNum = 0x0001; 3445 mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); 3446 + if (priv->wep_is_on && priv->exclude_unencrypted) 3447 + auth = C80211_MGMT_AAN_SHAREDKEY; 3448 + send_authentication_request(priv, auth, NULL, 0); 3449 } 3450 break; 3451 ··· 3541 priv->station_was_associated = priv->station_is_associated; 3542 atmel_enter_state(priv, STATION_STATE_READY); 3543 } else { 3544 + int auth = C80211_MGMT_AAN_OPENSYSTEM; 3545 priv->AuthenticationRequestRetryCnt = 0; 3546 atmel_enter_state(priv, STATION_STATE_AUTHENTICATING); 3547 3548 mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); 3549 priv->CurrentAuthentTransactionSeqNum = 0x0001; 3550 + if (priv->wep_is_on && priv->exclude_unencrypted) 3551 + auth = C80211_MGMT_AAN_SHAREDKEY; 3552 + send_authentication_request(priv, auth, NULL, 0); 3553 } 3554 return; 3555 }