From 5c455337d8432d97f0904481e2258ed3df837c58 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 15 Jul 2010 12:03:37 -0700 Subject: Fix Ethernet service type detection --- src/rtnl.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/rtnl.c b/src/rtnl.c index 0f3ba0fe..1f5c6c30 100644 --- a/src/rtnl.c +++ b/src/rtnl.c @@ -96,10 +96,18 @@ static void read_uevent(struct interface_data *interface) char *filename, line[128]; FILE *f; + if (ether_blacklisted(interface->name) == TRUE) + interface->type = CONNMAN_SERVICE_TYPE_UNKNOWN; + else + interface->type = CONNMAN_SERVICE_TYPE_ETHERNET; + filename = g_strdup_printf("/sys/class/net/%s/uevent", interface->name); f = fopen(filename, "re"); + + g_free(filename); + if (f == NULL) return; @@ -122,6 +130,8 @@ static void read_uevent(struct interface_data *interface) interface->type = CONNMAN_SERVICE_TYPE_BLUETOOTH; else if (strcmp(line + 8, "wimax") == 0) interface->type = CONNMAN_SERVICE_TYPE_WIMAX; + else + interface->type = CONNMAN_SERVICE_TYPE_UNKNOWN; } fclose(f); @@ -404,12 +414,8 @@ static void process_newlink(unsigned short type, int index, unsigned flags, g_hash_table_insert(interface_list, GINT_TO_POINTER(index), interface); - read_uevent(interface); - - if (interface->type == CONNMAN_SERVICE_TYPE_UNKNOWN && - type == ARPHRD_ETHER && - ether_blacklisted(ifname) == FALSE) - interface->type = CONNMAN_SERVICE_TYPE_ETHERNET; + if (type == ARPHRD_ETHER) + read_uevent(interface); __connman_technology_add_interface(interface->type, interface->index, interface->name); -- cgit v1.2.3