Fix init2() driver_ops to get the correct global driver context
authorJouni Malinen <jouni.malinen@atheros.com>
Sat, 28 Nov 2009 16:11:16 +0000 (18:11 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 28 Nov 2009 16:11:16 +0000 (18:11 +0200)
Need to provide the private driver context, not the wpa_supplicant
global context, in init2() call.

wpa_supplicant/driver_i.h
wpa_supplicant/wpa_supplicant.c
wpa_supplicant/wpa_supplicant_i.h

index 12161b2..7f20fe0 100644 (file)
@@ -22,7 +22,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);
        }
index 4811f4f..5ea06f4 100644 (file)
@@ -1704,6 +1704,7 @@ 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_drivers[0];
+               wpa_s->global_drv_priv = wpa_s->global->drv_priv[0];
                return 0;
        }
 
@@ -1717,6 +1718,7 @@ static int wpa_supplicant_set_driver(struct wpa_supplicant *wpa_s,
                    os_strncmp(name, wpa_drivers[i]->name, len) ==
                    0) {
                        wpa_s->driver = wpa_drivers[i];
+                       wpa_s->global_drv_priv = wpa_s->global->drv_priv[i];
                        return 0;
                }
        }
index 7cd2426..5578802 100644 (file)
@@ -333,6 +333,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