wifi: Track interfaces
authorSamuel Ortiz <sameo@linux.intel.com>
Fri, 14 Jan 2011 17:36:35 +0000 (18:36 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Wed, 2 Feb 2011 17:45:35 +0000 (18:45 +0100)
plugins/wifi.c

index aa661b5..6e1e342 100644 (file)
@@ -70,6 +70,8 @@ struct wifi_data {
        unsigned int watch;
 };
 
+static GList *iface_list = NULL;
+
 static int get_bssid(struct connman_device *device,
                                unsigned char *bssid, unsigned int *bssid_len)
 {
@@ -159,6 +161,8 @@ static int wifi_probe(struct connman_device *device)
        wifi->watch = connman_rtnl_add_newlink_watch(wifi->index,
                                                        wifi_newlink, device);
 
+       iface_list = g_list_append(iface_list, wifi);
+
        return 0;
 }
 
@@ -168,6 +172,11 @@ static void wifi_remove(struct connman_device *device)
 
        DBG("device %p", device);
 
+       if (wifi == NULL)
+               return;
+
+       iface_list = g_list_remove(iface_list, wifi);
+
        if (wifi->pending_network != NULL) {
                connman_network_unref(wifi->pending_network);
                wifi->pending_network = NULL;