diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2010-01-21 05:40:47 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-01-22 16:08:55 -0500 |
commit | b3fbdcf49f940d0703c356441e0daf045e64e076 (patch) | |
tree | f63416cc9b80a6757ec6fa57190f581b2b3a6d31 | |
parent | e4fca007b06165900d0e44e8d5e251376819bf5d (diff) |
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: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/b43/main.c | 11 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.c | 10 | ||||
-rw-r--r-- | include/net/mac80211.h | 6 | ||||
-rw-r--r-- | net/mac80211/driver-ops.h | 14 | ||||
-rw-r--r-- | net/mac80211/driver-trace.h | 15 | ||||
-rw-r--r-- | net/mac80211/tkip.c | 12 |
6 files changed, 43 insertions, 25 deletions
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index c238468bca7f..c699e46534dc 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -844,8 +844,10 @@ static void rx_tkip_phase1_write(struct b43_wldev *dev, u8 index, u32 iv32, | |||
844 | } | 844 | } |
845 | 845 | ||
846 | static void b43_op_update_tkip_key(struct ieee80211_hw *hw, | 846 | static void b43_op_update_tkip_key(struct ieee80211_hw *hw, |
847 | struct ieee80211_key_conf *keyconf, const u8 *addr, | 847 | struct ieee80211_vif *vif, |
848 | u32 iv32, u16 *phase1key) | 848 | struct ieee80211_key_conf *keyconf, |
849 | struct ieee80211_sta *sta, | ||
850 | u32 iv32, u16 *phase1key) | ||
849 | { | 851 | { |
850 | struct b43_wl *wl = hw_to_b43_wl(hw); | 852 | struct b43_wl *wl = hw_to_b43_wl(hw); |
851 | struct b43_wldev *dev; | 853 | struct b43_wldev *dev; |
@@ -863,7 +865,10 @@ static void b43_op_update_tkip_key(struct ieee80211_hw *hw, | |||
863 | keymac_write(dev, index, NULL); /* First zero out mac to avoid race */ | 865 | keymac_write(dev, index, NULL); /* First zero out mac to avoid race */ |
864 | 866 | ||
865 | rx_tkip_phase1_write(dev, index, iv32, phase1key); | 867 | rx_tkip_phase1_write(dev, index, iv32, phase1key); |
866 | keymac_write(dev, index, addr); | 868 | /* only pairwise TKIP keys are supported right now */ |
869 | if (WARN_ON(!sta)) | ||
870 | goto out_unlock; | ||
871 | keymac_write(dev, index, sta->addr); | ||
867 | 872 | ||
868 | out_unlock: | 873 | out_unlock: |
869 | mutex_unlock(&wl->mutex); | 874 | mutex_unlock(&wl->mutex); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 8db86239bd6a..62b6939df52e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -2839,14 +2839,18 @@ void iwl_config_ap(struct iwl_priv *priv) | |||
2839 | } | 2839 | } |
2840 | 2840 | ||
2841 | static void iwl_mac_update_tkip_key(struct ieee80211_hw *hw, | 2841 | static void iwl_mac_update_tkip_key(struct ieee80211_hw *hw, |
2842 | struct ieee80211_key_conf *keyconf, const u8 *addr, | 2842 | struct ieee80211_vif *vif, |
2843 | u32 iv32, u16 *phase1key) | 2843 | struct ieee80211_key_conf *keyconf, |
2844 | struct ieee80211_sta *sta, | ||
2845 | u32 iv32, u16 *phase1key) | ||
2844 | { | 2846 | { |
2845 | 2847 | ||
2846 | struct iwl_priv *priv = hw->priv; | 2848 | struct iwl_priv *priv = hw->priv; |
2847 | IWL_DEBUG_MAC80211(priv, "enter\n"); | 2849 | IWL_DEBUG_MAC80211(priv, "enter\n"); |
2848 | 2850 | ||
2849 | iwl_update_tkip_key(priv, keyconf, addr, iv32, phase1key); | 2851 | iwl_update_tkip_key(priv, keyconf, |
2852 | sta ? sta->addr : iwl_bcast_addr, | ||
2853 | iv32, phase1key); | ||
2850 | 2854 | ||
2851 | IWL_DEBUG_MAC80211(priv, "leave\n"); | 2855 | IWL_DEBUG_MAC80211(priv, "leave\n"); |
2852 | } | 2856 | } |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index f03f97b627fe..f56d6f479532 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -1614,8 +1614,10 @@ struct ieee80211_ops { | |||
1614 | struct ieee80211_vif *vif, struct ieee80211_sta *sta, | 1614 | struct ieee80211_vif *vif, struct ieee80211_sta *sta, |
1615 | struct ieee80211_key_conf *key); | 1615 | struct ieee80211_key_conf *key); |
1616 | void (*update_tkip_key)(struct ieee80211_hw *hw, | 1616 | void (*update_tkip_key)(struct ieee80211_hw *hw, |
1617 | struct ieee80211_key_conf *conf, const u8 *address, | 1617 | struct ieee80211_vif *vif, |
1618 | u32 iv32, u16 *phase1key); | 1618 | struct ieee80211_key_conf *conf, |
1619 | struct ieee80211_sta *sta, | ||
1620 | u32 iv32, u16 *phase1key); | ||
1619 | int (*hw_scan)(struct ieee80211_hw *hw, | 1621 | int (*hw_scan)(struct ieee80211_hw *hw, |
1620 | struct cfg80211_scan_request *req); | 1622 | struct cfg80211_scan_request *req); |
1621 | void (*sw_scan_start)(struct ieee80211_hw *hw); | 1623 | void (*sw_scan_start)(struct ieee80211_hw *hw); |
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index de91d39e0276..40c6e9a89864 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h | |||
@@ -137,16 +137,22 @@ static inline int drv_set_key(struct ieee80211_local *local, | |||
137 | } | 137 | } |
138 | 138 | ||
139 | static inline void drv_update_tkip_key(struct ieee80211_local *local, | 139 | static inline void drv_update_tkip_key(struct ieee80211_local *local, |
140 | struct ieee80211_sub_if_data *sdata, | ||
140 | struct ieee80211_key_conf *conf, | 141 | struct ieee80211_key_conf *conf, |
141 | const u8 *address, u32 iv32, | 142 | struct sta_info *sta, u32 iv32, |
142 | u16 *phase1key) | 143 | u16 *phase1key) |
143 | { | 144 | { |
145 | struct ieee80211_sta *ista = NULL; | ||
146 | |||
144 | might_sleep(); | 147 | might_sleep(); |
145 | 148 | ||
149 | if (sta) | ||
150 | ista = &sta->sta; | ||
151 | |||
146 | if (local->ops->update_tkip_key) | 152 | if (local->ops->update_tkip_key) |
147 | local->ops->update_tkip_key(&local->hw, conf, address, | 153 | local->ops->update_tkip_key(&local->hw, &sdata->vif, conf, |
148 | iv32, phase1key); | 154 | ista, iv32, phase1key); |
149 | trace_drv_update_tkip_key(local, conf, address, iv32); | 155 | trace_drv_update_tkip_key(local, sdata, conf, ista, iv32); |
150 | } | 156 | } |
151 | 157 | ||
152 | static inline int drv_hw_scan(struct ieee80211_local *local, | 158 | static inline int drv_hw_scan(struct ieee80211_local *local, |
diff --git a/net/mac80211/driver-trace.h b/net/mac80211/driver-trace.h index 0ea258123b8e..fefa6e6b01bc 100644 --- a/net/mac80211/driver-trace.h +++ b/net/mac80211/driver-trace.h | |||
@@ -331,26 +331,29 @@ TRACE_EVENT(drv_set_key, | |||
331 | 331 | ||
332 | TRACE_EVENT(drv_update_tkip_key, | 332 | TRACE_EVENT(drv_update_tkip_key, |
333 | TP_PROTO(struct ieee80211_local *local, | 333 | TP_PROTO(struct ieee80211_local *local, |
334 | struct ieee80211_sub_if_data *sdata, | ||
334 | struct ieee80211_key_conf *conf, | 335 | struct ieee80211_key_conf *conf, |
335 | const u8 *address, u32 iv32), | 336 | struct ieee80211_sta *sta, u32 iv32), |
336 | 337 | ||
337 | TP_ARGS(local, conf, address, iv32), | 338 | TP_ARGS(local, sdata, conf, sta, iv32), |
338 | 339 | ||
339 | TP_STRUCT__entry( | 340 | TP_STRUCT__entry( |
340 | LOCAL_ENTRY | 341 | LOCAL_ENTRY |
341 | __array(u8, addr, 6) | 342 | VIF_ENTRY |
343 | STA_ENTRY | ||
342 | __field(u32, iv32) | 344 | __field(u32, iv32) |
343 | ), | 345 | ), |
344 | 346 | ||
345 | TP_fast_assign( | 347 | TP_fast_assign( |
346 | LOCAL_ASSIGN; | 348 | LOCAL_ASSIGN; |
347 | memcpy(__entry->addr, address, 6); | 349 | VIF_ASSIGN; |
350 | STA_ASSIGN; | ||
348 | __entry->iv32 = iv32; | 351 | __entry->iv32 = iv32; |
349 | ), | 352 | ), |
350 | 353 | ||
351 | TP_printk( | 354 | TP_printk( |
352 | LOCAL_PR_FMT " addr:%pM iv32:%#x", | 355 | LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " iv32:%#x", |
353 | LOCAL_PR_ARG, __entry->addr, __entry->iv32 | 356 | LOCAL_PR_ARG,VIF_PR_ARG,STA_PR_ARG, __entry->iv32 |
354 | ) | 357 | ) |
355 | ); | 358 | ); |
356 | 359 | ||
diff --git a/net/mac80211/tkip.c b/net/mac80211/tkip.c index 14fe49332c02..7ef491e9d66d 100644 --- a/net/mac80211/tkip.c +++ b/net/mac80211/tkip.c | |||
@@ -304,14 +304,12 @@ int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm, | |||
304 | if (key->local->ops->update_tkip_key && | 304 | if (key->local->ops->update_tkip_key && |
305 | key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE && | 305 | key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE && |
306 | key->u.tkip.rx[queue].state != TKIP_STATE_PHASE1_HW_UPLOADED) { | 306 | key->u.tkip.rx[queue].state != TKIP_STATE_PHASE1_HW_UPLOADED) { |
307 | static const u8 bcast[ETH_ALEN] = | 307 | struct ieee80211_sub_if_data *sdata = key->sdata; |
308 | {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; | ||
309 | const u8 *sta_addr = key->sta->sta.addr; | ||
310 | 308 | ||
311 | if (is_multicast_ether_addr(ra)) | 309 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) |
312 | sta_addr = bcast; | 310 | sdata = container_of(key->sdata->bss, |
313 | 311 | struct ieee80211_sub_if_data, u.ap); | |
314 | drv_update_tkip_key(key->local, &key->conf, sta_addr, | 312 | drv_update_tkip_key(key->local, sdata, &key->conf, key->sta, |
315 | iv32, key->u.tkip.rx[queue].p1k); | 313 | iv32, key->u.tkip.rx[queue].p1k); |
316 | key->u.tkip.rx[queue].state = TKIP_STATE_PHASE1_HW_UPLOADED; | 314 | key->u.tkip.rx[queue].state = TKIP_STATE_PHASE1_HW_UPLOADED; |
317 | } | 315 | } |