diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2007-08-28 17:01:54 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:48:52 -0400 |
commit | f658eb90d065c2d76ab3f3eb676ebf53462e323b (patch) | |
tree | ff6cbdfc690114390c073fe94c5a28e27046ee78 | |
parent | 8f37171a6243a8370211a1e86d58be683ccf01f0 (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>
-rw-r--r-- | include/net/mac80211.h | 3 | ||||
-rw-r--r-- | net/mac80211/ieee80211_i.h | 5 | ||||
-rw-r--r-- | net/mac80211/ieee80211_iface.c | 5 | ||||
-rw-r--r-- | net/mac80211/ieee80211_ioctl.c | 97 | ||||
-rw-r--r-- | net/mac80211/sta_info.c | 6 |
5 files changed, 6 insertions, 110 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 056c225173d8..3437fa16eea5 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -632,8 +632,7 @@ struct ieee80211_ops { | |||
632 | * selected by the low-level driver. | 632 | * selected by the low-level driver. |
633 | */ | 633 | */ |
634 | int (*set_key)(struct ieee80211_hw *hw, set_key_cmd cmd, | 634 | int (*set_key)(struct ieee80211_hw *hw, set_key_cmd cmd, |
635 | u8 *address, struct ieee80211_key_conf *key, | 635 | u8 *address, struct ieee80211_key_conf *key); |
636 | int static_wep_only); | ||
637 | 636 | ||
638 | /* | 637 | /* |
639 | * Set TX key index for default/broadcast keys. This is needed in cases | 638 | * Set TX key index for default/broadcast keys. This is needed in cases |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index cc87e9d988f8..7b5cc146c81b 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -551,9 +551,6 @@ struct ieee80211_local { | |||
551 | #endif /* CONFIG_MAC80211_DEBUG_COUNTERS */ | 551 | #endif /* CONFIG_MAC80211_DEBUG_COUNTERS */ |
552 | 552 | ||
553 | 553 | ||
554 | int default_wep_only; /* only default WEP keys are used with this | ||
555 | * interface; this is used to decide when hwaccel | ||
556 | * can be used with default keys */ | ||
557 | int total_ps_buffered; /* total number of all buffered unicast and | 554 | int total_ps_buffered; /* total number of all buffered unicast and |
558 | * multicast packets for power saving stations | 555 | * multicast packets for power saving stations |
559 | */ | 556 | */ |
@@ -733,8 +730,6 @@ void ieee80211_key_threshold_notify(struct net_device *dev, | |||
733 | /* ieee80211_ioctl.c */ | 730 | /* ieee80211_ioctl.c */ |
734 | extern const struct iw_handler_def ieee80211_iw_handler_def; | 731 | extern const struct iw_handler_def ieee80211_iw_handler_def; |
735 | 732 | ||
736 | void ieee80211_update_default_wep_only(struct ieee80211_local *local); | ||
737 | |||
738 | 733 | ||
739 | /* Least common multiple of the used rates (in 100 kbps). This is used to | 734 | /* Least common multiple of the used rates (in 100 kbps). This is used to |
740 | * calculate rate_inv values for each rate so that only integers are needed. */ | 735 | * calculate rate_inv values for each rate so that only integers are needed. */ |
diff --git a/net/mac80211/ieee80211_iface.c b/net/mac80211/ieee80211_iface.c index 3e59afa23e4e..8bb85f194385 100644 --- a/net/mac80211/ieee80211_iface.c +++ b/net/mac80211/ieee80211_iface.c | |||
@@ -88,8 +88,6 @@ int ieee80211_if_add(struct net_device *dev, const char *name, | |||
88 | *new_dev = ndev; | 88 | *new_dev = ndev; |
89 | write_unlock_bh(&local->sub_if_lock); | 89 | write_unlock_bh(&local->sub_if_lock); |
90 | 90 | ||
91 | ieee80211_update_default_wep_only(local); | ||
92 | |||
93 | return 0; | 91 | return 0; |
94 | 92 | ||
95 | fail: | 93 | fail: |
@@ -154,7 +152,6 @@ void ieee80211_if_del_mgmt(struct ieee80211_local *local) | |||
154 | void ieee80211_if_set_type(struct net_device *dev, int type) | 152 | void ieee80211_if_set_type(struct net_device *dev, int type) |
155 | { | 153 | { |
156 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 154 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
157 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
158 | int oldtype = sdata->type; | 155 | int oldtype = sdata->type; |
159 | 156 | ||
160 | dev->hard_start_xmit = ieee80211_subif_start_xmit; | 157 | dev->hard_start_xmit = ieee80211_subif_start_xmit; |
@@ -205,7 +202,6 @@ void ieee80211_if_set_type(struct net_device *dev, int type) | |||
205 | dev->name, __FUNCTION__, type); | 202 | dev->name, __FUNCTION__, type); |
206 | } | 203 | } |
207 | ieee80211_debugfs_change_if_type(sdata, oldtype); | 204 | ieee80211_debugfs_change_if_type(sdata, oldtype); |
208 | ieee80211_update_default_wep_only(local); | ||
209 | } | 205 | } |
210 | 206 | ||
211 | /* Must be called with rtnl lock held. */ | 207 | /* Must be called with rtnl lock held. */ |
@@ -336,7 +332,6 @@ int ieee80211_if_remove(struct net_device *dev, const char *name, int id) | |||
336 | list_del(&sdata->list); | 332 | list_del(&sdata->list); |
337 | write_unlock_bh(&local->sub_if_lock); | 333 | write_unlock_bh(&local->sub_if_lock); |
338 | __ieee80211_if_del(local, sdata); | 334 | __ieee80211_if_del(local, sdata); |
339 | ieee80211_update_default_wep_only(local); | ||
340 | return 0; | 335 | return 0; |
341 | } | 336 | } |
342 | } | 337 | } |
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 | ||
927 | static 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 | |||
946 | static 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 | |||
965 | static 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 | |||
987 | void 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 | |||
1017 | static int ieee80211_ioctl_prism2_param(struct net_device *dev, | 926 | static 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) |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 7e10c692c4ad..a1f766fcf966 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -230,8 +230,7 @@ void sta_info_free(struct sta_info *sta) | |||
230 | if (local->ops->set_key) { | 230 | if (local->ops->set_key) { |
231 | local->ops->set_key(local_to_hw(local), | 231 | local->ops->set_key(local_to_hw(local), |
232 | DISABLE_KEY, sta->addr, | 232 | DISABLE_KEY, sta->addr, |
233 | &sta->key->conf, | 233 | &sta->key->conf); |
234 | local->default_wep_only); | ||
235 | } | 234 | } |
236 | } else if (sta->key_idx_compression != HW_KEY_IDX_INVALID) { | 235 | } else if (sta->key_idx_compression != HW_KEY_IDX_INVALID) { |
237 | struct ieee80211_key_conf conf; | 236 | struct ieee80211_key_conf conf; |
@@ -240,8 +239,7 @@ void sta_info_free(struct sta_info *sta) | |||
240 | conf.alg = ALG_NONE; | 239 | conf.alg = ALG_NONE; |
241 | conf.flags |= IEEE80211_KEY_FORCE_SW_ENCRYPT; | 240 | conf.flags |= IEEE80211_KEY_FORCE_SW_ENCRYPT; |
242 | local->ops->set_key(local_to_hw(local), DISABLE_KEY, | 241 | local->ops->set_key(local_to_hw(local), DISABLE_KEY, |
243 | sta->addr, &conf, | 242 | sta->addr, &conf); |
244 | local->default_wep_only); | ||
245 | sta->key_idx_compression = HW_KEY_IDX_INVALID; | 243 | sta->key_idx_compression = HW_KEY_IDX_INVALID; |
246 | } | 244 | } |
247 | 245 | ||