aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2005-06-25 16:30:10 (GMT)
committerJouni Malinen <j@w1.fi>2005-06-25 16:30:10 (GMT)
commit8082351af69925928353802696dd78f13c486712 (patch)
tree9b306d14db6a4087e48f99ea8339587222123c28
parent0d34391dfb3d6d9806e1f211f026c302ec01a49c (diff)
downloadhostap-history-8082351af69925928353802696dd78f13c486712.zip
hostap-history-8082351af69925928353802696dd78f13c486712.tar.gz
hostap-history-8082351af69925928353802696dd78f13c486712.tar.bz2
wpa_parse_wpa_ie() was not actually using wpa_s parameter anymore, so
let's remove it to get the WPA state machine more independent of struct wpa_supplicant. In addition, this allows rsn_preauth_scan_results() to replace struct wpa_supplicant with struct wpa_sm.
-rw-r--r--wpa_supplicant/ctrl_iface.c2
-rw-r--r--wpa_supplicant/eapol_test.c4
-rw-r--r--wpa_supplicant/events.c14
-rw-r--r--wpa_supplicant/preauth.c7
-rw-r--r--wpa_supplicant/preauth.h4
-rw-r--r--wpa_supplicant/wpa.c17
-rw-r--r--wpa_supplicant/wpa.h4
-rw-r--r--wpa_supplicant/wpa_supplicant.c6
8 files changed, 28 insertions, 30 deletions
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index adc305d..20ef335 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -466,7 +466,7 @@ static char * wpa_supplicant_ie_txt(struct wpa_supplicant *wpa_s,
pos += snprintf(pos, end - pos, "[%s-", proto);
- if (wpa_parse_wpa_ie(wpa_s, ie, ie_len, &data) < 0) {
+ if (wpa_parse_wpa_ie(ie, ie_len, &data) < 0) {
pos += snprintf(pos, end - pos, "?]");
return pos;
}
diff --git a/wpa_supplicant/eapol_test.c b/wpa_supplicant/eapol_test.c
index 4b91f91..735979a 100644
--- a/wpa_supplicant/eapol_test.c
+++ b/wpa_supplicant/eapol_test.c
@@ -187,8 +187,8 @@ int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s)
}
-int wpa_parse_wpa_ie(struct wpa_supplicant *wpa_s, const u8 *wpa_ie,
- size_t wpa_ie_len, struct wpa_ie_data *data)
+int wpa_parse_wpa_ie(const u8 *wpa_ie, size_t wpa_ie_len,
+ struct wpa_ie_data *data)
{
return -1;
}
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index c21c5a1..1d44d53 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -100,8 +100,8 @@ static void wpa_find_assoc_pmkid(struct wpa_supplicant *wpa_s)
struct wpa_ie_data ie;
int i, pmksa_set = -1;
- if (wpa_parse_wpa_ie(wpa_s, wpa_s->assoc_wpa_ie,
- wpa_s->assoc_wpa_ie_len, &ie) < 0 ||
+ if (wpa_parse_wpa_ie(wpa_s->assoc_wpa_ie, wpa_s->assoc_wpa_ie_len,
+ &ie) < 0 ||
ie.pmkid == NULL)
return;
@@ -254,11 +254,11 @@ wpa_supplicant_select_bss(struct wpa_supplicant *wpa_s, struct wpa_ssid *group,
continue;
}
if (!(((ssid->proto & WPA_PROTO_RSN) &&
- wpa_parse_wpa_ie(wpa_s, bss->rsn_ie,
- bss->rsn_ie_len, &ie) == 0) ||
+ wpa_parse_wpa_ie(bss->rsn_ie, bss->rsn_ie_len,
+ &ie) == 0) ||
((ssid->proto & WPA_PROTO_WPA) &&
- wpa_parse_wpa_ie(wpa_s, bss->wpa_ie,
- bss->wpa_ie_len, &ie) == 0))) {
+ wpa_parse_wpa_ie(bss->wpa_ie, bss->wpa_ie_len,
+ &ie) == 0))) {
wpa_printf(MSG_DEBUG, " skip - "
"could not parse WPA/RSN IE");
continue;
@@ -375,7 +375,7 @@ static void wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s)
wpa_printf(MSG_DEBUG, "Already associated with the "
"selected AP.");
}
- rsn_preauth_scan_results(wpa_s, results, num);
+ rsn_preauth_scan_results(wpa_s->wpa, results, num);
} else {
wpa_printf(MSG_DEBUG, "No suitable AP found.");
wpa_supplicant_req_scan(wpa_s, 5, 0);
diff --git a/wpa_supplicant/preauth.c b/wpa_supplicant/preauth.c
index 618ea03..578c9ff 100644
--- a/wpa_supplicant/preauth.c
+++ b/wpa_supplicant/preauth.c
@@ -812,17 +812,16 @@ void pmksa_candidate_add(struct wpa_sm *sm, const u8 *bssid,
/**
* rsn_preauth_scan_results - Process scan results to find PMKSA candidates
- * @wpa_s: Pointer to wpa_supplicant data
+ * @sm: Pointer to WPA state machine data from wpa_sm_init()
* @results: Scan results
* @count: Number of BSSes in scan results
*
* This functions goes through the scan results and adds all suitable APs
* (Authenticators) into PMKSA candidate list.
*/
-void rsn_preauth_scan_results(struct wpa_supplicant *wpa_s,
+void rsn_preauth_scan_results(struct wpa_sm *sm,
struct wpa_scan_result *results, int count)
{
- struct wpa_sm *sm = wpa_s->wpa;
struct wpa_scan_result *r;
struct wpa_ie_data ie;
int i;
@@ -848,7 +847,7 @@ void rsn_preauth_scan_results(struct wpa_supplicant *wpa_s,
continue;
if (r->rsn_ie_len == 0 ||
- wpa_parse_wpa_ie(wpa_s, r->rsn_ie, r->rsn_ie_len, &ie))
+ wpa_parse_wpa_ie(r->rsn_ie, r->rsn_ie_len, &ie))
continue;
pmksa = pmksa_cache_get(sm, r->bssid, NULL);
diff --git a/wpa_supplicant/preauth.h b/wpa_supplicant/preauth.h
index 0d194c4..8f16e66 100644
--- a/wpa_supplicant/preauth.h
+++ b/wpa_supplicant/preauth.h
@@ -38,7 +38,7 @@ int pmksa_cache_set_current(struct wpa_sm *sm, const u8 *pmkid,
int rsn_preauth_init(struct wpa_sm *sm, const u8 *dst,
struct wpa_ssid *config);
void rsn_preauth_deinit(struct wpa_sm *sm);
-void rsn_preauth_scan_results(struct wpa_supplicant *wpa_s,
+void rsn_preauth_scan_results(struct wpa_sm *sm,
struct wpa_scan_result *results, int count);
void pmksa_candidate_add(struct wpa_sm *sm, const u8 *bssid,
int prio, int preauth);
@@ -62,7 +62,7 @@ static inline int rsn_preauth_init(struct wpa_sm *sm, const u8 *dst,
static inline void rsn_preauth_deinit(struct wpa_sm *sm)
{
}
-static inline void rsn_preauth_scan_results(struct wpa_supplicant *wpa_s,
+static inline void rsn_preauth_scan_results(struct wpa_sm *sm,
struct wpa_scan_result *results,
int count)
{
diff --git a/wpa_supplicant/wpa.c b/wpa_supplicant/wpa.c
index d709d17..23e37e3 100644
--- a/wpa_supplicant/wpa.c
+++ b/wpa_supplicant/wpa.c
@@ -228,8 +228,8 @@ static int rsn_key_mgmt_to_bitfield(const u8 *s)
}
-static int wpa_parse_wpa_ie_wpa(struct wpa_supplicant *wpa_s, const u8 *wpa_ie,
- size_t wpa_ie_len, struct wpa_ie_data *data)
+static int wpa_parse_wpa_ie_wpa(const u8 *wpa_ie, size_t wpa_ie_len,
+ struct wpa_ie_data *data)
{
const struct wpa_ie_hdr *hdr;
const u8 *pos;
@@ -337,8 +337,8 @@ static int wpa_parse_wpa_ie_wpa(struct wpa_supplicant *wpa_s, const u8 *wpa_ie,
}
-static int wpa_parse_wpa_ie_rsn(struct wpa_supplicant *wpa_s, const u8 *rsn_ie,
- size_t rsn_ie_len, struct wpa_ie_data *data)
+static int wpa_parse_wpa_ie_rsn(const u8 *rsn_ie, size_t rsn_ie_len,
+ struct wpa_ie_data *data)
{
const struct rsn_ie_hdr *hdr;
const u8 *pos;
@@ -462,7 +462,6 @@ static int wpa_parse_wpa_ie_rsn(struct wpa_supplicant *wpa_s, const u8 *rsn_ie,
/**
* wpa_parse_wpa_ie - Parse WPA/RSN IE
- * @wpa_s: Pointer to wpa_supplicant data
* @wpa_ie: Pointer to WPA or RSN IE
* @wpa_ie_len: Length of the WPA/RSN IE
* @data: Pointer to data area for parsing results
@@ -470,13 +469,13 @@ static int wpa_parse_wpa_ie_rsn(struct wpa_supplicant *wpa_s, const u8 *rsn_ie,
*
* Parse the contents of WPA or RSN IE and write the parsed data into data.
*/
-int wpa_parse_wpa_ie(struct wpa_supplicant *wpa_s, const u8 *wpa_ie,
- size_t wpa_ie_len, struct wpa_ie_data *data)
+int wpa_parse_wpa_ie(const u8 *wpa_ie, size_t wpa_ie_len,
+ struct wpa_ie_data *data)
{
if (wpa_ie_len >= 1 && wpa_ie[0] == RSN_INFO_ELEM)
- return wpa_parse_wpa_ie_rsn(wpa_s, wpa_ie, wpa_ie_len, data);
+ return wpa_parse_wpa_ie_rsn(wpa_ie, wpa_ie_len, data);
else
- return wpa_parse_wpa_ie_wpa(wpa_s, wpa_ie, wpa_ie_len, data);
+ return wpa_parse_wpa_ie_wpa(wpa_ie, wpa_ie_len, data);
}
diff --git a/wpa_supplicant/wpa.h b/wpa_supplicant/wpa.h
index 385add2..aad972f 100644
--- a/wpa_supplicant/wpa.h
+++ b/wpa_supplicant/wpa.h
@@ -181,8 +181,8 @@ struct wpa_ie_data {
const u8 *pmkid;
};
-int wpa_parse_wpa_ie(struct wpa_supplicant *wpa_s, const u8 *wpa_ie,
- size_t wpa_ie_len, struct wpa_ie_data *data);
+int wpa_parse_wpa_ie(const u8 *wpa_ie, size_t wpa_ie_len,
+ struct wpa_ie_data *data);
int wpa_gen_wpa_ie(struct wpa_supplicant *wpa_s, u8 *wpa_ie,
size_t wpa_ie_len);
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 796181f..95151a0 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -869,8 +869,8 @@ static int wpa_supplicant_suites_from_ai(struct wpa_supplicant *wpa_s,
if (wpa_s->assoc_wpa_ie == NULL)
return -1;
- if (wpa_parse_wpa_ie(wpa_s, wpa_s->assoc_wpa_ie,
- wpa_s->assoc_wpa_ie_len, ie)) {
+ if (wpa_parse_wpa_ie(wpa_s->assoc_wpa_ie, wpa_s->assoc_wpa_ie_len,
+ ie)) {
wpa_msg(wpa_s, MSG_INFO, "WPA: Failed to parse WPA IE from "
"association info");
return -1;
@@ -938,7 +938,7 @@ int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
}
}
- if (ap_ie && wpa_parse_wpa_ie(wpa_s, ap_ie, ap_ie_len, &ie)) {
+ if (ap_ie && wpa_parse_wpa_ie(ap_ie, ap_ie_len, &ie)) {
wpa_msg(wpa_s, MSG_WARNING, "WPA: Failed to parse WPA IE for "
"the selected BSS.");
return -1;