disable some fake interface
author"Luc Saillard <luc@saillard.org>"
Mon Jun 16 13:01:16 2008 +0200 (2 months ago)
changeset 86448baefd3f8d
parent 858d907c558b93
child 8788a11d40d460
disable some fake interface
src/sysfs.c
src/sysfs.h
src/udev.c
--- a/src/sysfs.c Sun Jun 15 10:54:18 2008 +0200
+++ b/src/sysfs.c Mon Jun 16 13:01:16 2008 +0200
@@ -82,7 +82,7 @@ string_match_regexp(const char *string,
/*
* Return the content of a file in the sysfs device path
*/
-static char *
+char *
sysfs_get_file_content(const char *sysfs_path, const char *file)
{
char *path, *content;
--- a/src/sysfs.h Sun Jun 15 10:54:18 2008 +0200
+++ b/src/sysfs.h Mon Jun 16 13:01:16 2008 +0200
@@ -33,6 +33,7 @@ char *sysfs_get_device_model(const char
char *sysfs_get_device_model(const char *sysfs_path);
char *sysfs_get_block_size(const char *sysfs_path);
char *sysfs_guess_device_node(const char *sysfs_device);
+char *sysfs_get_file_content(const char *sysfs_path, const char *file);
#endif
--- a/src/udev.c Sun Jun 15 10:54:18 2008 +0200
+++ b/src/udev.c Mon Jun 16 13:01:16 2008 +0200
@@ -384,8 +384,21 @@ hotplug_add_sysfs_net(HotplugEvent *even
hotplug_add_sysfs_net(HotplugEvent *event)
{
struct device_t *device;
+ char *type_string;
trace("[%s] sysfs_path=%s\n", event->ifname, event->sysfs_path);
+
+ type_string = sysfs_get_file_content(event->sysfs_path, "type");
+ if (type_string == NULL)
+ return;
+
+ /* Only keep ethernet device (not lo 722, or wlan master device 801 ...) */
+ if (strcmp(type_string, "1"))
+ {
+ g_free(type_string);
+ return;
+ }
+ g_free(type_string);
device = device_new(DEVICE_NET_ETHERNET, event->sysfs_path, event->ifname);
device_watch(device);