Skip to contentSkip to conversation

mac80211: add op to configure default key id to driver

PATCH In review Yoni Divinsky 3 participants 6 messages May 8, 2012 – May 18, 2012 4 messages not in the archive mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: add op to configure default key id to driver

When hw_accel is enabled and encryption type is set to WEP, the driver should get the default key index from mac80211.

---
 include/net/mac80211.h    |    6 +++++-
 net/mac80211/cfg.c        |    3 +--
 net/mac80211/driver-ops.h |   17 +++++++++++++++++
 net/mac80211/key.c        |    6 +++++-
 net/mac80211/key.h        |    2 +-
 5 files changed, 29 insertions(+), 5 deletions(-)
include/net/mac80211.h +5 -1
index 4d6e6c6..883fb72 100644
@@ -1427,6 +1427,9 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
  * rekeying), it will not include a valid phase 1 key. The valid phase 1 key is
  * provided by update_tkip_key only. The trigger that makes mac80211 call this
  * handler is software decryption with wrap around of iv16.
+ *
+ * The set_default_key_idx() call updates the default WEP key index configured
+ * to the hardware for WEP encryption type.
  */
 
 /**
@@ -2361,7 +2364,6 @@ struct ieee80211_ops {
 					u16 tids, int num_frames,
 					enum ieee80211_frame_release_type reason,
 					bool more_data);
-
 	int	(*get_et_sset_count)(struct ieee80211_hw *hw,
 				     struct ieee80211_vif *vif, int sset);
 	void	(*get_et_stats)(struct ieee80211_hw *hw,
@@ -2370,6 +2372,8 @@ struct ieee80211_ops {
 	void	(*get_et_strings)(struct ieee80211_hw *hw,
 				  struct ieee80211_vif *vif,
 				  u32 sset, u8 *data);
+	int (*set_default_key_idx)(struct ieee80211_hw *hw,
+				    struct ieee80211_vif *vif, int idx);
 };
 
 /**
net/mac80211/cfg.c +1 -2
index 0221270..6a82ae3 100644
@@ -309,9 +309,8 @@ static int ieee80211_config_default_key(struct wiphy *wiphy,
 {
 	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
-	ieee80211_set_default_key(sdata, key_idx, uni, multi);
+	return ieee80211_set_default_key(sdata, key_idx, uni, multi);
 
-	return 0;
 }
 
 static int ieee80211_config_default_mgmt_key(struct wiphy *wiphy,
net/mac80211/driver-ops.h +17 -0
index 6d33a0c..361705e 100644
@@ -845,4 +845,21 @@ drv_allow_buffered_frames(struct ieee80211_local *local,
 						  more_data);
 	trace_drv_return_void(local);
 }
+
+static inline int
+drv_set_default_unicast_key(struct ieee80211_local *local,
+		    struct ieee80211_sub_if_data *sdata,
+		    int key_idx)
+{
+	int ret = 0;
+	check_sdata_in_driver(sdata);
+
+	if (local->ops->set_default_key_idx)
+		ret = local->ops->set_default_key_idx(&local->hw, &sdata->vif,
+						key_idx);
+
+	trace_drv_return_int(local, ret);
+
+	return ret;
+}
 #endif /* __MAC80211_DRIVER_OPS */
net/mac80211/key.c +5 -1
index 5bb600d..365a521 100644
@@ -232,12 +232,16 @@ static void __ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata,
 	ieee80211_debugfs_key_update_default(sdata);
 }
 
-void ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, int idx,
+int ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, int idx,
 			       bool uni, bool multi)
 {
+	int ret = 0;
 	mutex_lock(&sdata->local->key_mtx);
 	__ieee80211_set_default_key(sdata, idx, uni, multi);
+	if (uni)
+		ret = drv_set_default_unicast_key(sdata->local, sdata, idx);
 	mutex_unlock(&sdata->local->key_mtx);
+	return ret;
 }
 
 static void
net/mac80211/key.h +1 -1
index 7d4e31f..046d2b3 100644
@@ -136,7 +136,7 @@ int __must_check ieee80211_key_link(struct ieee80211_key *key,
 void __ieee80211_key_free(struct ieee80211_key *key);
 void ieee80211_key_free(struct ieee80211_local *local,
 			struct ieee80211_key *key);
-void ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, int idx,
+int ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, int idx,
 			       bool uni, bool multi);
 void ieee80211_set_default_mgmt_key(struct ieee80211_sub_if_data *sdata,
 				    int idx);
