Fixed WEP on ipw2100 (priv->sec was being used instead of

priv->ieee->sec)
This commit is contained in:
2005-07-12 15:45:30 -05:00 committed by James Ketrenos
parent 823283549d
commit 25b645be1e
2 changed files with 51 additions and 48 deletions

View File

@ -1616,7 +1616,7 @@ static int ipw2100_set_scan_options(struct ipw2100_priv *priv)
if (!(priv->config & CFG_ASSOCIATE)) if (!(priv->config & CFG_ASSOCIATE))
cmd.host_command_parameters[0] |= IPW_SCAN_NOASSOCIATE; cmd.host_command_parameters[0] |= IPW_SCAN_NOASSOCIATE;
if ((priv->sec.flags & SEC_ENABLED) && priv->sec.enabled) if ((priv->ieee->sec.flags & SEC_ENABLED) && priv->ieee->sec.enabled)
cmd.host_command_parameters[0] |= IPW_SCAN_MIXED_CELL; cmd.host_command_parameters[0] |= IPW_SCAN_MIXED_CELL;
if (priv->config & CFG_PASSIVE_SCAN) if (priv->config & CFG_PASSIVE_SCAN)
cmd.host_command_parameters[0] |= IPW_SCAN_PASSIVE; cmd.host_command_parameters[0] |= IPW_SCAN_PASSIVE;
@ -5349,23 +5349,23 @@ static int ipw2100_configure_security(struct ipw2100_priv *priv, int batch_mode)
return err; return err;
} }
if (!priv->sec.enabled) { if (!priv->ieee->sec.enabled) {
err = err =
ipw2100_set_security_information(priv, IPW_AUTH_OPEN, ipw2100_set_security_information(priv, IPW_AUTH_OPEN,
SEC_LEVEL_0, 0, 1); SEC_LEVEL_0, 0, 1);
} else { } else {
auth_mode = IPW_AUTH_OPEN; auth_mode = IPW_AUTH_OPEN;
if ((priv->sec.flags & SEC_AUTH_MODE) && if ((priv->ieee->sec.flags & SEC_AUTH_MODE) &&
(priv->sec.auth_mode == WLAN_AUTH_SHARED_KEY)) (priv->ieee->sec.auth_mode == WLAN_AUTH_SHARED_KEY))
auth_mode = IPW_AUTH_SHARED; auth_mode = IPW_AUTH_SHARED;
sec_level = SEC_LEVEL_0; sec_level = SEC_LEVEL_0;
if (priv->sec.flags & SEC_LEVEL) if (priv->ieee->sec.flags & SEC_LEVEL)
sec_level = priv->sec.level; sec_level = priv->ieee->sec.level;
use_group = 0; use_group = 0;
if (priv->sec.flags & SEC_UNICAST_GROUP) if (priv->ieee->sec.flags & SEC_UNICAST_GROUP)
use_group = priv->sec.unicast_uses_group; use_group = priv->ieee->sec.unicast_uses_group;
err = err =
ipw2100_set_security_information(priv, auth_mode, sec_level, ipw2100_set_security_information(priv, auth_mode, sec_level,
@ -5375,16 +5375,16 @@ static int ipw2100_configure_security(struct ipw2100_priv *priv, int batch_mode)
if (err) if (err)
goto exit; goto exit;
if (priv->sec.enabled) { if (priv->ieee->sec.enabled) {
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
if (!(priv->sec.flags & (1 << i))) { if (!(priv->ieee->sec.flags & (1 << i))) {
memset(priv->sec.keys[i], 0, WEP_KEY_LEN); memset(priv->ieee->sec.keys[i], 0, WEP_KEY_LEN);
priv->sec.key_sizes[i] = 0; priv->ieee->sec.key_sizes[i] = 0;
} else { } else {
err = ipw2100_set_key(priv, i, err = ipw2100_set_key(priv, i,
priv->sec.keys[i], priv->ieee->sec.keys[i],
priv->sec.key_sizes[i], priv->ieee->sec.
1); key_sizes[i], 1);
if (err) if (err)
goto exit; goto exit;
} }
@ -5397,8 +5397,8 @@ static int ipw2100_configure_security(struct ipw2100_priv *priv, int batch_mode)
* encrypted data is sent up */ * encrypted data is sent up */
err = err =
ipw2100_set_wep_flags(priv, ipw2100_set_wep_flags(priv,
priv->sec.enabled ? IPW_PRIVACY_CAPABLE : 0, priv->ieee->sec.
1); enabled ? IPW_PRIVACY_CAPABLE : 0, 1);
if (err) if (err)
goto exit; goto exit;
@ -5433,58 +5433,61 @@ static void shim__set_security(struct net_device *dev,
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
if (sec->flags & (1 << i)) { if (sec->flags & (1 << i)) {
priv->sec.key_sizes[i] = sec->key_sizes[i]; priv->ieee->sec.key_sizes[i] = sec->key_sizes[i];
if (sec->key_sizes[i] == 0) if (sec->key_sizes[i] == 0)
priv->sec.flags &= ~(1 << i); priv->ieee->sec.flags &= ~(1 << i);
else else
memcpy(priv->sec.keys[i], sec->keys[i], memcpy(priv->ieee->sec.keys[i], sec->keys[i],
sec->key_sizes[i]); sec->key_sizes[i]);
priv->sec.flags |= (1 << i); priv->ieee->sec.flags |= (1 << i);
priv->status |= STATUS_SECURITY_UPDATED; priv->status |= STATUS_SECURITY_UPDATED;
} }
} }
if ((sec->flags & SEC_ACTIVE_KEY) && if ((sec->flags & SEC_ACTIVE_KEY) &&
priv->sec.active_key != sec->active_key) { priv->ieee->sec.active_key != sec->active_key) {
if (sec->active_key <= 3) { if (sec->active_key <= 3) {
priv->sec.active_key = sec->active_key; priv->ieee->sec.active_key = sec->active_key;
priv->sec.flags |= SEC_ACTIVE_KEY; priv->ieee->sec.flags |= SEC_ACTIVE_KEY;
} else } else
priv->sec.flags &= ~SEC_ACTIVE_KEY; priv->ieee->sec.flags &= ~SEC_ACTIVE_KEY;
priv->status |= STATUS_SECURITY_UPDATED; priv->status |= STATUS_SECURITY_UPDATED;
} }
if ((sec->flags & SEC_AUTH_MODE) && if ((sec->flags & SEC_AUTH_MODE) &&
(priv->sec.auth_mode != sec->auth_mode)) { (priv->ieee->sec.auth_mode != sec->auth_mode)) {
priv->sec.auth_mode = sec->auth_mode; priv->ieee->sec.auth_mode = sec->auth_mode;
priv->sec.flags |= SEC_AUTH_MODE; priv->ieee->sec.flags |= SEC_AUTH_MODE;
priv->status |= STATUS_SECURITY_UPDATED; priv->status |= STATUS_SECURITY_UPDATED;
} }
if (sec->flags & SEC_ENABLED && priv->sec.enabled != sec->enabled) { if (sec->flags & SEC_ENABLED && priv->ieee->sec.enabled != sec->enabled) {
priv->sec.flags |= SEC_ENABLED; priv->ieee->sec.flags |= SEC_ENABLED;
priv->sec.enabled = sec->enabled; priv->ieee->sec.enabled = sec->enabled;
priv->status |= STATUS_SECURITY_UPDATED; priv->status |= STATUS_SECURITY_UPDATED;
force_update = 1; force_update = 1;
} }
if (sec->flags & SEC_LEVEL && priv->sec.level != sec->level) { if (sec->flags & SEC_ENCRYPT)
priv->sec.level = sec->level; priv->ieee->sec.encrypt = sec->encrypt;
priv->sec.flags |= SEC_LEVEL;
if (sec->flags & SEC_LEVEL && priv->ieee->sec.level != sec->level) {
priv->ieee->sec.level = sec->level;
priv->ieee->sec.flags |= SEC_LEVEL;
priv->status |= STATUS_SECURITY_UPDATED; priv->status |= STATUS_SECURITY_UPDATED;
} }
IPW_DEBUG_WEP("Security flags: %c %c%c%c%c %c%c%c%c\n", IPW_DEBUG_WEP("Security flags: %c %c%c%c%c %c%c%c%c\n",
priv->sec.flags & (1 << 8) ? '1' : '0', priv->ieee->sec.flags & (1 << 8) ? '1' : '0',
priv->sec.flags & (1 << 7) ? '1' : '0', priv->ieee->sec.flags & (1 << 7) ? '1' : '0',
priv->sec.flags & (1 << 6) ? '1' : '0', priv->ieee->sec.flags & (1 << 6) ? '1' : '0',
priv->sec.flags & (1 << 5) ? '1' : '0', priv->ieee->sec.flags & (1 << 5) ? '1' : '0',
priv->sec.flags & (1 << 4) ? '1' : '0', priv->ieee->sec.flags & (1 << 4) ? '1' : '0',
priv->sec.flags & (1 << 3) ? '1' : '0', priv->ieee->sec.flags & (1 << 3) ? '1' : '0',
priv->sec.flags & (1 << 2) ? '1' : '0', priv->ieee->sec.flags & (1 << 2) ? '1' : '0',
priv->sec.flags & (1 << 1) ? '1' : '0', priv->ieee->sec.flags & (1 << 1) ? '1' : '0',
priv->sec.flags & (1 << 0) ? '1' : '0'); priv->ieee->sec.flags & (1 << 0) ? '1' : '0');
/* As a temporary work around to enable WPA until we figure out why /* As a temporary work around to enable WPA until we figure out why
* wpa_supplicant toggles the security capability of the driver, which * wpa_supplicant toggles the security capability of the driver, which
@ -5995,17 +5998,19 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev,
return -EINVAL; return -EINVAL;
} }
sec.flags |= SEC_ENABLED | SEC_ENCRYPT;
if (strcmp(param->u.crypt.alg, "none") == 0) { if (strcmp(param->u.crypt.alg, "none") == 0) {
if (crypt) { if (crypt) {
sec.enabled = 0; sec.enabled = 0;
sec.encrypt = 0;
sec.level = SEC_LEVEL_0; sec.level = SEC_LEVEL_0;
sec.flags |= SEC_ENABLED | SEC_LEVEL; sec.flags |= SEC_LEVEL;
ieee80211_crypt_delayed_deinit(ieee, crypt); ieee80211_crypt_delayed_deinit(ieee, crypt);
} }
goto done; goto done;
} }
sec.enabled = 1; sec.enabled = 1;
sec.flags |= SEC_ENABLED; sec.encrypt = 1;
ops = ieee80211_get_crypto_ops(param->u.crypt.alg); ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) { if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) {
@ -8029,7 +8034,7 @@ static int ipw2100_wx_get_auth(struct net_device *dev,
break; break;
case IW_AUTH_80211_AUTH_ALG: case IW_AUTH_80211_AUTH_ALG:
param->value = priv->sec.auth_mode; param->value = priv->ieee->sec.auth_mode;
break; break;
case IW_AUTH_WPA_ENABLED: case IW_AUTH_WPA_ENABLED:

View File

@ -524,8 +524,6 @@ struct ipw2100_priv {
int power_mode; int power_mode;
/* WEP data */
struct ieee80211_security sec;
int messages_sent; int messages_sent;
int short_retry_limit; int short_retry_limit;