public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mac80211: pass station instead of address to update_tkip_key
@ 2010-01-19 13:21 Johannes Berg
  2010-01-19 14:06 ` Julian Calaby
  2010-01-21 10:40 ` [PATCH v3] mac80211: pass vif and station " Johannes Berg
  0 siblings, 2 replies; 5+ messages in thread
From: Johannes Berg @ 2010-01-19 13:21 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

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.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
 drivers/net/wireless/b43/main.c        |   10 +++++++---
 drivers/net/wireless/iwlwifi/iwl-agn.c |    7 +++++--
 include/net/mac80211.h                 |    5 +++--
 net/mac80211/driver-ops.h              |    7 ++++---
 net/mac80211/driver-trace.h            |   10 +++++-----
 net/mac80211/tkip.c                    |    9 +--------
 6 files changed, 25 insertions(+), 23 deletions(-)

--- wireless-testing.orig/drivers/net/wireless/b43/main.c	2010-01-16 20:18:14.000000000 +0100
+++ wireless-testing/drivers/net/wireless/b43/main.c	2010-01-19 14:20:57.000000000 +0100
@@ -844,8 +844,9 @@ static void rx_tkip_phase1_write(struct 
 }
 
 static void b43_op_update_tkip_key(struct ieee80211_hw *hw,
-			struct ieee80211_key_conf *keyconf, const u8 *addr,
-			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_wldev *dev;
@@ -863,7 +864,10 @@ static void b43_op_update_tkip_key(struc
 	keymac_write(dev, index, NULL);	/* First zero out mac to avoid race */
 
 	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:
 	mutex_unlock(&wl->mutex);
--- wireless-testing.orig/drivers/net/wireless/iwlwifi/iwl-agn.c	2010-01-16 20:18:16.000000000 +0100
+++ wireless-testing/drivers/net/wireless/iwlwifi/iwl-agn.c	2010-01-19 14:20:57.000000000 +0100
@@ -2839,14 +2839,17 @@ void iwl_config_ap(struct iwl_priv *priv
 }
 
 static void iwl_mac_update_tkip_key(struct ieee80211_hw *hw,
-			struct ieee80211_key_conf *keyconf, const u8 *addr,
+			struct ieee80211_key_conf *keyconf,
+			struct ieee80211_sta *sta,
 			u32 iv32, u16 *phase1key)
 {
 
 	struct iwl_priv *priv = hw->priv;
 	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");
 }
--- wireless-testing.orig/include/net/mac80211.h	2010-01-17 15:36:27.000000000 +0100
+++ wireless-testing/include/net/mac80211.h	2010-01-19 14:20:57.000000000 +0100
@@ -1618,8 +1618,9 @@ struct ieee80211_ops {
 		       struct ieee80211_vif *vif, struct ieee80211_sta *sta,
 		       struct ieee80211_key_conf *key);
 	void (*update_tkip_key)(struct ieee80211_hw *hw,
-			struct ieee80211_key_conf *conf, const u8 *address,
-			u32 iv32, u16 *phase1key);
+				struct ieee80211_key_conf *conf,
+				struct ieee80211_sta *sta,
+				u32 iv32, u16 *phase1key);
 	int (*hw_scan)(struct ieee80211_hw *hw,
 		       struct cfg80211_scan_request *req);
 	void (*sw_scan_start)(struct ieee80211_hw *hw);
--- wireless-testing.orig/net/mac80211/driver-ops.h	2010-01-16 20:18:21.000000000 +0100
+++ wireless-testing/net/mac80211/driver-ops.h	2010-01-19 14:20:57.000000000 +0100
@@ -138,15 +138,16 @@ static inline int drv_set_key(struct iee
 
 static inline void drv_update_tkip_key(struct ieee80211_local *local,
 				       struct ieee80211_key_conf *conf,
-				       const u8 *address, u32 iv32,
+				       struct sta_info *sta, u32 iv32,
 				       u16 *phase1key)
 {
 	might_sleep();
 
 	if (local->ops->update_tkip_key)
-		local->ops->update_tkip_key(&local->hw, conf, address,
+		local->ops->update_tkip_key(&local->hw, conf,
+					    sta ? &sta->sta : NULL,
 					    iv32, phase1key);
-	trace_drv_update_tkip_key(local, conf, address, iv32);
+	trace_drv_update_tkip_key(local, conf, sta, iv32);
 }
 
 static inline int drv_hw_scan(struct ieee80211_local *local,
--- wireless-testing.orig/net/mac80211/driver-trace.h	2010-01-16 20:18:21.000000000 +0100
+++ wireless-testing/net/mac80211/driver-trace.h	2010-01-19 14:20:57.000000000 +0100
@@ -332,25 +332,25 @@ TRACE_EVENT(drv_set_key,
 TRACE_EVENT(drv_update_tkip_key,
 	TP_PROTO(struct ieee80211_local *local,
 		 struct ieee80211_key_conf *conf,
-		 const u8 *address, u32 iv32),
+		 struct sta_info *sta, u32 iv32),
 
 	TP_ARGS(local, conf, address, iv32),
 
 	TP_STRUCT__entry(
 		LOCAL_ENTRY
-		__array(u8, addr, 6)
+		STA_ENTRY
 		__field(u32, iv32)
 	),
 
 	TP_fast_assign(
 		LOCAL_ASSIGN;
-		memcpy(__entry->addr, address, 6);
+		STA_ASSIGN;
 		__entry->iv32 = iv32;
 	),
 
 	TP_printk(
-		LOCAL_PR_FMT " addr:%pM iv32:%#x",
-		LOCAL_PR_ARG, __entry->addr, __entry->iv32
+		LOCAL_PR_FMT STA_PR_FMT " iv32:%#x",
+		LOCAL_PR_ARG,STA_PR_ARG, __entry->iv32
 	)
 );
 
--- wireless-testing.orig/net/mac80211/tkip.c	2010-01-16 20:19:10.000000000 +0100
+++ wireless-testing/net/mac80211/tkip.c	2010-01-19 14:20:57.000000000 +0100
@@ -304,14 +304,7 @@ int ieee80211_tkip_decrypt_data(struct c
 	if (key->local->ops->update_tkip_key &&
 	    key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE &&
 	    key->u.tkip.rx[queue].state != TKIP_STATE_PHASE1_HW_UPLOADED) {
-		static const u8 bcast[ETH_ALEN] =
-		{0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-		const u8 *sta_addr = key->sta->sta.addr;
-
-		if (is_multicast_ether_addr(ra))
-			sta_addr = bcast;
-
-		drv_update_tkip_key(key->local, &key->conf, sta_addr,
+		drv_update_tkip_key(key->local, &key->conf, key->sta,
 				iv32, key->u.tkip.rx[queue].p1k);
 		key->u.tkip.rx[queue].state = TKIP_STATE_PHASE1_HW_UPLOADED;
 	}



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mac80211: pass station instead of address to update_tkip_key
  2010-01-19 13:21 [PATCH] mac80211: pass station instead of address to update_tkip_key Johannes Berg
@ 2010-01-19 14:06 ` Julian Calaby
  2010-01-19 17:53   ` Johannes Berg
  2010-01-20 10:11   ` [PATCH v2] " Johannes Berg
  2010-01-21 10:40 ` [PATCH v3] mac80211: pass vif and station " Johannes Berg
  1 sibling, 2 replies; 5+ messages in thread
From: Julian Calaby @ 2010-01-19 14:06 UTC (permalink / raw)
  To: Johannes Berg; +Cc: John Linville, linux-wireless

On Wed, Jan 20, 2010 at 00:21, Johannes Berg <johannes@sipsolutions.net> wrote:
> 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.
>
> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
> ---
>
> --- wireless-testing.orig/net/mac80211/driver-trace.h   2010-01-16 20:18:21.000000000 +0100
> +++ wireless-testing/net/mac80211/driver-trace.h        2010-01-19 14:20:57.000000000 +0100
> @@ -332,25 +332,25 @@ TRACE_EVENT(drv_set_key,
>  TRACE_EVENT(drv_update_tkip_key,
>        TP_PROTO(struct ieee80211_local *local,
>                 struct ieee80211_key_conf *conf,
> -                const u8 *address, u32 iv32),
> +                struct sta_info *sta, u32 iv32),
>
>        TP_ARGS(local, conf, address, iv32),

Should you change address to sta?

>        TP_STRUCT__entry(
>                LOCAL_ENTRY
> -               __array(u8, addr, 6)
> +               STA_ENTRY
>                __field(u32, iv32)
>        ),
>
>        TP_fast_assign(
>                LOCAL_ASSIGN;
> -               memcpy(__entry->addr, address, 6);
> +               STA_ASSIGN;
>                __entry->iv32 = iv32;
>        ),
>
>        TP_printk(
> -               LOCAL_PR_FMT " addr:%pM iv32:%#x",
> -               LOCAL_PR_ARG, __entry->addr, __entry->iv32
> +               LOCAL_PR_FMT STA_PR_FMT " iv32:%#x",
> +               LOCAL_PR_ARG,STA_PR_ARG, __entry->iv32
>        )
>  );
>

Thanks,

-- 

Julian Calaby

Email: julian.calaby@gmail.com
.Plan: http://sites.google.com/site/juliancalaby/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mac80211: pass station instead of address to update_tkip_key
  2010-01-19 14:06 ` Julian Calaby
@ 2010-01-19 17:53   ` Johannes Berg
  2010-01-20 10:11   ` [PATCH v2] " Johannes Berg
  1 sibling, 0 replies; 5+ messages in thread
From: Johannes Berg @ 2010-01-19 17:53 UTC (permalink / raw)
  To: Julian Calaby; +Cc: John Linville, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 457 bytes --]

[please trim your quotes]

On Wed, 2010-01-20 at 01:06 +1100, Julian Calaby wrote:

> >        TP_PROTO(struct ieee80211_local *local,
> >                 struct ieee80211_key_conf *conf,
> > -                const u8 *address, u32 iv32),
> > +                struct sta_info *sta, u32 iv32),
> >
> >        TP_ARGS(local, conf, address, iv32),

Indeed, that needs a change, I had the tracing disabled in my build so
didn't notice.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] mac80211: pass station instead of address to update_tkip_key
  2010-01-19 14:06 ` Julian Calaby
  2010-01-19 17:53   ` Johannes Berg
@ 2010-01-20 10:11   ` Johannes Berg
  1 sibling, 0 replies; 5+ messages in thread
From: Johannes Berg @ 2010-01-20 10:11 UTC (permalink / raw)
  To: Julian Calaby; +Cc: John Linville, linux-wireless

mac80211: pass station instead of address 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.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>

---
v2: * compile-test and fixes, thanks Julian

diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 9c5c7c9..2a3f048 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -844,8 +844,9 @@ 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,
-			struct ieee80211_key_conf *keyconf, const u8 *addr,
-			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_wldev *dev;
@@ -863,7 +864,10 @@ static void b43_op_update_tkip_key(struct ieee80211_hw *hw,
 	keymac_write(dev, index, NULL);	/* First zero out mac to avoid race */
 
 	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:
 	mutex_unlock(&wl->mutex);
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 417fa9b..3724fb2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -2833,14 +2833,17 @@ void iwl_config_ap(struct iwl_priv *priv)
 }
 
 static void iwl_mac_update_tkip_key(struct ieee80211_hw *hw,
-			struct ieee80211_key_conf *keyconf, const u8 *addr,
+			struct ieee80211_key_conf *keyconf,
+			struct ieee80211_sta *sta,
 			u32 iv32, u16 *phase1key)
 {
 
 	struct iwl_priv *priv = hw->priv;
 	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");
 }
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index c90047d..3126191 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1610,8 +1610,9 @@ struct ieee80211_ops {
 		       struct ieee80211_vif *vif, struct ieee80211_sta *sta,
 		       struct ieee80211_key_conf *key);
 	void (*update_tkip_key)(struct ieee80211_hw *hw,
-			struct ieee80211_key_conf *conf, const u8 *address,
-			u32 iv32, u16 *phase1key);
+				struct ieee80211_key_conf *conf,
+				struct ieee80211_sta *sta,
+				u32 iv32, u16 *phase1key);
 	int (*hw_scan)(struct ieee80211_hw *hw,
 		       struct cfg80211_scan_request *req);
 	void (*sw_scan_start)(struct ieee80211_hw *hw);
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index de91d39..6eeb0c6 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -138,15 +138,20 @@ static inline int drv_set_key(struct ieee80211_local *local,
 
 static inline void drv_update_tkip_key(struct ieee80211_local *local,
 				       struct ieee80211_key_conf *conf,
-				       const u8 *address, u32 iv32,
+				       struct sta_info *sta, u32 iv32,
 				       u16 *phase1key)
 {
+	struct ieee80211_sta *ista = NULL;
+
 	might_sleep();
 
+	if (sta)
+		ista = &sta->sta;
+
 	if (local->ops->update_tkip_key)
-		local->ops->update_tkip_key(&local->hw, conf, address,
+		local->ops->update_tkip_key(&local->hw, conf, ista,
 					    iv32, phase1key);
-	trace_drv_update_tkip_key(local, conf, address, iv32);
+	trace_drv_update_tkip_key(local, conf, ista, iv32);
 }
 
 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 0ea2581..bce0924 100644
--- a/net/mac80211/driver-trace.h
+++ b/net/mac80211/driver-trace.h
@@ -332,25 +332,25 @@ TRACE_EVENT(drv_set_key,
 TRACE_EVENT(drv_update_tkip_key,
 	TP_PROTO(struct ieee80211_local *local,
 		 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, conf, sta, iv32),
 
 	TP_STRUCT__entry(
 		LOCAL_ENTRY
-		__array(u8, addr, 6)
+		STA_ENTRY
 		__field(u32, iv32)
 	),
 
 	TP_fast_assign(
 		LOCAL_ASSIGN;
-		memcpy(__entry->addr, address, 6);
+		STA_ASSIGN;
 		__entry->iv32 = iv32;
 	),
 
 	TP_printk(
-		LOCAL_PR_FMT " addr:%pM iv32:%#x",
-		LOCAL_PR_ARG, __entry->addr, __entry->iv32
+		LOCAL_PR_FMT STA_PR_FMT " iv32:%#x",
+		LOCAL_PR_ARG,STA_PR_ARG, __entry->iv32
 	)
 );
 
diff --git a/net/mac80211/tkip.c b/net/mac80211/tkip.c
index b73454a..41e5d28 100644
--- a/net/mac80211/tkip.c
+++ b/net/mac80211/tkip.c
@@ -303,14 +303,7 @@ int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm,
 	if (key->local->ops->update_tkip_key &&
 	    key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE &&
 	    key->u.tkip.rx[queue].state != TKIP_STATE_PHASE1_HW_UPLOADED) {
-		static const u8 bcast[ETH_ALEN] =
-		{0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-		const u8 *sta_addr = key->sta->sta.addr;
-
-		if (is_multicast_ether_addr(ra))
-			sta_addr = bcast;
-
-		drv_update_tkip_key(key->local, &key->conf, sta_addr,
+		drv_update_tkip_key(key->local, &key->conf, key->sta,
 				iv32, key->u.tkip.rx[queue].p1k);
 		key->u.tkip.rx[queue].state = TKIP_STATE_PHASE1_HW_UPLOADED;
 	}



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v3] mac80211: pass vif and station to update_tkip_key
  2010-01-19 13:21 [PATCH] mac80211: pass station instead of address to update_tkip_key Johannes Berg
  2010-01-19 14:06 ` Julian Calaby
@ 2010-01-21 10:40 ` Johannes Berg
  1 sibling, 0 replies; 5+ messages in thread
From: Johannes Berg @ 2010-01-21 10:40 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

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>

---
This replaces my earlier patch, I realised that I need the virtual
interface pointer as well.

diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 9c5c7c9..6fc1027 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,
 }
 
 static void b43_op_update_tkip_key(struct ieee80211_hw *hw,
-			struct ieee80211_key_conf *keyconf, const u8 *addr,
-			u32 iv32, u16 *phase1key)
+				   struct ieee80211_vif *vif,
+				   struct ieee80211_key_conf *keyconf,
+				   struct ieee80211_sta *sta,
+				   u32 iv32, u16 *phase1key)
 {
 	struct b43_wl *wl = hw_to_b43_wl(hw);
 	struct b43_wldev *dev;
@@ -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 */
 
 	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:
 	mutex_unlock(&wl->mutex);
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 417fa9b..96254fc 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -2833,14 +2833,18 @@ void iwl_config_ap(struct iwl_priv *priv)
 }
 
 static void iwl_mac_update_tkip_key(struct ieee80211_hw *hw,
-			struct ieee80211_key_conf *keyconf, const u8 *addr,
-			u32 iv32, u16 *phase1key)
+				    struct ieee80211_vif *vif,
+				    struct ieee80211_key_conf *keyconf,
+				    struct ieee80211_sta *sta,
+				    u32 iv32, u16 *phase1key)
 {
 
 	struct iwl_priv *priv = hw->priv;
 	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");
 }
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index c90047d..9445ddf 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1610,8 +1610,10 @@ struct ieee80211_ops {
 		       struct ieee80211_vif *vif, struct ieee80211_sta *sta,
 		       struct ieee80211_key_conf *key);
 	void (*update_tkip_key)(struct ieee80211_hw *hw,
-			struct ieee80211_key_conf *conf, const u8 *address,
-			u32 iv32, u16 *phase1key);
+				struct ieee80211_vif *vif,
+				struct ieee80211_key_conf *conf,
+				struct ieee80211_sta *sta,
+				u32 iv32, u16 *phase1key);
 	int (*hw_scan)(struct ieee80211_hw *hw,
 		       struct cfg80211_scan_request *req);
 	void (*sw_scan_start)(struct ieee80211_hw *hw);
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index de91d39..40c6e9a 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,
 }
 
 static inline void drv_update_tkip_key(struct ieee80211_local *local,
+				       struct ieee80211_sub_if_data *sdata,
 				       struct ieee80211_key_conf *conf,
-				       const u8 *address, u32 iv32,
+				       struct sta_info *sta, u32 iv32,
 				       u16 *phase1key)
 {
+	struct ieee80211_sta *ista = NULL;
+
 	might_sleep();
 
+	if (sta)
+		ista = &sta->sta;
+
 	if (local->ops->update_tkip_key)
-		local->ops->update_tkip_key(&local->hw, conf, address,
-					    iv32, phase1key);
-	trace_drv_update_tkip_key(local, conf, address, iv32);
+		local->ops->update_tkip_key(&local->hw, &sdata->vif, conf,
+					    ista, iv32, phase1key);
+	trace_drv_update_tkip_key(local, sdata, conf, ista, iv32);
 }
 
 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 0ea2581..fefa6e6 100644
--- a/net/mac80211/driver-trace.h
+++ b/net/mac80211/driver-trace.h
@@ -331,26 +331,29 @@ TRACE_EVENT(drv_set_key,
 
 TRACE_EVENT(drv_update_tkip_key,
 	TP_PROTO(struct ieee80211_local *local,
+		 struct ieee80211_sub_if_data *sdata,
 		 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(
 		LOCAL_ENTRY
-		__array(u8, addr, 6)
+		VIF_ENTRY
+		STA_ENTRY
 		__field(u32, iv32)
 	),
 
 	TP_fast_assign(
 		LOCAL_ASSIGN;
-		memcpy(__entry->addr, address, 6);
+		VIF_ASSIGN;
+		STA_ASSIGN;
 		__entry->iv32 = iv32;
 	),
 
 	TP_printk(
-		LOCAL_PR_FMT " addr:%pM iv32:%#x",
-		LOCAL_PR_ARG, __entry->addr, __entry->iv32
+		LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " iv32:%#x",
+		LOCAL_PR_ARG,VIF_PR_ARG,STA_PR_ARG, __entry->iv32
 	)
 );
 
diff --git a/net/mac80211/tkip.c b/net/mac80211/tkip.c
index b73454a..4cf300a 100644
--- a/net/mac80211/tkip.c
+++ b/net/mac80211/tkip.c
@@ -303,14 +303,12 @@ int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm,
 	if (key->local->ops->update_tkip_key &&
 	    key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE &&
 	    key->u.tkip.rx[queue].state != TKIP_STATE_PHASE1_HW_UPLOADED) {
-		static const u8 bcast[ETH_ALEN] =
-		{0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-		const u8 *sta_addr = key->sta->sta.addr;
+		struct ieee80211_sub_if_data *sdata = key->sdata;
 
-		if (is_multicast_ether_addr(ra))
-			sta_addr = bcast;
-
-		drv_update_tkip_key(key->local, &key->conf, sta_addr,
+		if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
+			sdata = container_of(key->sdata->bss,
+					struct ieee80211_sub_if_data, u.ap);
+		drv_update_tkip_key(key->local, sdata, &key->conf, key->sta,
 				iv32, key->u.tkip.rx[queue].p1k);
 		key->u.tkip.rx[queue].state = TKIP_STATE_PHASE1_HW_UPLOADED;
 	}



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-01-21 10:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-19 13:21 [PATCH] mac80211: pass station instead of address to update_tkip_key Johannes Berg
2010-01-19 14:06 ` Julian Calaby
2010-01-19 17:53   ` Johannes Berg
2010-01-20 10:11   ` [PATCH v2] " Johannes Berg
2010-01-21 10:40 ` [PATCH v3] mac80211: pass vif and station " Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox