Commit b3fbdcf4 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

mac80211: pass vif and station to update_tkip_key

When a TKIP key is updated, we should pass the station
pointer instead of just the address, since drivers can
use that to store their own data. We also need to pass
the virtual interface pointer.
Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent e4fca007
...@@ -844,8 +844,10 @@ static void rx_tkip_phase1_write(struct b43_wldev *dev, u8 index, u32 iv32, ...@@ -844,8 +844,10 @@ static void rx_tkip_phase1_write(struct b43_wldev *dev, u8 index, u32 iv32,
} }
static void b43_op_update_tkip_key(struct ieee80211_hw *hw, static void b43_op_update_tkip_key(struct ieee80211_hw *hw,
struct ieee80211_key_conf *keyconf, const u8 *addr, struct ieee80211_vif *vif,
u32 iv32, u16 *phase1key) struct ieee80211_key_conf *keyconf,
struct ieee80211_sta *sta,
u32 iv32, u16 *phase1key)
{ {
struct b43_wl *wl = hw_to_b43_wl(hw); struct b43_wl *wl = hw_to_b43_wl(hw);
struct b43_wldev *dev; struct b43_wldev *dev;
...@@ -863,7 +865,10 @@ static void b43_op_update_tkip_key(struct ieee80211_hw *hw, ...@@ -863,7 +865,10 @@ static void b43_op_update_tkip_key(struct ieee80211_hw *hw,
keymac_write(dev, index, NULL); /* First zero out mac to avoid race */ keymac_write(dev, index, NULL); /* First zero out mac to avoid race */
rx_tkip_phase1_write(dev, index, iv32, phase1key); rx_tkip_phase1_write(dev, index, iv32, phase1key);
keymac_write(dev, index, addr); /* only pairwise TKIP keys are supported right now */
if (WARN_ON(!sta))
goto out_unlock;
keymac_write(dev, index, sta->addr);
out_unlock: out_unlock:
mutex_unlock(&wl->mutex); mutex_unlock(&wl->mutex);
......
...@@ -2839,14 +2839,18 @@ void iwl_config_ap(struct iwl_priv *priv) ...@@ -2839,14 +2839,18 @@ void iwl_config_ap(struct iwl_priv *priv)
} }
static void iwl_mac_update_tkip_key(struct ieee80211_hw *hw, static void iwl_mac_update_tkip_key(struct ieee80211_hw *hw,
struct ieee80211_key_conf *keyconf, const u8 *addr, struct ieee80211_vif *vif,
u32 iv32, u16 *phase1key) struct ieee80211_key_conf *keyconf,
struct ieee80211_sta *sta,
u32 iv32, u16 *phase1key)
{ {
struct iwl_priv *priv = hw->priv; struct iwl_priv *priv = hw->priv;
IWL_DEBUG_MAC80211(priv, "enter\n"); IWL_DEBUG_MAC80211(priv, "enter\n");
iwl_update_tkip_key(priv, keyconf, addr, iv32, phase1key); iwl_update_tkip_key(priv, keyconf,
sta ? sta->addr : iwl_bcast_addr,
iv32, phase1key);
IWL_DEBUG_MAC80211(priv, "leave\n"); IWL_DEBUG_MAC80211(priv, "leave\n");
} }
......
...@@ -1614,8 +1614,10 @@ struct ieee80211_ops { ...@@ -1614,8 +1614,10 @@ struct ieee80211_ops {
struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct ieee80211_vif *vif, struct ieee80211_sta *sta,
struct ieee80211_key_conf *key); struct ieee80211_key_conf *key);
void (*update_tkip_key)(struct ieee80211_hw *hw, void (*update_tkip_key)(struct ieee80211_hw *hw,
struct ieee80211_key_conf *conf, const u8 *address, struct ieee80211_vif *vif,
u32 iv32, u16 *phase1key); struct ieee80211_key_conf *conf,
struct ieee80211_sta *sta,
u32 iv32, u16 *phase1key);
int (*hw_scan)(struct ieee80211_hw *hw, int (*hw_scan)(struct ieee80211_hw *hw,
struct cfg80211_scan_request *req); struct cfg80211_scan_request *req);
void (*sw_scan_start)(struct ieee80211_hw *hw); void (*sw_scan_start)(struct ieee80211_hw *hw);
......
...@@ -137,16 +137,22 @@ static inline int drv_set_key(struct ieee80211_local *local, ...@@ -137,16 +137,22 @@ static inline int drv_set_key(struct ieee80211_local *local,
} }
static inline void drv_update_tkip_key(struct ieee80211_local *local, static inline void drv_update_tkip_key(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
struct ieee80211_key_conf *conf, struct ieee80211_key_conf *conf,
const u8 *address, u32 iv32, struct sta_info *sta, u32 iv32,
u16 *phase1key) u16 *phase1key)
{ {
struct ieee80211_sta *ista = NULL;
might_sleep(); might_sleep();
if (sta)
ista = &sta->sta;
if (local->ops->update_tkip_key) if (local->ops->update_tkip_key)
local->ops->update_tkip_key(&local->hw, conf, address, local->ops->update_tkip_key(&local->hw, &sdata->vif, conf,
iv32, phase1key); ista, iv32, phase1key);
trace_drv_update_tkip_key(local, conf, address, iv32); trace_drv_update_tkip_key(local, sdata, conf, ista, iv32);
} }
static inline int drv_hw_scan(struct ieee80211_local *local, static inline int drv_hw_scan(struct ieee80211_local *local,
......
...@@ -331,26 +331,29 @@ TRACE_EVENT(drv_set_key, ...@@ -331,26 +331,29 @@ TRACE_EVENT(drv_set_key,
TRACE_EVENT(drv_update_tkip_key, TRACE_EVENT(drv_update_tkip_key,
TP_PROTO(struct ieee80211_local *local, TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
struct ieee80211_key_conf *conf, struct ieee80211_key_conf *conf,
const u8 *address, u32 iv32), struct ieee80211_sta *sta, u32 iv32),
TP_ARGS(local, conf, address, iv32), TP_ARGS(local, sdata, conf, sta, iv32),
TP_STRUCT__entry( TP_STRUCT__entry(
LOCAL_ENTRY LOCAL_ENTRY
__array(u8, addr, 6) VIF_ENTRY
STA_ENTRY
__field(u32, iv32) __field(u32, iv32)
), ),
TP_fast_assign( TP_fast_assign(
LOCAL_ASSIGN; LOCAL_ASSIGN;
memcpy(__entry->addr, address, 6); VIF_ASSIGN;
STA_ASSIGN;
__entry->iv32 = iv32; __entry->iv32 = iv32;
), ),
TP_printk( TP_printk(
LOCAL_PR_FMT " addr:%pM iv32:%#x", LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " iv32:%#x",
LOCAL_PR_ARG, __entry->addr, __entry->iv32 LOCAL_PR_ARG,VIF_PR_ARG,STA_PR_ARG, __entry->iv32
) )
); );
......
...@@ -304,14 +304,12 @@ int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm, ...@@ -304,14 +304,12 @@ int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm,
if (key->local->ops->update_tkip_key && if (key->local->ops->update_tkip_key &&
key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE && key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE &&
key->u.tkip.rx[queue].state != TKIP_STATE_PHASE1_HW_UPLOADED) { key->u.tkip.rx[queue].state != TKIP_STATE_PHASE1_HW_UPLOADED) {
static const u8 bcast[ETH_ALEN] = struct ieee80211_sub_if_data *sdata = key->sdata;
{0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
const u8 *sta_addr = key->sta->sta.addr;
if (is_multicast_ether_addr(ra)) if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
sta_addr = bcast; sdata = container_of(key->sdata->bss,
struct ieee80211_sub_if_data, u.ap);
drv_update_tkip_key(key->local, &key->conf, sta_addr, drv_update_tkip_key(key->local, sdata, &key->conf, key->sta,
iv32, key->u.tkip.rx[queue].p1k); iv32, key->u.tkip.rx[queue].p1k);
key->u.tkip.rx[queue].state = TKIP_STATE_PHASE1_HW_UPLOADED; key->u.tkip.rx[queue].state = TKIP_STATE_PHASE1_HW_UPLOADED;
} }
......
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