aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2006-02-05 17:52:21 -0500
committerJohn W. Linville <linville@tuxdriver.com>2006-02-17 08:12:57 -0500
commit0d467502b7fc2656f01d7f18ab290c8d41762018 (patch)
tree1eccba8c615b20d672691d9e293a3af005f0045a /drivers/net
parentab479995b191b4256183956c13caabb86331af8e (diff)
[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: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/atmel.c61
1 files changed, 32 insertions, 29 deletions
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index 98a76f10a0f7..c1c27e10b8df 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;