Search Linux Wireless

[PATCH 2/2] mwifiex: add set_default_key callback function support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Amitkumar Karwar <akarwar@xxxxxxxxxxx>

The function invokes mwifiex_set_encode() which stores
the default Tx key index in driver and also passes it
to firmware.

Signed-off-by: Amitkumar Karwar <akarwar@xxxxxxxxxxx>
Signed-off-by: Bing Zhao <bzhao@xxxxxxxxxxx>
---
 drivers/net/wireless/mwifiex/cfg80211.c  |   10 ++++++++++
 drivers/net/wireless/mwifiex/sta_ioctl.c |    3 ++-
 2 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index e28f1c7..f4d240e 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -225,6 +225,16 @@ mwifiex_cfg80211_set_default_key(struct wiphy *wiphy, struct net_device *netdev,
 				 u8 key_index, bool unicast,
 				 bool multicast)
 {
+	struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy);
+	int ret;
+
+	ret = mwifiex_set_encode(priv, NULL, 0, key_index, 0);
+
+	wiphy_dbg(wiphy, "info: set default Tx key index\n");
+
+	if (ret)
+		return -EFAULT;
+
 	return 0;
 }
 
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c
index 436310d..1f8d562 100644
--- a/drivers/net/wireless/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/mwifiex/sta_ioctl.c
@@ -2168,7 +2168,8 @@ int mwifiex_set_encode(struct mwifiex_private *priv, const u8 *key,
 	encrypt_key.key_len = key_len;
 	if (!disable) {
 		encrypt_key.key_index = key_index;
-		memcpy(encrypt_key.key_material, key, key_len);
+		if (key_len)
+			memcpy(encrypt_key.key_material, key, key_len);
 	} else {
 		encrypt_key.key_disable = true;
 	}
-- 
1.7.0.2

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


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux