aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2008-02-16 17:54:53 (GMT)
committerJouni Malinen <j@w1.fi>2008-02-16 17:54:53 (GMT)
commitf2ab6025aae87596440a0ce01fa0f032734417d0 (patch)
treea0f07934c9c6b034a35baa3d8516759f4cb600ea
parent62b9ca7889cfea8c1312a1eba0a55e01731a25ea (diff)
downloadhostap-history-f2ab6025aae87596440a0ce01fa0f032734417d0.zip
hostap-history-f2ab6025aae87596440a0ce01fa0f032734417d0.tar.gz
hostap-history-f2ab6025aae87596440a0ce01fa0f032734417d0.tar.bz2
Do not clear AP WPA/RSN IE from AssocInfo event when using ap_scan=2
Previous version ended up clearing the AP WPA/RSN IE when processing association event due to there being no scan result available. This is not correct behavior for the case where beacon IEs are received in AssocInfo event. Clearing of the AP IEs is now skipped if beacon IEs were already received in AssocInfo. In practice, this is unlikely to change anything since WPA code already had functionality for figuring out the correct IEs from scan results if the IEs were not available. Anyway, the fixed behavior is more correct and handles the case of scan results not being available at all (should someone have a driver that does not expose scan results for some reason).
-rw-r--r--wpa_supplicant/events.c7
-rw-r--r--wpa_supplicant/wpa_supplicant.c12
-rw-r--r--wpa_supplicant/wpa_supplicant_i.h1
3 files changed, 14 insertions, 6 deletions
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 289d9a4..ca559c8 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -1,6 +1,6 @@
/*
* WPA Supplicant - Driver event processing
- * Copyright (c) 2003-2007, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2003-2008, Jouni Malinen <j@w1.fi>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -40,6 +40,8 @@ static int wpa_supplicant_select_config(struct wpa_supplicant *wpa_s)
if (wpa_s->conf->ap_scan == 1 && wpa_s->current_ssid)
return 0;
+ wpa_printf(MSG_DEBUG, "Select network based on association "
+ "information");
ssid = wpa_supplicant_get_ssid(wpa_s);
if (ssid == NULL) {
wpa_printf(MSG_INFO, "No network configuration found for the "
@@ -100,6 +102,7 @@ void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s)
if (wpa_s->key_mgmt == WPA_KEY_MGMT_PSK ||
wpa_s->key_mgmt == WPA_KEY_MGMT_FT_PSK)
eapol_sm_notify_eap_success(wpa_s->eapol, FALSE);
+ wpa_s->ap_ies_from_associnfo = 0;
}
@@ -690,6 +693,8 @@ static void wpa_supplicant_event_associnfo(struct wpa_supplicant *wpa_s,
wpa_sm_set_ap_wpa_ie(wpa_s->wpa, NULL, 0);
if (!rsn_found && data->assoc_info.beacon_ies)
wpa_sm_set_ap_rsn_ie(wpa_s->wpa, NULL, 0);
+ if (wpa_found || rsn_found)
+ wpa_s->ap_ies_from_associnfo = 1;
}
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 9132c84..9bd5435 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -770,11 +770,13 @@ int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_RSN_ENABLED,
!!(ssid->proto & WPA_PROTO_RSN));
- if (wpa_sm_set_ap_wpa_ie(wpa_s->wpa, bss_wpa,
- bss_wpa ? 2 + bss_wpa[1] : 0) ||
- wpa_sm_set_ap_rsn_ie(wpa_s->wpa, bss_rsn,
- bss_rsn ? 2 + bss_rsn[1] : 0))
- return -1;
+ if (bss || !wpa_s->ap_ies_from_associnfo) {
+ if (wpa_sm_set_ap_wpa_ie(wpa_s->wpa, bss_wpa,
+ bss_wpa ? 2 + bss_wpa[1] : 0) ||
+ wpa_sm_set_ap_rsn_ie(wpa_s->wpa, bss_rsn,
+ bss_rsn ? 2 + bss_rsn[1] : 0))
+ return -1;
+ }
sel = ie.group_cipher & ssid->group_cipher;
if (sel & WPA_CIPHER_CCMP) {
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index 91bbe2b..a2e3dd5 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -281,6 +281,7 @@ struct wpa_supplicant {
int disconnected; /* all connections disabled; i.e., do no reassociate
* before this has been cleared */
struct wpa_ssid *current_ssid;
+ int ap_ies_from_associnfo;
/* Selected configuration (based on Beacon/ProbeResp WPA IE) */
int pairwise_cipher;