提交 5b69e69d 编写于 作者: J John W. Linville

Merge branch 'upstream-fixes'

...@@ -1872,7 +1872,7 @@ static int atmel_set_encodeext(struct net_device *dev, ...@@ -1872,7 +1872,7 @@ static int atmel_set_encodeext(struct net_device *dev,
struct atmel_private *priv = netdev_priv(dev); struct atmel_private *priv = netdev_priv(dev);
struct iw_point *encoding = &wrqu->encoding; struct iw_point *encoding = &wrqu->encoding;
struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
int idx, key_len; int idx, key_len, alg = ext->alg, set_key = 1;
/* Determine and validate the key index */ /* Determine and validate the key index */
idx = encoding->flags & IW_ENCODE_INDEX; idx = encoding->flags & IW_ENCODE_INDEX;
...@@ -1883,39 +1883,42 @@ static int atmel_set_encodeext(struct net_device *dev, ...@@ -1883,39 +1883,42 @@ static int atmel_set_encodeext(struct net_device *dev,
} else } else
idx = priv->default_key; idx = priv->default_key;
if ((encoding->flags & IW_ENCODE_DISABLED) || if (encoding->flags & IW_ENCODE_DISABLED)
ext->alg == IW_ENCODE_ALG_NONE) { alg = IW_ENCODE_ALG_NONE;
priv->wep_is_on = 0;
priv->encryption_level = 0;
priv->pairwise_cipher_suite = CIPHER_SUITE_NONE;
}
if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) {
priv->default_key = idx; priv->default_key = idx;
set_key = ext->key_len > 0 ? 1 : 0;
}
/* Set the requested key */ if (set_key) {
switch (ext->alg) { /* Set the requested key first */
case IW_ENCODE_ALG_NONE: switch (alg) {
break; case IW_ENCODE_ALG_NONE:
case IW_ENCODE_ALG_WEP: priv->wep_is_on = 0;
if (ext->key_len > 5) { priv->encryption_level = 0;
priv->wep_key_len[idx] = 13; priv->pairwise_cipher_suite = CIPHER_SUITE_NONE;
priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_128; break;
priv->encryption_level = 2; case IW_ENCODE_ALG_WEP:
} else if (ext->key_len > 0) { if (ext->key_len > 5) {
priv->wep_key_len[idx] = 5; priv->wep_key_len[idx] = 13;
priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_64; priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_128;
priv->encryption_level = 1; priv->encryption_level = 2;
} else { } else if (ext->key_len > 0) {
priv->wep_key_len[idx] = 5;
priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_64;
priv->encryption_level = 1;
} else {
return -EINVAL;
}
priv->wep_is_on = 1;
memset(priv->wep_keys[idx], 0, 13);
key_len = min ((int)ext->key_len, priv->wep_key_len[idx]);
memcpy(priv->wep_keys[idx], ext->key, key_len);
break;
default:
return -EINVAL; return -EINVAL;
} }
priv->wep_is_on = 1;
memset(priv->wep_keys[idx], 0, 13);
key_len = min ((int)ext->key_len, priv->wep_key_len[idx]);
memcpy(priv->wep_keys[idx], ext->key, key_len);
break;
default:
return -EINVAL;
} }
return -EINPROGRESS; return -EINPROGRESS;
...@@ -3061,17 +3064,26 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) ...@@ -3061,17 +3064,26 @@ static void authenticate(struct atmel_private *priv, u16 frame_len)
} }
if (status == C80211_MGMT_SC_Success && priv->wep_is_on) { if (status == C80211_MGMT_SC_Success && priv->wep_is_on) {
int should_associate = 0;
/* WEP */ /* WEP */
if (trans_seq_no != priv->ExpectedAuthentTransactionSeqNum) if (trans_seq_no != priv->ExpectedAuthentTransactionSeqNum)
return; return;
if (trans_seq_no == 0x0002 && if (system == C80211_MGMT_AAN_OPENSYSTEM) {
auth->el_id == C80211_MGMT_ElementID_ChallengeText) { if (trans_seq_no == 0x0002) {
send_authentication_request(priv, system, auth->chall_text, auth->chall_text_len); should_associate = 1;
return; }
} else if (system == C80211_MGMT_AAN_SHAREDKEY) {
if (trans_seq_no == 0x0002 &&
auth->el_id == C80211_MGMT_ElementID_ChallengeText) {
send_authentication_request(priv, system, auth->chall_text, auth->chall_text_len);
return;
} else if (trans_seq_no == 0x0004) {
should_associate = 1;
}
} }
if (trans_seq_no == 0x0004) { if (should_associate) {
if(priv->station_was_associated) { if(priv->station_was_associated) {
atmel_enter_state(priv, STATION_STATE_REASSOCIATING); atmel_enter_state(priv, STATION_STATE_REASSOCIATING);
send_association_request(priv, 1); send_association_request(priv, 1);
...@@ -3084,11 +3096,13 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) ...@@ -3084,11 +3096,13 @@ static void authenticate(struct atmel_private *priv, u16 frame_len)
} }
} }
if (status == C80211_MGMT_SC_AuthAlgNotSupported) { if (status == WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG) {
/* Do opensystem first, then try sharedkey */ /* Do opensystem first, then try sharedkey */
if (system == C80211_MGMT_AAN_OPENSYSTEM) { if (system == WLAN_AUTH_OPEN) {
priv->CurrentAuthentTransactionSeqNum = 0x001; priv->CurrentAuthentTransactionSeqNum = 0x001;
send_authentication_request(priv, C80211_MGMT_AAN_SHAREDKEY, NULL, 0); priv->exclude_unencrypted = 1;
send_authentication_request(priv, WLAN_AUTH_SHARED_KEY, NULL, 0);
return;
} else if (priv->connect_to_any_BSS) { } else if (priv->connect_to_any_BSS) {
int bss_index; int bss_index;
...@@ -3439,10 +3453,13 @@ static void atmel_management_timer(u_long a) ...@@ -3439,10 +3453,13 @@ static void atmel_management_timer(u_long a)
priv->AuthenticationRequestRetryCnt = 0; priv->AuthenticationRequestRetryCnt = 0;
restart_search(priv); restart_search(priv);
} else { } else {
int auth = C80211_MGMT_AAN_OPENSYSTEM;
priv->AuthenticationRequestRetryCnt++; priv->AuthenticationRequestRetryCnt++;
priv->CurrentAuthentTransactionSeqNum = 0x0001; priv->CurrentAuthentTransactionSeqNum = 0x0001;
mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES);
send_authentication_request(priv, C80211_MGMT_AAN_OPENSYSTEM, NULL, 0); if (priv->wep_is_on && priv->exclude_unencrypted)
auth = C80211_MGMT_AAN_SHAREDKEY;
send_authentication_request(priv, auth, NULL, 0);
} }
break; break;
...@@ -3541,12 +3558,15 @@ static void atmel_command_irq(struct atmel_private *priv) ...@@ -3541,12 +3558,15 @@ static void atmel_command_irq(struct atmel_private *priv)
priv->station_was_associated = priv->station_is_associated; priv->station_was_associated = priv->station_is_associated;
atmel_enter_state(priv, STATION_STATE_READY); atmel_enter_state(priv, STATION_STATE_READY);
} else { } else {
int auth = C80211_MGMT_AAN_OPENSYSTEM;
priv->AuthenticationRequestRetryCnt = 0; priv->AuthenticationRequestRetryCnt = 0;
atmel_enter_state(priv, STATION_STATE_AUTHENTICATING); atmel_enter_state(priv, STATION_STATE_AUTHENTICATING);
mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES);
priv->CurrentAuthentTransactionSeqNum = 0x0001; priv->CurrentAuthentTransactionSeqNum = 0x0001;
send_authentication_request(priv, C80211_MGMT_AAN_SHAREDKEY, NULL, 0); if (priv->wep_is_on && priv->exclude_unencrypted)
auth = C80211_MGMT_AAN_SHAREDKEY;
send_authentication_request(priv, auth, NULL, 0);
} }
return; return;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册