Commit f658eb90 authored by Johannes Berg's avatar Johannes Berg Committed by David S. Miller

[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: default avatarJohannes Berg <johannes@sipsolutions.net>
Acked-by: default avatarMichael Wu <flamingice@sourmilk.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8f37171a
...@@ -632,8 +632,7 @@ struct ieee80211_ops { ...@@ -632,8 +632,7 @@ struct ieee80211_ops {
* selected by the low-level driver. * selected by the low-level driver.
*/ */
int (*set_key)(struct ieee80211_hw *hw, set_key_cmd cmd, int (*set_key)(struct ieee80211_hw *hw, set_key_cmd cmd,
u8 *address, struct ieee80211_key_conf *key, u8 *address, struct ieee80211_key_conf *key);
int static_wep_only);
/* /*
* Set TX key index for default/broadcast keys. This is needed in cases * Set TX key index for default/broadcast keys. This is needed in cases
......
...@@ -551,9 +551,6 @@ struct ieee80211_local { ...@@ -551,9 +551,6 @@ struct ieee80211_local {
#endif /* CONFIG_MAC80211_DEBUG_COUNTERS */ #endif /* CONFIG_MAC80211_DEBUG_COUNTERS */
int default_wep_only; /* only default WEP keys are used with this
* interface; this is used to decide when hwaccel
* can be used with default keys */
int total_ps_buffered; /* total number of all buffered unicast and int total_ps_buffered; /* total number of all buffered unicast and
* multicast packets for power saving stations * multicast packets for power saving stations
*/ */
...@@ -733,8 +730,6 @@ void ieee80211_key_threshold_notify(struct net_device *dev, ...@@ -733,8 +730,6 @@ void ieee80211_key_threshold_notify(struct net_device *dev,
/* ieee80211_ioctl.c */ /* ieee80211_ioctl.c */
extern const struct iw_handler_def ieee80211_iw_handler_def; extern const struct iw_handler_def ieee80211_iw_handler_def;
void ieee80211_update_default_wep_only(struct ieee80211_local *local);
/* Least common multiple of the used rates (in 100 kbps). This is used to /* Least common multiple of the used rates (in 100 kbps). This is used to
* calculate rate_inv values for each rate so that only integers are needed. */ * calculate rate_inv values for each rate so that only integers are needed. */
......
...@@ -88,8 +88,6 @@ int ieee80211_if_add(struct net_device *dev, const char *name, ...@@ -88,8 +88,6 @@ int ieee80211_if_add(struct net_device *dev, const char *name,
*new_dev = ndev; *new_dev = ndev;
write_unlock_bh(&local->sub_if_lock); write_unlock_bh(&local->sub_if_lock);
ieee80211_update_default_wep_only(local);
return 0; return 0;
fail: fail:
...@@ -154,7 +152,6 @@ void ieee80211_if_del_mgmt(struct ieee80211_local *local) ...@@ -154,7 +152,6 @@ void ieee80211_if_del_mgmt(struct ieee80211_local *local)
void ieee80211_if_set_type(struct net_device *dev, int type) void ieee80211_if_set_type(struct net_device *dev, int type)
{ {
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
int oldtype = sdata->type; int oldtype = sdata->type;
dev->hard_start_xmit = ieee80211_subif_start_xmit; dev->hard_start_xmit = ieee80211_subif_start_xmit;
...@@ -205,7 +202,6 @@ void ieee80211_if_set_type(struct net_device *dev, int type) ...@@ -205,7 +202,6 @@ void ieee80211_if_set_type(struct net_device *dev, int type)
dev->name, __FUNCTION__, type); dev->name, __FUNCTION__, type);
} }
ieee80211_debugfs_change_if_type(sdata, oldtype); ieee80211_debugfs_change_if_type(sdata, oldtype);
ieee80211_update_default_wep_only(local);
} }
/* Must be called with rtnl lock held. */ /* 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,7 +332,6 @@ int ieee80211_if_remove(struct net_device *dev, const char *name, int id)
list_del(&sdata->list); list_del(&sdata->list);
write_unlock_bh(&local->sub_if_lock); write_unlock_bh(&local->sub_if_lock);
__ieee80211_if_del(local, sdata); __ieee80211_if_del(local, sdata);
ieee80211_update_default_wep_only(local);
return 0; return 0;
} }
} }
......
...@@ -40,7 +40,7 @@ static void ieee80211_set_hw_encryption(struct net_device *dev, ...@@ -40,7 +40,7 @@ static void ieee80211_set_hw_encryption(struct net_device *dev,
if (key && local->ops->set_key) { if (key && local->ops->set_key) {
if (local->ops->set_key(local_to_hw(local), SET_KEY, addr, if (local->ops->set_key(local_to_hw(local), SET_KEY, addr,
&key->conf, local->default_wep_only)) { &key->conf)) {
key->conf.flags |= IEEE80211_KEY_FORCE_SW_ENCRYPT; key->conf.flags |= IEEE80211_KEY_FORCE_SW_ENCRYPT;
key->conf.hw_key_idx = HW_KEY_IDX_INVALID; key->conf.hw_key_idx = HW_KEY_IDX_INVALID;
} }
...@@ -111,7 +111,7 @@ static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr, ...@@ -111,7 +111,7 @@ static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr,
* possibility of conflict with default keys. This can maybe later be * possibility of conflict with default keys. This can maybe later be
* optimized by using non-default keys (at least with Atheros ar521x). * optimized by using non-default keys (at least with Atheros ar521x).
*/ */
if (!sta && alg == ALG_WEP && !local->default_wep_only && if (!sta && alg == ALG_WEP &&
sdata->type != IEEE80211_IF_TYPE_IBSS && sdata->type != IEEE80211_IF_TYPE_IBSS &&
sdata->type != IEEE80211_IF_TYPE_AP) { sdata->type != IEEE80211_IF_TYPE_AP) {
try_hwaccel = 0; try_hwaccel = 0;
...@@ -148,8 +148,7 @@ static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr, ...@@ -148,8 +148,7 @@ static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr,
key->conf.hw_key_idx != HW_KEY_IDX_INVALID && key->conf.hw_key_idx != HW_KEY_IDX_INVALID &&
local->ops->set_key && local->ops->set_key &&
local->ops->set_key(local_to_hw(local), DISABLE_KEY, local->ops->set_key(local_to_hw(local), DISABLE_KEY,
sta_addr, &key->conf, sta_addr, &key->conf)) {
local->default_wep_only)) {
printk(KERN_DEBUG "%s: set_encrypt - low-level disable" printk(KERN_DEBUG "%s: set_encrypt - low-level disable"
" failed\n", dev->name); " failed\n", dev->name);
ret = -EINVAL; ret = -EINVAL;
...@@ -924,96 +923,6 @@ static int ieee80211_ioctl_giwretry(struct net_device *dev, ...@@ -924,96 +923,6 @@ static int ieee80211_ioctl_giwretry(struct net_device *dev,
return 0; return 0;
} }
static void ieee80211_key_enable_hwaccel(struct ieee80211_local *local,
struct ieee80211_key *key)
{
u8 addr[ETH_ALEN];
if (!key || key->conf.alg != ALG_WEP ||
!(key->conf.flags & IEEE80211_KEY_FORCE_SW_ENCRYPT) ||
(local->hw.flags & IEEE80211_HW_DEVICE_HIDES_WEP))
return;
memset(addr, 0xff, ETH_ALEN);
if (local->ops->set_key)
local->ops->set_key(local_to_hw(local),
SET_KEY, addr, &key->conf,
local->default_wep_only);
}
static void ieee80211_key_disable_hwaccel(struct ieee80211_local *local,
struct ieee80211_key *key)
{
u8 addr[ETH_ALEN];
if (!key || key->conf.alg != ALG_WEP ||
(key->conf.flags & IEEE80211_KEY_FORCE_SW_ENCRYPT) ||
(local->hw.flags & IEEE80211_HW_DEVICE_HIDES_WEP))
return;
memset(addr, 0xff, ETH_ALEN);
if (local->ops->set_key)
local->ops->set_key(local_to_hw(local), DISABLE_KEY,
addr, &key->conf,
local->default_wep_only);
key->conf.flags |= IEEE80211_KEY_FORCE_SW_ENCRYPT;
}
static int ieee80211_ioctl_default_wep_only(struct ieee80211_local *local,
int value)
{
int i;
struct ieee80211_sub_if_data *sdata;
local->default_wep_only = value;
read_lock(&local->sub_if_lock);
list_for_each_entry(sdata, &local->sub_if_list, list)
for (i = 0; i < NUM_DEFAULT_KEYS; i++)
if (value)
ieee80211_key_enable_hwaccel(local,
sdata->keys[i]);
else
ieee80211_key_disable_hwaccel(local,
sdata->keys[i]);
read_unlock(&local->sub_if_lock);
return 0;
}
void ieee80211_update_default_wep_only(struct ieee80211_local *local)
{
int i = 0;
struct ieee80211_sub_if_data *sdata;
read_lock(&local->sub_if_lock);
list_for_each_entry(sdata, &local->sub_if_list, list) {
if (sdata->dev == local->mdev)
continue;
/* If there is an AP interface then depend on userspace to
set default_wep_only correctly. */
if (sdata->type == IEEE80211_IF_TYPE_AP) {
read_unlock(&local->sub_if_lock);
return;
}
i++;
}
read_unlock(&local->sub_if_lock);
if (i <= 1)
ieee80211_ioctl_default_wep_only(local, 1);
else
ieee80211_ioctl_default_wep_only(local, 0);
}
static int ieee80211_ioctl_prism2_param(struct net_device *dev, static int ieee80211_ioctl_prism2_param(struct net_device *dev,
struct iw_request_info *info, struct iw_request_info *info,
void *wrqu, char *extra) void *wrqu, char *extra)
......
...@@ -230,8 +230,7 @@ void sta_info_free(struct sta_info *sta) ...@@ -230,8 +230,7 @@ void sta_info_free(struct sta_info *sta)
if (local->ops->set_key) { if (local->ops->set_key) {
local->ops->set_key(local_to_hw(local), local->ops->set_key(local_to_hw(local),
DISABLE_KEY, sta->addr, DISABLE_KEY, sta->addr,
&sta->key->conf, &sta->key->conf);
local->default_wep_only);
} }
} else if (sta->key_idx_compression != HW_KEY_IDX_INVALID) { } else if (sta->key_idx_compression != HW_KEY_IDX_INVALID) {
struct ieee80211_key_conf conf; struct ieee80211_key_conf conf;
...@@ -240,8 +239,7 @@ void sta_info_free(struct sta_info *sta) ...@@ -240,8 +239,7 @@ void sta_info_free(struct sta_info *sta)
conf.alg = ALG_NONE; conf.alg = ALG_NONE;
conf.flags |= IEEE80211_KEY_FORCE_SW_ENCRYPT; conf.flags |= IEEE80211_KEY_FORCE_SW_ENCRYPT;
local->ops->set_key(local_to_hw(local), DISABLE_KEY, local->ops->set_key(local_to_hw(local), DISABLE_KEY,
sta->addr, &conf, sta->addr, &conf);
local->default_wep_only);
sta->key_idx_compression = HW_KEY_IDX_INVALID; sta->key_idx_compression = HW_KEY_IDX_INVALID;
} }
......
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