aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwmc3200wifi/cfg80211.c
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2009-09-01 09:13:59 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-09-01 12:48:26 -0400
commitb90a5c9561d3f75f906a84613cc0071121143fb6 (patch)
tree138da17f2cbb0da9c72a850e8063eb4ccb1204dc /drivers/net/wireless/iwmc3200wifi/cfg80211.c
parentae73abf2350de7cbfc5c46a936f4d2a532b36679 (diff)
iwmc3200wifi: Set WEP key from connect
When connect is called with the LEGACY_PSK authentication type set, and a proper sme->key, we need to set the WEP key straight after setting the profile otherwise the authentication will never start. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwmc3200wifi/cfg80211.c')
-rw-r--r--drivers/net/wireless/iwmc3200wifi/cfg80211.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/drivers/net/wireless/iwmc3200wifi/cfg80211.c b/drivers/net/wireless/iwmc3200wifi/cfg80211.c
index 789ef5ca88ba..d8bb723d88d9 100644
--- a/drivers/net/wireless/iwmc3200wifi/cfg80211.c
+++ b/drivers/net/wireless/iwmc3200wifi/cfg80211.c
@@ -562,6 +562,7 @@ static int iwm_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
562{ 562{
563 struct iwm_priv *iwm = wiphy_to_iwm(wiphy); 563 struct iwm_priv *iwm = wiphy_to_iwm(wiphy);
564 struct ieee80211_channel *chan = sme->channel; 564 struct ieee80211_channel *chan = sme->channel;
565 struct key_params key_param;
565 int ret; 566 int ret;
566 567
567 if (!test_bit(IWM_STATUS_READY, &iwm->status)) 568 if (!test_bit(IWM_STATUS_READY, &iwm->status))
@@ -619,7 +620,48 @@ static int iwm_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
619 return ret; 620 return ret;
620 } 621 }
621 622
622 return iwm_send_mlme_profile(iwm); 623 /*
624 * We save the WEP key in case we want to do shared authentication.
625 * We have to do it so because UMAC will assert whenever it gets a
626 * key before a profile.
627 */
628 if (sme->key) {
629 key_param.key = kmemdup(sme->key, sme->key_len, GFP_KERNEL);
630 if (key_param.key == NULL)
631 return -ENOMEM;
632 key_param.key_len = sme->key_len;
633 key_param.seq_len = 0;
634 key_param.cipher = sme->crypto.ciphers_pairwise[0];
635
636 ret = iwm_key_init(&iwm->keys[sme->key_idx], sme->key_idx,
637 NULL, &key_param);
638 kfree(key_param.key);
639 if (ret < 0) {
640 IWM_ERR(iwm, "Invalid key_params\n");
641 return ret;
642 }
643
644 iwm->default_key = sme->key_idx;
645 }
646
647 ret = iwm_send_mlme_profile(iwm);
648
649 if (iwm->umac_profile->sec.auth_type != UMAC_AUTH_TYPE_LEGACY_PSK ||
650 sme->key == NULL)
651 return ret;
652
653 /*
654 * We want to do shared auth.
655 * We need to actually set the key we previously cached,
656 * and then tell the UMAC it's the default one.
657 * That will trigger the auth+assoc UMAC machinery, and again,
658 * this must be done after setting the profile.
659 */
660 ret = iwm_set_key(iwm, 0, &iwm->keys[sme->key_idx]);
661 if (ret < 0)
662 return ret;
663
664 return iwm_set_tx_key(iwm, iwm->default_key);
623} 665}
624 666
625static int iwm_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, 667static int iwm_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev,