Update the code to use connman_inet_ifname() when fetching the
interface name. This allows the interface name to be removed from
the device structure, as the interface name is not requested
from the device structure elsewhere.
---
 plugins/wifi.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/plugins/wifi.c b/plugins/wifi.c
index 7c412ef..ea1c4ae 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -902,18 +902,23 @@ static void interface_create_callback(int result,
 static int wifi_enable(struct connman_device *device)
 {
        struct wifi_data *wifi = connman_device_get_data(device);
-       const char *interface = connman_device_get_string(device, "Interface");
+       int index;
+       char *interface;
        const char *driver = connman_option_get_string("wifi");
        int ret;
 
        DBG("device %p %p", device, wifi);
 
-       if (!wifi)
+       index = connman_device_get_index(device);
+       if (!wifi || index < 0)
                return -ENODEV;
 
+       interface = connman_inet_ifname(index);
        ret = g_supplicant_interface_create(interface, driver, NULL,
                                                interface_create_callback,
                                                        wifi);
+       g_free(interface);
+
        if (ret < 0)
                return ret;
 
-- 
1.9.1

_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman

Reply via email to