summaryrefslogtreecommitdiff
path: root/src/rtnl.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-07-15 12:03:37 -0700
committerMarcel Holtmann <marcel@holtmann.org>2010-07-15 12:03:37 -0700
commit5c455337d8432d97f0904481e2258ed3df837c58 (patch)
tree09f8ae3e01ea7a7ffdf49525797e3cb2cc60c540 /src/rtnl.c
parentd6aab12f5335c45a008e84d600f77839b13d0565 (diff)
downloadconnman-5c455337d8432d97f0904481e2258ed3df837c58.tar.gz
connman-5c455337d8432d97f0904481e2258ed3df837c58.tar.bz2
connman-5c455337d8432d97f0904481e2258ed3df837c58.zip
Fix Ethernet service type detection
Diffstat (limited to 'src/rtnl.c')
-rw-r--r--src/rtnl.c18
1 files changed, 12 insertions, 6 deletions
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);