From: Alok Barsode <[email protected]>
Connman should not handle technologies whose drivers are not compiled.
This patch also avoids connman controlling the rfkill switches for technologies
not complied.
Fixes BMC#24549.
---
src/technology.c | 47 +++++++++++++++++++++++++----------------------
1 files changed, 25 insertions(+), 22 deletions(-)
diff --git a/src/technology.c b/src/technology.c
index be2c212..719f5c8 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -584,20 +584,36 @@ static struct connman_technology *technology_find(enum
connman_service_type type
static struct connman_technology *technology_get(enum connman_service_type
type)
{
struct connman_technology *technology;
+ struct connman_technology_driver *driver = NULL;
const char *str;
GSList *list;
+ int err;
DBG("type %d", type);
+ str = __connman_service_type2string(type);
+ if (str == NULL)
+ return NULL;
+
technology = technology_find(type);
- if (technology != NULL) {
- __sync_fetch_and_add(&technology->refcount, 1);
- goto done;
+ if (technology != NULL)
+ return technology;
+
+ /* First check if we have a driver for this technology type */
+ for (list = driver_list; list; list = list->next) {
+ driver = list->data;
+
+ if (driver->type == type)
+ break;
+ else
+ driver = NULL;
}
- str = __connman_service_type2string(type);
- if (str == NULL)
+ if (driver == NULL) {
+ DBG("No matching driver found for %s.",
+ __connman_service_type2string(type));
return NULL;
+ }
technology = g_try_new0(struct connman_technology, 1);
if (technology == NULL)
@@ -631,24 +647,11 @@ static struct connman_technology *technology_get(enum
connman_service_type type)
technology_added_signal(technology);
- if (technology->driver != NULL)
- goto done;
-
- for (list = driver_list; list; list = list->next) {
- struct connman_technology_driver *driver = list->data;
-
- DBG("driver %p name %s", driver, driver->name);
-
- if (driver->type != technology->type)
- continue;
-
- if (driver->probe(technology) == 0) {
- technology->driver = driver;
- break;
- }
- }
+ technology->driver = driver;
+ err = driver->probe(technology);
+ if (err != 0)
+ DBG("Driver probe failed for technology %p", technology);
-done:
DBG("technology %p", technology);
return technology;
--
1.7.5.4
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman