summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2013-10-25 11:24:40 +0300
committerChengyi Zhao <chengyi1.zhao@archermind.com>2013-11-01 09:23:56 +0800
commit75db3d8015d3de4297f351fd182270daa59884f2 (patch)
tree047bc70c30698d0134d506f3534ab49505cc80cf
parent2caafa5dee4a668953f04b6b939d05b70d0b9abe (diff)
downloadconnman-75db3d8015d3de4297f351fd182270daa59884f2.tar.gz
connman-75db3d8015d3de4297f351fd182270daa59884f2.tar.bz2
connman-75db3d8015d3de4297f351fd182270daa59884f2.zip
Upstream/technology: Do not use interface name when adding interface
Use always the interface index and only when interface name is needed, then fetch the name. This minimizes races when interface name changes because of udev rules. Upstream commit Id: 8c7e5d046ff2dbc7d969b097d74b9897b725e08d Change-Id: Ie32e6e8d8896167caa7caaeb784c8f974c455a6e Signed-off-by: Chengyi Zhao <chengyi1.zhao@archermind.com>
-rw-r--r--src/connman.h2
-rw-r--r--src/rtnl.c2
-rw-r--r--src/technology.c9
3 files changed, 9 insertions, 4 deletions
diff --git a/src/connman.h b/src/connman.h
index 495eef4e..5507b153 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -471,7 +471,7 @@ int __connman_technology_remove_rfkill(unsigned int index,
void __connman_technology_scan_started(struct connman_device *device);
void __connman_technology_scan_stopped(struct connman_device *device);
void __connman_technology_add_interface(enum connman_service_type type,
- int index, const char *name, const char *ident);
+ int index, const char *ident);
void __connman_technology_remove_interface(enum connman_service_type type,
int index, const char *ident);
void __connman_technology_notify_regdom_by_device(struct connman_device *device,
diff --git a/src/rtnl.c b/src/rtnl.c
index c3d52e86..b259cd83 100644
--- a/src/rtnl.c
+++ b/src/rtnl.c
@@ -481,7 +481,7 @@ static void process_newlink(unsigned short type, int index, unsigned flags,
*/
if (interface != NULL)
__connman_technology_add_interface(interface->service_type,
- interface->index, interface->name, interface->ident);
+ interface->index, interface->ident);
for (list = watch_list; list; list = list->next) {
struct watch_data *watch = list->data;
diff --git a/src/technology.c b/src/technology.c
index 6dfdb6a5..9796646c 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -1252,11 +1252,12 @@ static void enable_tethering(struct connman_technology *technology)
}
void __connman_technology_add_interface(enum connman_service_type type,
- int index, const char *name, const char *ident)
+ int index, const char *ident)
{
struct connman_technology *technology;
GSList *tech_drivers;
struct connman_technology_driver *driver;
+ char *name;
switch (type) {
case CONNMAN_SERVICE_TYPE_UNKNOWN:
@@ -1272,13 +1273,14 @@ void __connman_technology_add_interface(enum connman_service_type type,
break;
}
+ name = connman_inet_ifname(index);
connman_info("Adding interface %s [ %s ]", name,
__connman_service_type2string(type));
technology = technology_find(type);
if (technology == NULL)
- return;
+ goto out;
for (tech_drivers = technology->driver_list; tech_drivers != NULL;
tech_drivers = g_slist_next(tech_drivers)) {
@@ -1294,6 +1296,9 @@ void __connman_technology_add_interface(enum connman_service_type type,
*/
if (technology->tethering_persistent == TRUE)
enable_tethering(technology);
+
+out:
+ g_free(name);
}
void __connman_technology_remove_interface(enum connman_service_type type,