Commit 0d467502 authored by Dan Williams's avatar Dan Williams Committed by John W. Linville

[PATCH] wireless/atmel: fix setting TX key only in ENCODEEXT

The previous patch that added ENCODEEXT and AUTH support to the atmel
driver contained a slight error which would cause just setting the TX
key index to also set the encryption key again.  This patch allows any
combination of setting the TX key index and setting an encryption key.
Signed-off-by: default avatarDan Williams <dcbw@redhat.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent ab479995
...@@ -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,19 +1883,21 @@ static int atmel_set_encodeext(struct net_device *dev, ...@@ -1883,19 +1883,21 @@ 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 */
switch (alg) {
case IW_ENCODE_ALG_NONE: case IW_ENCODE_ALG_NONE:
priv->wep_is_on = 0;
priv->encryption_level = 0;
priv->pairwise_cipher_suite = CIPHER_SUITE_NONE;
break; break;
case IW_ENCODE_ALG_WEP: case IW_ENCODE_ALG_WEP:
if (ext->key_len > 5) { if (ext->key_len > 5) {
...@@ -1917,6 +1919,7 @@ static int atmel_set_encodeext(struct net_device *dev, ...@@ -1917,6 +1919,7 @@ static int atmel_set_encodeext(struct net_device *dev,
default: default:
return -EINVAL; return -EINVAL;
} }
}
return -EINPROGRESS; return -EINPROGRESS;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment