aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/ieee80211_ioctl.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2007-08-28 17:01:54 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:48:52 -0400
commitf658eb90d065c2d76ab3f3eb676ebf53462e323b (patch)
treeff6cbdfc690114390c073fe94c5a28e27046ee78 /net/mac80211/ieee80211_ioctl.c
parent8f37171a6243a8370211a1e86d58be683ccf01f0 (diff)
[MAC80211] key handling: remove default_wep_only
Remove the default_wep_only stuff, this wasn't really done well and no current driver actually cares. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Acked-by: Michael Wu <flamingice@sourmilk.net> 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.c97
1 files changed, 3 insertions, 94 deletions
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c
index 380670c7a0ca..dc05bc66fbb8 100644
--- a/net/mac80211/ieee80211_ioctl.c
+++ b/net/mac80211/ieee80211_ioctl.c
@@ -40,7 +40,7 @@ static void ieee80211_set_hw_encryption(struct net_device *dev,
40 40
41 if (key && local->ops->set_key) { 41 if (key && local->ops->set_key) {
42 if (local->ops->set_key(local_to_hw(local), SET_KEY, addr, 42 if (local->ops->set_key(local_to_hw(local), SET_KEY, addr,
43 &key->conf, local->default_wep_only)) { 43 &key->conf)) {
44 key->conf.flags |= IEEE80211_KEY_FORCE_SW_ENCRYPT; 44 key->conf.flags |= IEEE80211_KEY_FORCE_SW_ENCRYPT;
45 key->conf.hw_key_idx = HW_KEY_IDX_INVALID; 45 key->conf.hw_key_idx = HW_KEY_IDX_INVALID;
46 } 46 }
@@ -111,7 +111,7 @@ static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr,
111 * possibility of conflict with default keys. This can maybe later be 111 * possibility of conflict with default keys. This can maybe later be
112 * optimized by using non-default keys (at least with Atheros ar521x). 112 * optimized by using non-default keys (at least with Atheros ar521x).
113 */ 113 */
114 if (!sta && alg == ALG_WEP && !local->default_wep_only && 114 if (!sta && alg == ALG_WEP &&
115 sdata->type != IEEE80211_IF_TYPE_IBSS && 115 sdata->type != IEEE80211_IF_TYPE_IBSS &&
116 sdata->type != IEEE80211_IF_TYPE_AP) { 116 sdata->type != IEEE80211_IF_TYPE_AP) {
117 try_hwaccel = 0; 117 try_hwaccel = 0;
@@ -148,8 +148,7 @@ static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr,
148 key->conf.hw_key_idx != HW_KEY_IDX_INVALID && 148 key->conf.hw_key_idx != HW_KEY_IDX_INVALID &&
149 local->ops->set_key && 149 local->ops->set_key &&
150 local->ops->set_key(local_to_hw(local), DISABLE_KEY, 150 local->ops->set_key(local_to_hw(local), DISABLE_KEY,
151 sta_addr, &key->conf, 151 sta_addr, &key->conf)) {
152 local->default_wep_only)) {
153 printk(KERN_DEBUG "%s: set_encrypt - low-level disable" 152 printk(KERN_DEBUG "%s: set_encrypt - low-level disable"
154 " failed\n", dev->name); 153 " failed\n", dev->name);
155 ret = -EINVAL; 154 ret = -EINVAL;
@@ -924,96 +923,6 @@ static int ieee80211_ioctl_giwretry(struct net_device *dev,
924 return 0; 923 return 0;
925} 924}
926 925
927static void ieee80211_key_enable_hwaccel(struct ieee80211_local *local,
928 struct ieee80211_key *key)
929{
930 u8 addr[ETH_ALEN];
931
932 if (!key || key->conf.alg != ALG_WEP ||
933 !(key->conf.flags & IEEE80211_KEY_FORCE_SW_ENCRYPT) ||
934 (local->hw.flags & IEEE80211_HW_DEVICE_HIDES_WEP))
935 return;
936
937 memset(addr, 0xff, ETH_ALEN);
938
939 if (local->ops->set_key)
940 local->ops->set_key(local_to_hw(local),
941 SET_KEY, addr, &key->conf,
942 local->default_wep_only);
943}
944
945
946static void ieee80211_key_disable_hwaccel(struct ieee80211_local *local,
947 struct ieee80211_key *key)
948{
949 u8 addr[ETH_ALEN];
950
951 if (!key || key->conf.alg != ALG_WEP ||
952 (key->conf.flags & IEEE80211_KEY_FORCE_SW_ENCRYPT) ||
953 (local->hw.flags & IEEE80211_HW_DEVICE_HIDES_WEP))
954 return;
955
956 memset(addr, 0xff, ETH_ALEN);
957 if (local->ops->set_key)
958 local->ops->set_key(local_to_hw(local), DISABLE_KEY,
959 addr, &key->conf,
960 local->default_wep_only);
961 key->conf.flags |= IEEE80211_KEY_FORCE_SW_ENCRYPT;
962}
963
964
965static int ieee80211_ioctl_default_wep_only(struct ieee80211_local *local,
966 int value)
967{
968 int i;
969 struct ieee80211_sub_if_data *sdata;
970
971 local->default_wep_only = value;
972 read_lock(&local->sub_if_lock);
973 list_for_each_entry(sdata, &local->sub_if_list, list)
974 for (i = 0; i < NUM_DEFAULT_KEYS; i++)
975 if (value)
976 ieee80211_key_enable_hwaccel(local,
977 sdata->keys[i]);
978 else
979 ieee80211_key_disable_hwaccel(local,
980 sdata->keys[i]);
981 read_unlock(&local->sub_if_lock);
982
983 return 0;
984}
985
986
987void ieee80211_update_default_wep_only(struct ieee80211_local *local)
988{
989 int i = 0;
990 struct ieee80211_sub_if_data *sdata;
991
992 read_lock(&local->sub_if_lock);
993 list_for_each_entry(sdata, &local->sub_if_list, list) {
994
995 if (sdata->dev == local->mdev)
996 continue;
997
998 /* If there is an AP interface then depend on userspace to
999 set default_wep_only correctly. */
1000 if (sdata->type == IEEE80211_IF_TYPE_AP) {
1001 read_unlock(&local->sub_if_lock);
1002 return;
1003 }
1004
1005 i++;
1006 }
1007
1008 read_unlock(&local->sub_if_lock);
1009
1010 if (i <= 1)
1011 ieee80211_ioctl_default_wep_only(local, 1);
1012 else
1013 ieee80211_ioctl_default_wep_only(local, 0);
1014}
1015
1016
1017static int ieee80211_ioctl_prism2_param(struct net_device *dev, 926static int ieee80211_ioctl_prism2_param(struct net_device *dev,
1018 struct iw_request_info *info, 927 struct iw_request_info *info,
1019 void *wrqu, char *extra) 928 void *wrqu, char *extra)