aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorAvinash Patil <patila@marvell.com>2012-05-08 21:30:18 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-05-16 12:46:35 -0400
commit75edd2c6803aec27083643e21aeb9b531587803f (patch)
tree3526b1e0215ac1c9833202f146d591ede4c29a96 /drivers/net
parent67fdf39e0b2fcfd14584e7b1e23c607450f5b96f (diff)
mwifiex: append peer mac address TLV in key material command to firmware
Modify key related cfg80211 handlers to copy peer mac address for pairwise keys. If peer mac address is not present or group keys, it will be sent as broadcast mac address. This would be required since hostapd downloads per peer PTK. Signed-off-by: Avinash Patil <patila@marvell.com> Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com> Signed-off-by: Kiran Divekar <dkiran@marvell.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c14
-rw-r--r--drivers/net/wireless/mwifiex/fw.h11
-rw-r--r--drivers/net/wireless/mwifiex/main.h3
-rw-r--r--drivers/net/wireless/mwifiex/sta_cmd.c20
-rw-r--r--drivers/net/wireless/mwifiex/sta_ioctl.c7
5 files changed, 46 insertions, 9 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index ff627e1f8378..e09f0c2e46ab 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -97,8 +97,10 @@ mwifiex_cfg80211_del_key(struct wiphy *wiphy, struct net_device *netdev,
97 u8 key_index, bool pairwise, const u8 *mac_addr) 97 u8 key_index, bool pairwise, const u8 *mac_addr)
98{ 98{
99 struct mwifiex_private *priv = mwifiex_netdev_get_priv(netdev); 99 struct mwifiex_private *priv = mwifiex_netdev_get_priv(netdev);
100 const u8 bc_mac[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
101 const u8 *peer_mac = pairwise ? mac_addr : bc_mac;
100 102
101 if (mwifiex_set_encode(priv, NULL, 0, key_index, 1)) { 103 if (mwifiex_set_encode(priv, NULL, 0, key_index, peer_mac, 1)) {
102 wiphy_err(wiphy, "deleting the crypto keys\n"); 104 wiphy_err(wiphy, "deleting the crypto keys\n");
103 return -EFAULT; 105 return -EFAULT;
104 } 106 }
@@ -168,7 +170,7 @@ mwifiex_cfg80211_set_default_key(struct wiphy *wiphy, struct net_device *netdev,
168 if (!priv->sec_info.wep_enabled) 170 if (!priv->sec_info.wep_enabled)
169 return 0; 171 return 0;
170 172
171 if (mwifiex_set_encode(priv, NULL, 0, key_index, 0)) { 173 if (mwifiex_set_encode(priv, NULL, 0, key_index, NULL, 0)) {
172 wiphy_err(wiphy, "set default Tx key index\n"); 174 wiphy_err(wiphy, "set default Tx key index\n");
173 return -EFAULT; 175 return -EFAULT;
174 } 176 }
@@ -185,9 +187,11 @@ mwifiex_cfg80211_add_key(struct wiphy *wiphy, struct net_device *netdev,
185 struct key_params *params) 187 struct key_params *params)
186{ 188{
187 struct mwifiex_private *priv = mwifiex_netdev_get_priv(netdev); 189 struct mwifiex_private *priv = mwifiex_netdev_get_priv(netdev);
190 const u8 bc_mac[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
191 const u8 *peer_mac = pairwise ? mac_addr : bc_mac;
188 192
189 if (mwifiex_set_encode(priv, params->key, params->key_len, 193 if (mwifiex_set_encode(priv, params->key, params->key_len,
190 key_index, 0)) { 194 key_index, peer_mac, 0)) {
191 wiphy_err(wiphy, "crypto keys added\n"); 195 wiphy_err(wiphy, "crypto keys added\n");
192 return -EFAULT; 196 return -EFAULT;
193 } 197 }
@@ -947,7 +951,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid,
947 priv->wep_key_curr_index = 0; 951 priv->wep_key_curr_index = 0;
948 priv->sec_info.encryption_mode = 0; 952 priv->sec_info.encryption_mode = 0;
949 priv->sec_info.is_authtype_auto = 0; 953 priv->sec_info.is_authtype_auto = 0;
950 ret = mwifiex_set_encode(priv, NULL, 0, 0, 1); 954 ret = mwifiex_set_encode(priv, NULL, 0, 0, NULL, 1);
951 955
952 if (mode == NL80211_IFTYPE_ADHOC) { 956 if (mode == NL80211_IFTYPE_ADHOC) {
953 /* "privacy" is set only for ad-hoc mode */ 957 /* "privacy" is set only for ad-hoc mode */
@@ -995,7 +999,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid,
995 " with key len %d\n", sme->key_len); 999 " with key len %d\n", sme->key_len);
996 priv->wep_key_curr_index = sme->key_idx; 1000 priv->wep_key_curr_index = sme->key_idx;
997 ret = mwifiex_set_encode(priv, sme->key, sme->key_len, 1001 ret = mwifiex_set_encode(priv, sme->key, sme->key_len,
998 sme->key_idx, 0); 1002 sme->key_idx, NULL, 0);
999 } 1003 }
1000 } 1004 }
1001done: 1005done:
diff --git a/drivers/net/wireless/mwifiex/fw.h b/drivers/net/wireless/mwifiex/fw.h
index 5f6adeb9b950..39969184a3f9 100644
--- a/drivers/net/wireless/mwifiex/fw.h
+++ b/drivers/net/wireless/mwifiex/fw.h
@@ -104,6 +104,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {
104#define TLV_TYPE_TSFTIMESTAMP (PROPRIETARY_TLV_BASE_ID + 19) 104#define TLV_TYPE_TSFTIMESTAMP (PROPRIETARY_TLV_BASE_ID + 19)
105#define TLV_TYPE_RSSI_HIGH (PROPRIETARY_TLV_BASE_ID + 22) 105#define TLV_TYPE_RSSI_HIGH (PROPRIETARY_TLV_BASE_ID + 22)
106#define TLV_TYPE_AUTH_TYPE (PROPRIETARY_TLV_BASE_ID + 31) 106#define TLV_TYPE_AUTH_TYPE (PROPRIETARY_TLV_BASE_ID + 31)
107#define TLV_TYPE_STA_MAC_ADDR (PROPRIETARY_TLV_BASE_ID + 32)
107#define TLV_TYPE_CHANNELBANDLIST (PROPRIETARY_TLV_BASE_ID + 42) 108#define TLV_TYPE_CHANNELBANDLIST (PROPRIETARY_TLV_BASE_ID + 42)
108#define TLV_TYPE_RATE_DROP_CONTROL (PROPRIETARY_TLV_BASE_ID + 82) 109#define TLV_TYPE_RATE_DROP_CONTROL (PROPRIETARY_TLV_BASE_ID + 82)
109#define TLV_TYPE_RATE_SCOPE (PROPRIETARY_TLV_BASE_ID + 83) 110#define TLV_TYPE_RATE_SCOPE (PROPRIETARY_TLV_BASE_ID + 83)
@@ -1103,6 +1104,16 @@ struct host_cmd_ds_802_11_eeprom_access {
1103 u8 value; 1104 u8 value;
1104} __packed; 1105} __packed;
1105 1106
1107struct host_cmd_tlv {
1108 __le16 type;
1109 __le16 len;
1110} __packed;
1111
1112struct host_cmd_tlv_mac_addr {
1113 struct host_cmd_tlv tlv;
1114 u8 mac_addr[ETH_ALEN];
1115} __packed;
1116
1106struct host_cmd_ds_802_11_rf_channel { 1117struct host_cmd_ds_802_11_rf_channel {
1107 __le16 action; 1118 __le16 action;
1108 __le16 current_channel; 1119 __le16 current_channel;
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index e324e29be544..ed978de956d8 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -935,7 +935,8 @@ int mwifiex_set_radio(struct mwifiex_private *priv, u8 option);
935int mwifiex_drv_change_adhoc_chan(struct mwifiex_private *priv, u16 channel); 935int mwifiex_drv_change_adhoc_chan(struct mwifiex_private *priv, u16 channel);
936 936
937int mwifiex_set_encode(struct mwifiex_private *priv, const u8 *key, 937int mwifiex_set_encode(struct mwifiex_private *priv, const u8 *key,
938 int key_len, u8 key_index, int disable); 938 int key_len, u8 key_index, const u8 *mac_addr,
939 int disable);
939 940
940int mwifiex_set_gen_ie(struct mwifiex_private *priv, u8 *ie, int ie_len); 941int mwifiex_set_gen_ie(struct mwifiex_private *priv, u8 *ie, int ie_len);
941 942
diff --git a/drivers/net/wireless/mwifiex/sta_cmd.c b/drivers/net/wireless/mwifiex/sta_cmd.c
index 3697aaa863dd..40e025da6bc2 100644
--- a/drivers/net/wireless/mwifiex/sta_cmd.c
+++ b/drivers/net/wireless/mwifiex/sta_cmd.c
@@ -498,7 +498,8 @@ mwifiex_cmd_802_11_key_material(struct mwifiex_private *priv,
498{ 498{
499 struct host_cmd_ds_802_11_key_material *key_material = 499 struct host_cmd_ds_802_11_key_material *key_material =
500 &cmd->params.key_material; 500 &cmd->params.key_material;
501 u16 key_param_len = 0; 501 struct host_cmd_tlv_mac_addr *tlv_mac;
502 u16 key_param_len = 0, cmd_size;
502 int ret = 0; 503 int ret = 0;
503 const u8 bc_mac[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; 504 const u8 bc_mac[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
504 505
@@ -614,11 +615,26 @@ mwifiex_cmd_802_11_key_material(struct mwifiex_private *priv,
614 cpu_to_le16((u16) enc_key->key_len + 615 cpu_to_le16((u16) enc_key->key_len +
615 KEYPARAMSET_FIXED_LEN); 616 KEYPARAMSET_FIXED_LEN);
616 617
617 key_param_len = (u16) (enc_key->key_len + KEYPARAMSET_FIXED_LEN) 618 key_param_len = (u16)(enc_key->key_len + KEYPARAMSET_FIXED_LEN)
618 + sizeof(struct mwifiex_ie_types_header); 619 + sizeof(struct mwifiex_ie_types_header);
619 620
620 cmd->size = cpu_to_le16(sizeof(key_material->action) + S_DS_GEN 621 cmd->size = cpu_to_le16(sizeof(key_material->action) + S_DS_GEN
621 + key_param_len); 622 + key_param_len);
623
624 if (priv->bss_type == MWIFIEX_BSS_TYPE_UAP) {
625 tlv_mac = (void *)((u8 *)&key_material->key_param_set +
626 key_param_len);
627 tlv_mac->tlv.type = cpu_to_le16(TLV_TYPE_STA_MAC_ADDR);
628 tlv_mac->tlv.len = cpu_to_le16(ETH_ALEN);
629 memcpy(tlv_mac->mac_addr, enc_key->mac_addr, ETH_ALEN);
630 cmd_size = key_param_len + S_DS_GEN +
631 sizeof(key_material->action) +
632 sizeof(struct host_cmd_tlv_mac_addr);
633 } else {
634 cmd_size = key_param_len + S_DS_GEN +
635 sizeof(key_material->action);
636 }
637 cmd->size = cpu_to_le16(cmd_size);
622 } 638 }
623 639
624 return ret; 640 return ret;
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c
index 9265e421e770..106c449477b2 100644
--- a/drivers/net/wireless/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/mwifiex/sta_ioctl.c
@@ -1219,7 +1219,8 @@ mwifiex_drv_get_driver_version(struct mwifiex_adapter *adapter, char *version,
1219 * with requisite parameters and calls the IOCTL handler. 1219 * with requisite parameters and calls the IOCTL handler.
1220 */ 1220 */
1221int mwifiex_set_encode(struct mwifiex_private *priv, const u8 *key, 1221int mwifiex_set_encode(struct mwifiex_private *priv, const u8 *key,
1222 int key_len, u8 key_index, int disable) 1222 int key_len, u8 key_index,
1223 const u8 *mac_addr, int disable)
1223{ 1224{
1224 struct mwifiex_ds_encrypt_key encrypt_key; 1225 struct mwifiex_ds_encrypt_key encrypt_key;
1225 1226
@@ -1229,8 +1230,12 @@ int mwifiex_set_encode(struct mwifiex_private *priv, const u8 *key,
1229 encrypt_key.key_index = key_index; 1230 encrypt_key.key_index = key_index;
1230 if (key_len) 1231 if (key_len)
1231 memcpy(encrypt_key.key_material, key, key_len); 1232 memcpy(encrypt_key.key_material, key, key_len);
1233 if (mac_addr)
1234 memcpy(encrypt_key.mac_addr, mac_addr, ETH_ALEN);
1232 } else { 1235 } else {
1233 encrypt_key.key_disable = true; 1236 encrypt_key.key_disable = true;
1237 if (mac_addr)
1238 memcpy(encrypt_key.mac_addr, mac_addr, ETH_ALEN);
1234 } 1239 }
1235 1240
1236 return mwifiex_sec_ioctl_encrypt_key(priv, &encrypt_key); 1241 return mwifiex_sec_ioctl_encrypt_key(priv, &encrypt_key);