aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2009-11-28 16:11:16 (GMT)
committerJouni Malinen <j@w1.fi>2010-01-09 19:14:46 (GMT)
commita81ca7ee2a0a53d5bc9c19fa7e8e910e95a89964 (patch)
tree7a0900af3e6fa996d95f6cfc7c0f203c81774aa3
parent49198bb3eb202a8488169354f25f699aac36aa46 (diff)
downloadhostap-06-a81ca7ee2a0a53d5bc9c19fa7e8e910e95a89964.zip
hostap-06-a81ca7ee2a0a53d5bc9c19fa7e8e910e95a89964.tar.gz
hostap-06-a81ca7ee2a0a53d5bc9c19fa7e8e910e95a89964.tar.bz2
Fix init2() driver_ops to get the correct global driver context
Need to provide the private driver context, not the wpa_supplicant global context, in init2() call. (this is a backported version of 8a5ab9f5e56cd2f5781c2d92f41495e60d544780 and d8222ae38c3be3fba794462d11fed8b57590c7f5)
-rw-r--r--wpa_supplicant/wpa_supplicant.c6
-rw-r--r--wpa_supplicant/wpa_supplicant_i.h4
2 files changed, 7 insertions, 3 deletions
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 26fd9c3..3a5c7cb 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1479,12 +1479,14 @@ static int wpa_supplicant_set_driver(struct wpa_supplicant *wpa_s,
if (name == NULL) {
/* default to first driver in the list */
wpa_s->driver = wpa_supplicant_drivers[0];
+ wpa_s->global_drv_priv = wpa_s->global->drv_priv[0];
return 0;
}
for (i = 0; wpa_supplicant_drivers[i]; i++) {
if (os_strcmp(name, wpa_supplicant_drivers[i]->name) == 0) {
wpa_s->driver = wpa_supplicant_drivers[i];
+ wpa_s->global_drv_priv = wpa_s->global->drv_priv[i];
return 0;
}
}
@@ -1944,6 +1946,8 @@ struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
if (wpa_s == NULL)
return NULL;
+ wpa_s->global = global;
+
if (wpa_supplicant_init_iface(wpa_s, iface) ||
wpa_supplicant_init_iface2(wpa_s)) {
wpa_printf(MSG_DEBUG, "Failed to add interface %s",
@@ -1953,8 +1957,6 @@ struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
return NULL;
}
- wpa_s->global = global;
-
/* Register the interface with the dbus control interface */
if (wpas_dbus_register_iface(wpa_s)) {
wpa_supplicant_deinit_iface(wpa_s);
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index 3aefcd9..b441cbb 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -305,6 +305,7 @@ struct wpa_supplicant {
int mgmt_group_cipher;
void *drv_priv; /* private data used by driver_ops */
+ void *global_drv_priv;
struct wpa_ssid *prev_scan_ssid; /* previously scanned SSID;
* NULL = not yet initialized (start
@@ -423,7 +424,8 @@ static inline void * wpa_drv_init(struct wpa_supplicant *wpa_s,
const char *ifname)
{
if (wpa_s->driver->init2)
- return wpa_s->driver->init2(wpa_s, ifname, wpa_s->global);
+ return wpa_s->driver->init2(wpa_s, ifname,
+ wpa_s->global_drv_priv);
if (wpa_s->driver->init) {
return wpa_s->driver->init(wpa_s, ifname);
}