Do not register 2 network drivers for the same network type
authorSamuel Ortiz <sameo@linux.intel.com>
Mon, 20 Sep 2010 16:21:51 +0000 (18:21 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Mon, 20 Sep 2010 16:21:51 +0000 (18:21 +0200)
src/network.c

index 820ce99..aebf7cf 100644 (file)
@@ -266,8 +266,18 @@ static gint compare_priority(gconstpointer a, gconstpointer b)
  */
 int connman_network_driver_register(struct connman_network_driver *driver)
 {
+       GSList *list;
+
        DBG("driver %p name %s", driver, driver->name);
 
+       for (list = driver_list; list; list = list->next) {
+               struct connman_network_driver *tmp = list->data;
+
+               if (tmp->type == driver->type)
+                       return -EALREADY;
+
+       }
+
        driver_list = g_slist_insert_sorted(driver_list, driver,
                                                        compare_priority);