aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/ieee80211_ioctl.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2007-09-26 11:53:17 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:54:18 -0400
commit628a140ba033ef201706a8c7e767c8a0c0f8326c (patch)
tree7aae1dbc152bf9180fee3d238f224c2f4b1741b5 /net/mac80211/ieee80211_ioctl.c
parent640845a5632390eaa9357cd818646c8f0ee3d47e (diff)
[MAC80211]: remove ALG_NONE
This "algorithm" is used only internally and is not useful. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Cc: Michael Buesch <mb@bu3sch.de> Acked-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mac80211/ieee80211_ioctl.c')
-rw-r--r--net/mac80211/ieee80211_ioctl.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c
index 48e68434b38a..6c8e73e0d29d 100644
--- a/net/mac80211/ieee80211_ioctl.c
+++ b/net/mac80211/ieee80211_ioctl.c
@@ -27,8 +27,9 @@
27 27
28 28
29static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr, 29static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr,
30 int idx, int alg, int set_tx_key, 30 int idx, int alg, int remove,
31 const u8 *_key, size_t key_len) 31 int set_tx_key, const u8 *_key,
32 size_t key_len)
32{ 33{
33 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 34 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
34 int ret = 0; 35 int ret = 0;
@@ -75,7 +76,7 @@ static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr,
75 key = sta->key; 76 key = sta->key;
76 } 77 }
77 78
78 if (alg == ALG_NONE) { 79 if (remove) {
79 ieee80211_key_free(key); 80 ieee80211_key_free(key);
80 key = NULL; 81 key = NULL;
81 } else { 82 } else {
@@ -827,6 +828,7 @@ static int ieee80211_ioctl_siwencode(struct net_device *dev,
827 struct ieee80211_sub_if_data *sdata; 828 struct ieee80211_sub_if_data *sdata;
828 int idx, i, alg = ALG_WEP; 829 int idx, i, alg = ALG_WEP;
829 u8 bcaddr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; 830 u8 bcaddr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
831 int remove = 0;
830 832
831 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 833 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
832 834
@@ -845,7 +847,7 @@ static int ieee80211_ioctl_siwencode(struct net_device *dev,
845 idx--; 847 idx--;
846 848
847 if (erq->flags & IW_ENCODE_DISABLED) 849 if (erq->flags & IW_ENCODE_DISABLED)
848 alg = ALG_NONE; 850 remove = 1;
849 else if (erq->length == 0) { 851 else if (erq->length == 0) {
850 /* No key data - just set the default TX key index */ 852 /* No key data - just set the default TX key index */
851 ieee80211_set_default_key(sdata, idx); 853 ieee80211_set_default_key(sdata, idx);
@@ -854,7 +856,7 @@ static int ieee80211_ioctl_siwencode(struct net_device *dev,
854 856
855 return ieee80211_set_encryption( 857 return ieee80211_set_encryption(
856 dev, bcaddr, 858 dev, bcaddr,
857 idx, alg, 859 idx, alg, remove,
858 !sdata->default_key, 860 !sdata->default_key,
859 keybuf, erq->length); 861 keybuf, erq->length);
860} 862}
@@ -1005,11 +1007,11 @@ static int ieee80211_ioctl_siwencodeext(struct net_device *dev,
1005{ 1007{
1006 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1008 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1007 struct iw_encode_ext *ext = (struct iw_encode_ext *) extra; 1009 struct iw_encode_ext *ext = (struct iw_encode_ext *) extra;
1008 int alg, idx, i; 1010 int uninitialized_var(alg), idx, i, remove = 0;
1009 1011
1010 switch (ext->alg) { 1012 switch (ext->alg) {
1011 case IW_ENCODE_ALG_NONE: 1013 case IW_ENCODE_ALG_NONE:
1012 alg = ALG_NONE; 1014 remove = 1;
1013 break; 1015 break;
1014 case IW_ENCODE_ALG_WEP: 1016 case IW_ENCODE_ALG_WEP:
1015 alg = ALG_WEP; 1017 alg = ALG_WEP;
@@ -1025,7 +1027,7 @@ static int ieee80211_ioctl_siwencodeext(struct net_device *dev,
1025 } 1027 }
1026 1028
1027 if (erq->flags & IW_ENCODE_DISABLED) 1029 if (erq->flags & IW_ENCODE_DISABLED)
1028 alg = ALG_NONE; 1030 remove = 1;
1029 1031
1030 idx = erq->flags & IW_ENCODE_INDEX; 1032 idx = erq->flags & IW_ENCODE_INDEX;
1031 if (idx < 1 || idx > 4) { 1033 if (idx < 1 || idx > 4) {
@@ -1044,6 +1046,7 @@ static int ieee80211_ioctl_siwencodeext(struct net_device *dev,
1044 idx--; 1046 idx--;
1045 1047
1046 return ieee80211_set_encryption(dev, ext->addr.sa_data, idx, alg, 1048 return ieee80211_set_encryption(dev, ext->addr.sa_data, idx, alg,
1049 remove,
1047 ext->ext_flags & 1050 ext->ext_flags &
1048 IW_ENCODE_EXT_SET_TX_KEY, 1051 IW_ENCODE_EXT_SET_TX_KEY,
1049 ext->key, ext->key_len); 1052 ext->key, ext->key_len);