aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/wpa_priv.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2015-09-05 09:03:18 (GMT)
committerJouni Malinen <j@w1.fi>2015-09-05 09:03:18 (GMT)
commit20396ab8e4cf69c96bcd432d0dfe49d00ae0edab (patch)
tree05a288a2df9ea6d3d911adba91251308a7808817 /wpa_supplicant/wpa_priv.c
parent85f4381e145c974e752781a01f54a845687982fe (diff)
downloadhostap-20396ab8e4cf69c96bcd432d0dfe49d00ae0edab.zip
hostap-20396ab8e4cf69c96bcd432d0dfe49d00ae0edab.tar.gz
hostap-20396ab8e4cf69c96bcd432d0dfe49d00ae0edab.tar.bz2
wpa_priv: Add support for global driver interface context
This is needed with driver_nl80211.c to be able to use the newer wpa_driver_ops::init2() alternative. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wpa_supplicant/wpa_priv.c')
-rw-r--r--wpa_supplicant/wpa_priv.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/wpa_supplicant/wpa_priv.c b/wpa_supplicant/wpa_priv.c
index 152e955..a7aa430 100644
--- a/wpa_supplicant/wpa_priv.c
+++ b/wpa_supplicant/wpa_priv.c
@@ -31,6 +31,7 @@ struct wpa_priv_interface {
const struct wpa_driver_ops *driver;
void *drv_priv;
+ void *drv_global_priv;
struct sockaddr_un drv_addr;
int wpas_registered;
@@ -48,6 +49,10 @@ static void wpa_priv_cmd_register(struct wpa_priv_interface *iface,
if (iface->driver->deinit)
iface->driver->deinit(iface->drv_priv);
iface->drv_priv = NULL;
+ if (iface->drv_global_priv) {
+ iface->driver->global_deinit(iface->drv_global_priv);
+ iface->drv_global_priv = NULL;
+ }
iface->wpas_registered = 0;
}
@@ -58,10 +63,24 @@ static void wpa_priv_cmd_register(struct wpa_priv_interface *iface,
iface->l2 = NULL;
}
- if (iface->driver->init == NULL)
+ if (iface->driver->init2) {
+ if (iface->driver->global_init) {
+ iface->drv_global_priv = iface->driver->global_init();
+ if (!iface->drv_global_priv) {
+ wpa_printf(MSG_INFO,
+ "Failed to initialize driver global context");
+ return;
+ }
+ } else {
+ iface->drv_global_priv = NULL;
+ }
+ iface->drv_priv = iface->driver->init2(iface, iface->ifname,
+ iface->drv_global_priv);
+ } else if (iface->driver->init) {
+ iface->drv_priv = iface->driver->init(iface, iface->ifname);
+ } else {
return;
-
- iface->drv_priv = iface->driver->init(iface, iface->ifname);
+ }
if (iface->drv_priv == NULL) {
wpa_printf(MSG_DEBUG, "Failed to initialize driver wrapper");
return;
@@ -87,6 +106,10 @@ static void wpa_priv_cmd_unregister(struct wpa_priv_interface *iface,
if (iface->driver->deinit)
iface->driver->deinit(iface->drv_priv);
iface->drv_priv = NULL;
+ if (iface->drv_global_priv) {
+ iface->driver->global_deinit(iface->drv_global_priv);
+ iface->drv_global_priv = NULL;
+ }
iface->wpas_registered = 0;
}
}