diff options
author | Dan Williams <dcbw@redhat.com> | 2007-05-25 23:01:24 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2007-06-11 14:28:44 -0400 |
commit | 90a42210f275e1f828eb6c08bf8252c2d6a774e0 (patch) | |
tree | 7530def8af573622c4d2a3223eb8774ee76a0405 /drivers/net | |
parent | 45f43de829981e9b9de56d6098d00d511b4fb56c (diff) |
[PATCH] libertas: Make WPA work through supplicant handshake
Fix WPA so it works up through the supplicant 4-Way handshake process.
Doesn't successfully pass traffic yet; may be problems installing
the GTK to the firmware.
- RSN needs to be enabled before the association command is sent
- Use keys from the association request not the adapter structure
- cmd_act_mac_strict_protection_enable != IW_AUTH_DROP_UNENCRYPTED
- Fix network filtering logic in is_network_compatible() WPA helpers
Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/libertas/assoc.c | 20 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/cmd.c | 48 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/scan.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/wext.c | 92 |
4 files changed, 98 insertions, 64 deletions
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index 48fc6d171d58..2ee38a25adef 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c | |||
@@ -347,7 +347,17 @@ static int assoc_helper_secinfo(wlan_private *priv, | |||
347 | sizeof(struct wlan_802_11_security)); | 347 | sizeof(struct wlan_802_11_security)); |
348 | 348 | ||
349 | ret = libertas_set_mac_packet_filter(priv); | 349 | ret = libertas_set_mac_packet_filter(priv); |
350 | if (ret) | ||
351 | goto out; | ||
350 | 352 | ||
353 | /* enable/disable RSN */ | ||
354 | ret = libertas_prepare_and_send_command(priv, | ||
355 | cmd_802_11_enable_rsn, | ||
356 | cmd_act_set, | ||
357 | cmd_option_waitforrsp, | ||
358 | 0, assoc_req); | ||
359 | |||
360 | out: | ||
351 | lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); | 361 | lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); |
352 | return ret; | 362 | return ret; |
353 | } | 363 | } |
@@ -360,22 +370,12 @@ static int assoc_helper_wpa_keys(wlan_private *priv, | |||
360 | 370 | ||
361 | lbs_deb_enter(LBS_DEB_ASSOC); | 371 | lbs_deb_enter(LBS_DEB_ASSOC); |
362 | 372 | ||
363 | /* enable/Disable RSN */ | ||
364 | ret = libertas_prepare_and_send_command(priv, | ||
365 | cmd_802_11_enable_rsn, | ||
366 | cmd_act_set, | ||
367 | cmd_option_waitforrsp, | ||
368 | 0, assoc_req); | ||
369 | if (ret) | ||
370 | goto out; | ||
371 | |||
372 | ret = libertas_prepare_and_send_command(priv, | 373 | ret = libertas_prepare_and_send_command(priv, |
373 | cmd_802_11_key_material, | 374 | cmd_802_11_key_material, |
374 | cmd_act_set, | 375 | cmd_act_set, |
375 | cmd_option_waitforrsp, | 376 | cmd_option_waitforrsp, |
376 | 0, assoc_req); | 377 | 0, assoc_req); |
377 | 378 | ||
378 | out: | ||
379 | lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); | 379 | lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); |
380 | return ret; | 380 | return ret; |
381 | } | 381 | } |
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 53ac28e3ecaf..8da788e2ecf9 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c | |||
@@ -232,22 +232,25 @@ done: | |||
232 | 232 | ||
233 | static int wlan_cmd_802_11_enable_rsn(wlan_private * priv, | 233 | static int wlan_cmd_802_11_enable_rsn(wlan_private * priv, |
234 | struct cmd_ds_command *cmd, | 234 | struct cmd_ds_command *cmd, |
235 | u16 cmd_action) | 235 | u16 cmd_action, |
236 | void * pdata_buf) | ||
236 | { | 237 | { |
237 | struct cmd_ds_802_11_enable_rsn *penableRSN = &cmd->params.enbrsn; | 238 | struct cmd_ds_802_11_enable_rsn *penableRSN = &cmd->params.enbrsn; |
238 | wlan_adapter *adapter = priv->adapter; | 239 | struct assoc_request * assoc_req = pdata_buf; |
240 | |||
241 | lbs_deb_enter(LBS_DEB_CMD); | ||
239 | 242 | ||
240 | cmd->command = cpu_to_le16(cmd_802_11_enable_rsn); | 243 | cmd->command = cpu_to_le16(cmd_802_11_enable_rsn); |
241 | cmd->size = | 244 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_enable_rsn) + |
242 | cpu_to_le16(sizeof(struct cmd_ds_802_11_enable_rsn) + | 245 | S_DS_GEN); |
243 | S_DS_GEN); | ||
244 | penableRSN->action = cpu_to_le16(cmd_action); | 246 | penableRSN->action = cpu_to_le16(cmd_action); |
245 | if (adapter->secinfo.WPAenabled || adapter->secinfo.WPA2enabled) { | 247 | if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) { |
246 | penableRSN->enable = cpu_to_le16(cmd_enable_rsn); | 248 | penableRSN->enable = cpu_to_le16(cmd_enable_rsn); |
247 | } else { | 249 | } else { |
248 | penableRSN->enable = cpu_to_le16(cmd_disable_rsn); | 250 | penableRSN->enable = cpu_to_le16(cmd_disable_rsn); |
249 | } | 251 | } |
250 | 252 | ||
253 | lbs_deb_leave(LBS_DEB_CMD); | ||
251 | return 0; | 254 | return 0; |
252 | } | 255 | } |
253 | 256 | ||
@@ -258,14 +261,12 @@ static void set_one_wpa_key(struct MrvlIEtype_keyParamSet * pkeyparamset, | |||
258 | pkeyparamset->keytypeid = cpu_to_le16(pkey->type); | 261 | pkeyparamset->keytypeid = cpu_to_le16(pkey->type); |
259 | 262 | ||
260 | if (pkey->flags & KEY_INFO_WPA_ENABLED) { | 263 | if (pkey->flags & KEY_INFO_WPA_ENABLED) { |
261 | pkeyparamset->keyinfo = cpu_to_le16(KEY_INFO_WPA_ENABLED); | 264 | pkeyparamset->keyinfo |= cpu_to_le16(KEY_INFO_WPA_ENABLED); |
262 | } else { | ||
263 | pkeyparamset->keyinfo = cpu_to_le16(!KEY_INFO_WPA_ENABLED); | ||
264 | } | 265 | } |
265 | |||
266 | if (pkey->flags & KEY_INFO_WPA_UNICAST) { | 266 | if (pkey->flags & KEY_INFO_WPA_UNICAST) { |
267 | pkeyparamset->keyinfo |= cpu_to_le16(KEY_INFO_WPA_UNICAST); | 267 | pkeyparamset->keyinfo |= cpu_to_le16(KEY_INFO_WPA_UNICAST); |
268 | } else if (pkey->flags & KEY_INFO_WPA_MCAST) { | 268 | } |
269 | if (pkey->flags & KEY_INFO_WPA_MCAST) { | ||
269 | pkeyparamset->keyinfo |= cpu_to_le16(KEY_INFO_WPA_MCAST); | 270 | pkeyparamset->keyinfo |= cpu_to_le16(KEY_INFO_WPA_MCAST); |
270 | } | 271 | } |
271 | 272 | ||
@@ -283,9 +284,9 @@ static int wlan_cmd_802_11_key_material(wlan_private * priv, | |||
283 | u16 cmd_action, | 284 | u16 cmd_action, |
284 | u32 cmd_oid, void *pdata_buf) | 285 | u32 cmd_oid, void *pdata_buf) |
285 | { | 286 | { |
286 | wlan_adapter *adapter = priv->adapter; | ||
287 | struct cmd_ds_802_11_key_material *pkeymaterial = | 287 | struct cmd_ds_802_11_key_material *pkeymaterial = |
288 | &cmd->params.keymaterial; | 288 | &cmd->params.keymaterial; |
289 | struct assoc_request * assoc_req = pdata_buf; | ||
289 | int ret = 0; | 290 | int ret = 0; |
290 | int index = 0; | 291 | int index = 0; |
291 | 292 | ||
@@ -295,29 +296,28 @@ static int wlan_cmd_802_11_key_material(wlan_private * priv, | |||
295 | pkeymaterial->action = cpu_to_le16(cmd_action); | 296 | pkeymaterial->action = cpu_to_le16(cmd_action); |
296 | 297 | ||
297 | if (cmd_action == cmd_act_get) { | 298 | if (cmd_action == cmd_act_get) { |
298 | cmd->size = cpu_to_le16( S_DS_GEN | 299 | cmd->size = cpu_to_le16(S_DS_GEN + sizeof (pkeymaterial->action)); |
299 | + sizeof (pkeymaterial->action)); | ||
300 | ret = 0; | 300 | ret = 0; |
301 | goto done; | 301 | goto done; |
302 | } | 302 | } |
303 | 303 | ||
304 | memset(&pkeymaterial->keyParamSet, 0, sizeof(pkeymaterial->keyParamSet)); | 304 | memset(&pkeymaterial->keyParamSet, 0, sizeof(pkeymaterial->keyParamSet)); |
305 | 305 | ||
306 | if (adapter->wpa_unicast_key.len) { | 306 | if (test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags)) { |
307 | set_one_wpa_key(&pkeymaterial->keyParamSet[index], | 307 | set_one_wpa_key(&pkeymaterial->keyParamSet[index], |
308 | &adapter->wpa_unicast_key); | 308 | &assoc_req->wpa_unicast_key); |
309 | index++; | 309 | index++; |
310 | } | 310 | } |
311 | 311 | ||
312 | if (adapter->wpa_mcast_key.len) { | 312 | if (test_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags)) { |
313 | set_one_wpa_key(&pkeymaterial->keyParamSet[index], | 313 | set_one_wpa_key(&pkeymaterial->keyParamSet[index], |
314 | &adapter->wpa_mcast_key); | 314 | &assoc_req->wpa_mcast_key); |
315 | index++; | 315 | index++; |
316 | } | 316 | } |
317 | 317 | ||
318 | cmd->size = cpu_to_le16( S_DS_GEN | 318 | cmd->size = cpu_to_le16( S_DS_GEN |
319 | + sizeof (pkeymaterial->action) | 319 | + sizeof (pkeymaterial->action) |
320 | + index * sizeof(struct MrvlIEtype_keyParamSet)); | 320 | + (index * sizeof(struct MrvlIEtype_keyParamSet))); |
321 | 321 | ||
322 | ret = 0; | 322 | ret = 0; |
323 | 323 | ||
@@ -1302,13 +1302,13 @@ int libertas_prepare_and_send_command(wlan_private * priv, | |||
1302 | break; | 1302 | break; |
1303 | 1303 | ||
1304 | case cmd_802_11_enable_rsn: | 1304 | case cmd_802_11_enable_rsn: |
1305 | ret = wlan_cmd_802_11_enable_rsn(priv, cmdptr, cmd_action); | 1305 | ret = wlan_cmd_802_11_enable_rsn(priv, cmdptr, cmd_action, |
1306 | pdata_buf); | ||
1306 | break; | 1307 | break; |
1307 | 1308 | ||
1308 | case cmd_802_11_key_material: | 1309 | case cmd_802_11_key_material: |
1309 | ret = wlan_cmd_802_11_key_material(priv, cmdptr, | 1310 | ret = wlan_cmd_802_11_key_material(priv, cmdptr, cmd_action, |
1310 | cmd_action, cmd_oid, | 1311 | cmd_oid, pdata_buf); |
1311 | pdata_buf); | ||
1312 | break; | 1312 | break; |
1313 | 1313 | ||
1314 | case cmd_802_11_pairwise_tsc: | 1314 | case cmd_802_11_pairwise_tsc: |
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c index ec16cd08aead..3da1efdf1a0c 100644 --- a/drivers/net/wireless/libertas/scan.c +++ b/drivers/net/wireless/libertas/scan.c | |||
@@ -99,7 +99,6 @@ static inline int match_bss_wpa(struct wlan_802_11_security * secinfo, | |||
99 | { | 99 | { |
100 | if ( !secinfo->wep_enabled | 100 | if ( !secinfo->wep_enabled |
101 | && secinfo->WPAenabled | 101 | && secinfo->WPAenabled |
102 | && !secinfo->WPA2enabled | ||
103 | && (match_bss->wpa_ie[0] == WPA_IE) | 102 | && (match_bss->wpa_ie[0] == WPA_IE) |
104 | /* privacy bit may NOT be set in some APs like LinkSys WRT54G | 103 | /* privacy bit may NOT be set in some APs like LinkSys WRT54G |
105 | && bss->privacy */ | 104 | && bss->privacy */ |
@@ -113,7 +112,6 @@ static inline int match_bss_wpa2(struct wlan_802_11_security * secinfo, | |||
113 | struct bss_descriptor * match_bss) | 112 | struct bss_descriptor * match_bss) |
114 | { | 113 | { |
115 | if ( !secinfo->wep_enabled | 114 | if ( !secinfo->wep_enabled |
116 | && !secinfo->WPAenabled | ||
117 | && secinfo->WPA2enabled | 115 | && secinfo->WPA2enabled |
118 | && (match_bss->rsn_ie[0] == WPA2_IE) | 116 | && (match_bss->rsn_ie[0] == WPA2_IE) |
119 | /* privacy bit may NOT be set in some APs like LinkSys WRT54G | 117 | /* privacy bit may NOT be set in some APs like LinkSys WRT54G |
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index 40dd08018b49..2edc10c3327f 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c | |||
@@ -1498,6 +1498,8 @@ static void disable_wep(struct assoc_request *assoc_req) | |||
1498 | { | 1498 | { |
1499 | int i; | 1499 | int i; |
1500 | 1500 | ||
1501 | lbs_deb_enter(LBS_DEB_WEXT); | ||
1502 | |||
1501 | /* Set Open System auth mode */ | 1503 | /* Set Open System auth mode */ |
1502 | assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; | 1504 | assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; |
1503 | 1505 | ||
@@ -1508,6 +1510,27 @@ static void disable_wep(struct assoc_request *assoc_req) | |||
1508 | 1510 | ||
1509 | set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags); | 1511 | set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags); |
1510 | set_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags); | 1512 | set_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags); |
1513 | |||
1514 | lbs_deb_leave(LBS_DEB_WEXT); | ||
1515 | } | ||
1516 | |||
1517 | static void disable_wpa(struct assoc_request *assoc_req) | ||
1518 | { | ||
1519 | lbs_deb_enter(LBS_DEB_WEXT); | ||
1520 | |||
1521 | memset(&assoc_req->wpa_mcast_key, 0, sizeof (struct WLAN_802_11_KEY)); | ||
1522 | assoc_req->wpa_mcast_key.flags = KEY_INFO_WPA_MCAST; | ||
1523 | set_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags); | ||
1524 | |||
1525 | memset(&assoc_req->wpa_unicast_key, 0, sizeof (struct WLAN_802_11_KEY)); | ||
1526 | assoc_req->wpa_unicast_key.flags = KEY_INFO_WPA_UNICAST; | ||
1527 | set_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags); | ||
1528 | |||
1529 | assoc_req->secinfo.WPAenabled = 0; | ||
1530 | assoc_req->secinfo.WPA2enabled = 0; | ||
1531 | set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags); | ||
1532 | |||
1533 | lbs_deb_leave(LBS_DEB_WEXT); | ||
1511 | } | 1534 | } |
1512 | 1535 | ||
1513 | /** | 1536 | /** |
@@ -1540,6 +1563,7 @@ static int wlan_set_encode(struct net_device *dev, | |||
1540 | 1563 | ||
1541 | if (dwrq->flags & IW_ENCODE_DISABLED) { | 1564 | if (dwrq->flags & IW_ENCODE_DISABLED) { |
1542 | disable_wep (assoc_req); | 1565 | disable_wep (assoc_req); |
1566 | disable_wpa (assoc_req); | ||
1543 | goto out; | 1567 | goto out; |
1544 | } | 1568 | } |
1545 | 1569 | ||
@@ -1641,6 +1665,7 @@ static int wlan_get_encodeext(struct net_device *dev, | |||
1641 | if ( adapter->secinfo.wep_enabled | 1665 | if ( adapter->secinfo.wep_enabled |
1642 | && !adapter->secinfo.WPAenabled | 1666 | && !adapter->secinfo.WPAenabled |
1643 | && !adapter->secinfo.WPA2enabled) { | 1667 | && !adapter->secinfo.WPA2enabled) { |
1668 | /* WEP */ | ||
1644 | ext->alg = IW_ENCODE_ALG_WEP; | 1669 | ext->alg = IW_ENCODE_ALG_WEP; |
1645 | ext->key_len = adapter->wep_keys[index].len; | 1670 | ext->key_len = adapter->wep_keys[index].len; |
1646 | key = &adapter->wep_keys[index].key[0]; | 1671 | key = &adapter->wep_keys[index].key[0]; |
@@ -1648,8 +1673,27 @@ static int wlan_get_encodeext(struct net_device *dev, | |||
1648 | && (adapter->secinfo.WPAenabled || | 1673 | && (adapter->secinfo.WPAenabled || |
1649 | adapter->secinfo.WPA2enabled)) { | 1674 | adapter->secinfo.WPA2enabled)) { |
1650 | /* WPA */ | 1675 | /* WPA */ |
1651 | ext->alg = IW_ENCODE_ALG_TKIP; | 1676 | struct WLAN_802_11_KEY * pkey = NULL; |
1652 | ext->key_len = 0; | 1677 | |
1678 | if ( adapter->wpa_mcast_key.len | ||
1679 | && (adapter->wpa_mcast_key.flags & KEY_INFO_WPA_ENABLED)) | ||
1680 | pkey = &adapter->wpa_mcast_key; | ||
1681 | else if ( adapter->wpa_unicast_key.len | ||
1682 | && (adapter->wpa_unicast_key.flags & KEY_INFO_WPA_ENABLED)) | ||
1683 | pkey = &adapter->wpa_unicast_key; | ||
1684 | |||
1685 | if (pkey) { | ||
1686 | if (pkey->type == KEY_TYPE_ID_AES) { | ||
1687 | ext->alg = IW_ENCODE_ALG_CCMP; | ||
1688 | } else { | ||
1689 | ext->alg = IW_ENCODE_ALG_TKIP; | ||
1690 | } | ||
1691 | ext->key_len = pkey->len; | ||
1692 | key = &pkey->key[0]; | ||
1693 | } else { | ||
1694 | ext->alg = IW_ENCODE_ALG_TKIP; | ||
1695 | ext->key_len = 0; | ||
1696 | } | ||
1653 | } else { | 1697 | } else { |
1654 | goto out; | 1698 | goto out; |
1655 | } | 1699 | } |
@@ -1704,6 +1748,7 @@ static int wlan_set_encodeext(struct net_device *dev, | |||
1704 | 1748 | ||
1705 | if ((alg == IW_ENCODE_ALG_NONE) || (dwrq->flags & IW_ENCODE_DISABLED)) { | 1749 | if ((alg == IW_ENCODE_ALG_NONE) || (dwrq->flags & IW_ENCODE_DISABLED)) { |
1706 | disable_wep (assoc_req); | 1750 | disable_wep (assoc_req); |
1751 | disable_wpa (assoc_req); | ||
1707 | } else if (alg == IW_ENCODE_ALG_WEP) { | 1752 | } else if (alg == IW_ENCODE_ALG_WEP) { |
1708 | u16 is_default = 0, index, set_tx_key = 0; | 1753 | u16 is_default = 0, index, set_tx_key = 0; |
1709 | 1754 | ||
@@ -1739,7 +1784,6 @@ static int wlan_set_encodeext(struct net_device *dev, | |||
1739 | set_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags); | 1784 | set_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags); |
1740 | if (set_tx_key) | 1785 | if (set_tx_key) |
1741 | set_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags); | 1786 | set_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags); |
1742 | |||
1743 | } else if ((alg == IW_ENCODE_ALG_TKIP) || (alg == IW_ENCODE_ALG_CCMP)) { | 1787 | } else if ((alg == IW_ENCODE_ALG_TKIP) || (alg == IW_ENCODE_ALG_CCMP)) { |
1744 | struct WLAN_802_11_KEY * pkey; | 1788 | struct WLAN_802_11_KEY * pkey; |
1745 | 1789 | ||
@@ -1756,28 +1800,35 @@ static int wlan_set_encodeext(struct net_device *dev, | |||
1756 | goto out; | 1800 | goto out; |
1757 | } | 1801 | } |
1758 | 1802 | ||
1759 | if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) | 1803 | if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { |
1760 | pkey = &assoc_req->wpa_mcast_key; | 1804 | pkey = &assoc_req->wpa_mcast_key; |
1761 | else | 1805 | set_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags); |
1806 | } else { | ||
1762 | pkey = &assoc_req->wpa_unicast_key; | 1807 | pkey = &assoc_req->wpa_unicast_key; |
1808 | set_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags); | ||
1809 | } | ||
1763 | 1810 | ||
1764 | memset(pkey, 0, sizeof (struct WLAN_802_11_KEY)); | 1811 | memset(pkey, 0, sizeof (struct WLAN_802_11_KEY)); |
1765 | memcpy(pkey->key, ext->key, ext->key_len); | 1812 | memcpy(pkey->key, ext->key, ext->key_len); |
1766 | pkey->len = ext->key_len; | 1813 | pkey->len = ext->key_len; |
1767 | pkey->flags = KEY_INFO_WPA_ENABLED; | 1814 | if (pkey->len) |
1815 | pkey->flags |= KEY_INFO_WPA_ENABLED; | ||
1768 | 1816 | ||
1817 | /* Do this after zeroing key structure */ | ||
1769 | if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { | 1818 | if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { |
1770 | pkey->flags |= KEY_INFO_WPA_MCAST; | 1819 | pkey->flags |= KEY_INFO_WPA_MCAST; |
1771 | set_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags); | ||
1772 | } else { | 1820 | } else { |
1773 | pkey->flags |= KEY_INFO_WPA_UNICAST; | 1821 | pkey->flags |= KEY_INFO_WPA_UNICAST; |
1774 | set_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags); | ||
1775 | } | 1822 | } |
1776 | 1823 | ||
1777 | if (alg == IW_ENCODE_ALG_TKIP) | 1824 | if (alg == IW_ENCODE_ALG_TKIP) { |
1778 | pkey->type = KEY_TYPE_ID_TKIP; | 1825 | pkey->type = KEY_TYPE_ID_TKIP; |
1779 | else if (alg == IW_ENCODE_ALG_CCMP) | 1826 | } else if (alg == IW_ENCODE_ALG_CCMP) { |
1780 | pkey->type = KEY_TYPE_ID_AES; | 1827 | pkey->type = KEY_TYPE_ID_AES; |
1828 | } else { | ||
1829 | ret = -EINVAL; | ||
1830 | goto out; | ||
1831 | } | ||
1781 | 1832 | ||
1782 | /* If WPA isn't enabled yet, do that now */ | 1833 | /* If WPA isn't enabled yet, do that now */ |
1783 | if ( assoc_req->secinfo.WPAenabled == 0 | 1834 | if ( assoc_req->secinfo.WPAenabled == 0 |
@@ -1904,6 +1955,7 @@ static int wlan_set_auth(struct net_device *dev, | |||
1904 | case IW_AUTH_CIPHER_PAIRWISE: | 1955 | case IW_AUTH_CIPHER_PAIRWISE: |
1905 | case IW_AUTH_CIPHER_GROUP: | 1956 | case IW_AUTH_CIPHER_GROUP: |
1906 | case IW_AUTH_KEY_MGMT: | 1957 | case IW_AUTH_KEY_MGMT: |
1958 | case IW_AUTH_DROP_UNENCRYPTED: | ||
1907 | /* | 1959 | /* |
1908 | * libertas does not use these parameters | 1960 | * libertas does not use these parameters |
1909 | */ | 1961 | */ |
@@ -1913,6 +1965,7 @@ static int wlan_set_auth(struct net_device *dev, | |||
1913 | if (dwrq->value & IW_AUTH_WPA_VERSION_DISABLED) { | 1965 | if (dwrq->value & IW_AUTH_WPA_VERSION_DISABLED) { |
1914 | assoc_req->secinfo.WPAenabled = 0; | 1966 | assoc_req->secinfo.WPAenabled = 0; |
1915 | assoc_req->secinfo.WPA2enabled = 0; | 1967 | assoc_req->secinfo.WPA2enabled = 0; |
1968 | disable_wpa (assoc_req); | ||
1916 | } | 1969 | } |
1917 | if (dwrq->value & IW_AUTH_WPA_VERSION_WPA) { | 1970 | if (dwrq->value & IW_AUTH_WPA_VERSION_WPA) { |
1918 | assoc_req->secinfo.WPAenabled = 1; | 1971 | assoc_req->secinfo.WPAenabled = 1; |
@@ -1927,17 +1980,6 @@ static int wlan_set_auth(struct net_device *dev, | |||
1927 | updated = 1; | 1980 | updated = 1; |
1928 | break; | 1981 | break; |
1929 | 1982 | ||
1930 | case IW_AUTH_DROP_UNENCRYPTED: | ||
1931 | if (dwrq->value) { | ||
1932 | adapter->currentpacketfilter |= | ||
1933 | cmd_act_mac_strict_protection_enable; | ||
1934 | } else { | ||
1935 | adapter->currentpacketfilter &= | ||
1936 | ~cmd_act_mac_strict_protection_enable; | ||
1937 | } | ||
1938 | updated = 1; | ||
1939 | break; | ||
1940 | |||
1941 | case IW_AUTH_80211_AUTH_ALG: | 1983 | case IW_AUTH_80211_AUTH_ALG: |
1942 | if (dwrq->value & IW_AUTH_ALG_SHARED_KEY) { | 1984 | if (dwrq->value & IW_AUTH_ALG_SHARED_KEY) { |
1943 | assoc_req->secinfo.auth_mode = IW_AUTH_ALG_SHARED_KEY; | 1985 | assoc_req->secinfo.auth_mode = IW_AUTH_ALG_SHARED_KEY; |
@@ -1963,6 +2005,7 @@ static int wlan_set_auth(struct net_device *dev, | |||
1963 | } else { | 2005 | } else { |
1964 | assoc_req->secinfo.WPAenabled = 0; | 2006 | assoc_req->secinfo.WPAenabled = 0; |
1965 | assoc_req->secinfo.WPA2enabled = 0; | 2007 | assoc_req->secinfo.WPA2enabled = 0; |
2008 | disable_wpa (assoc_req); | ||
1966 | } | 2009 | } |
1967 | updated = 1; | 2010 | updated = 1; |
1968 | break; | 2011 | break; |
@@ -2008,13 +2051,6 @@ static int wlan_get_auth(struct net_device *dev, | |||
2008 | dwrq->value |= IW_AUTH_WPA_VERSION_DISABLED; | 2051 | dwrq->value |= IW_AUTH_WPA_VERSION_DISABLED; |
2009 | break; | 2052 | break; |
2010 | 2053 | ||
2011 | case IW_AUTH_DROP_UNENCRYPTED: | ||
2012 | dwrq->value = 0; | ||
2013 | if (adapter->currentpacketfilter & | ||
2014 | cmd_act_mac_strict_protection_enable) | ||
2015 | dwrq->value = 1; | ||
2016 | break; | ||
2017 | |||
2018 | case IW_AUTH_80211_AUTH_ALG: | 2054 | case IW_AUTH_80211_AUTH_ALG: |
2019 | dwrq->value = adapter->secinfo.auth_mode; | 2055 | dwrq->value = adapter->secinfo.auth_mode; |
2020 | break; | 2056 | break; |