nl80211: Fix static WEP key configuration when using SME

Need to set WEP keys before requesting authentication in order to get
Shared Key authentication working. Previously, the WEP keys were not set
at all when using SME in wpa_supplicant.
This commit is contained in:
Jouni Malinen 2009-04-04 16:58:16 +03:00
parent acae30ed7b
commit a0b2f99bd7
3 changed files with 22 additions and 1 deletions

View File

@ -209,6 +209,9 @@ struct wpa_driver_auth_params {
int auth_alg;
const u8 *ie;
size_t ie_len;
const u8 *wep_key[4];
size_t wep_key_len[4];
int wep_tx_keyidx;
};
/**

View File

@ -1488,7 +1488,7 @@ static int wpa_driver_nl80211_authenticate(
void *priv, struct wpa_driver_auth_params *params)
{
struct wpa_driver_nl80211_data *drv = priv;
int ret = -1;
int ret = -1, i;
struct nl_msg *msg;
enum nl80211_auth_type type;
@ -1500,6 +1500,16 @@ static int wpa_driver_nl80211_authenticate(
wpa_printf(MSG_DEBUG, "nl80211: Authenticate (ifindex=%d)",
drv->ifindex);
for (i = 0; i < 4; i++) {
if (!params->wep_key[i])
continue;
wpa_driver_nl80211_set_key(drv, WPA_ALG_WEP, NULL, i,
i == params->wep_tx_keyidx, NULL, 0,
params->wep_key[i],
params->wep_key_len[i]);
}
genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0, 0,
NL80211_CMD_AUTHENTICATE, 0);

View File

@ -35,6 +35,7 @@ void sme_authenticate(struct wpa_supplicant *wpa_s,
#ifdef CONFIG_IEEE80211R
const u8 *md = NULL;
#endif /* CONFIG_IEEE80211R */
int i;
if (bss == NULL) {
wpa_printf(MSG_ERROR, "SME: No scan result available for the "
@ -84,6 +85,13 @@ void sme_authenticate(struct wpa_supplicant *wpa_s,
params.auth_alg);
}
for (i = 0; i < NUM_WEP_KEYS; i++) {
if (ssid->wep_key_len[i])
params.wep_key[i] = ssid->wep_key[i];
params.wep_key_len[i] = ssid->wep_key_len[i];
}
params.wep_tx_keyidx = ssid->wep_tx_keyidx;
os_memset(wpa_s->bssid, 0, ETH_ALEN);
os_memcpy(wpa_s->pending_bssid, bss->bssid, ETH_ALEN);