Signature · 1 line
1.7.0.4
maintainer
#1 lore raw
Quoted 2 lines · Yoni Divinsky

When hw_accel is enabled and encryption type is set to WEP, the driver should get the default key index from mac80211.

Well, why?

johannes

#5 lore raw

PATCH 1/1 mac80211: add op to configure default key id to driver

In reply to a message not in the archive

---------- Forwarded message ----------
From: Divinsky, Yonatan <[email protected]>
Date: Tue, May 15, 2012 at 1:59 PM
Subject: Re: [PATCH] mac80211: add op to configure default key id to driver
To: Johannes Berg <[email protected]>

Quoted 6 lines · Johannes Berg
Quoted 5 lines · Yonatan
Quoted 4 lines · Johannes Berg
Quoted 2 lines · Yoni Divinsky

When hw_accel is enabled and encryption type is set to WEP, the driver should get the default key index from mac80211.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Well, why?

If the WEP encryption is done by the HW, then then low level driver needs to know the defualt key index in
case there is more than one WEP key configured.

I don't see why, for every packet mac80211 tells you what key to use.

If the HW supports auto ARP responses, then it will need to have the correct key id in order to encrypt the ARP response.

Quoted 3 lines

johannes

#7 lore raw
In reply to a message not in the archive

Hi All
I know this use case is quite trivial looking regarding WEP (Since it is going to be deprecated), we faced a issue with minap (softap) in WEP security with auth mode as shared. Since the default key is not passed to driver, we can not program firmware default key idx (default key is programmed when data packet exchange started, looking into type of encryption) and the handshake failed in shared auth mode. In open mode, there is no need for this.

Personally, i dont like WEP in miniAP mode but sometime we dont have the choice!

Rsh.

Quoted 40 lines · Yonatan
Quoted 34 lines

---------- Forwarded message ----------
From: Divinsky, Yonatan <[email protected]>
Date: Tue, May 15, 2012 at 1:59 PM
Subject: Re: [PATCH] mac80211: add op to configure default key id to driver
To: Johannes Berg <[email protected]>

Quoted 6 lines · Johannes Berg
Quoted 5 lines · Yonatan
Quoted 4 lines · Johannes Berg
Quoted 2 lines · Yoni Divinsky

When hw_accel is enabled and encryption type is set to WEP, the driver should get the default key index from mac80211.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Well, why?

If the WEP encryption is done by the HW, then then low level driver needs to know the defualt key index in
case there is more than one WEP key configured.

I don't see why, for every packet mac80211 tells you what key to use.

If the HW supports auto ARP responses, then it will need to have the correct key id in order to encrypt the ARP response.

Quoted 3 lines

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

maintainer
#8 lore raw
Quoted 8 lines · Ravi Sharma

Hi All
I know this use case is quite trivial looking regarding WEP (Since it is going to be deprecated), we faced a issue with minap (softap) in WEP security with auth mode as shared. Since the default key is not passed to driver, we can not program firmware default key idx (default key is programmed when data packet exchange started, looking into type of encryption) and the handshake failed in shared auth mode. In open mode, there is no need for this.

Now you're talking about something else entirely? What does this have to do with auto-ARP responses??

Can we get that story straight? :-) And then a patch that actually explains & documents it ... Remember that the changelog should indicate why you're changing something.

johannes

#9 lore raw

I am describing another scenario where we may use this patch.

The patch heading says 'mac80211: add op to configure default key id to driver'.

Its upto you and Yoni to decide.

Quoted 19 lines · Johannes Berg
Quoted 8 lines · Ravi Sharma

Hi All
I know this use case is quite trivial looking regarding WEP (Since it is going to be deprecated), we faced a issue with minap (softap) in WEP security with auth mode as shared. Since the default key is not passed to driver, we can not program firmware default key idx (default key is programmed when data packet exchange started, looking into type of encryption) and the handshake failed in shared auth mode. In open mode, there is no need for this.

Now you're talking about something else entirely? What does this have to do with auto-ARP responses??

Can we get that story straight? :-) And then a patch that actually explains & documents it ... Remember that the changelog should indicate why you're changing something.

johannes