From fe8a6dd2991d54c3eb84cb12764c1316d19bac4e Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 14 Jun 2012 18:48:33 +0200 Subject: [PATCH] ignore mac80211 devices specified in /etc/config/network --- device.c | 3 +++ system-dummy.c | 5 +++++ system-linux.c | 10 ++++++++++ system.h | 1 + 4 files changed, 19 insertions(+) diff --git a/device.c b/device.c index 7958fed..a2d5637 100644 --- a/device.c +++ b/device.c @@ -374,6 +374,9 @@ device_create_default(const char *name, bool external) { struct device *dev; + if (!external && system_if_force_external(name)) + return NULL; + D(DEVICE, "Create simple device '%s'\n", name); dev = calloc(1, sizeof(*dev)); dev->external = external; diff --git a/system-dummy.c b/system-dummy.c index cae421d..a2411f3 100644 --- a/system-dummy.c +++ b/system-dummy.c @@ -66,6 +66,11 @@ int system_vlan_del(struct device *dev) return 0; } +bool system_if_force_external(const char *ifname) +{ + return false; +} + int system_if_up(struct device *dev) { D(SYSTEM, "ifconfig %s up\n", dev->ifname); diff --git a/system-linux.c b/system-linux.c index c7b8b8f..ceb5ac5 100644 --- a/system-linux.c +++ b/system-linux.c @@ -769,6 +769,16 @@ static void system_add_link_modes(struct blob_buf *b, __u32 mask) } } +bool +system_if_force_external(const char *ifname) +{ + char buf[64]; + struct stat s; + + snprintf(buf, sizeof(buf), "/sys/class/net/%s/phy80211", ifname); + return stat(buf, &s) == 0; +} + int system_if_dump_info(struct device *dev, struct blob_buf *b) { diff --git a/system.h b/system.h index a197590..73ceb41 100644 --- a/system.h +++ b/system.h @@ -64,6 +64,7 @@ int system_if_check(struct device *dev); int system_if_dump_info(struct device *dev, struct blob_buf *b); int system_if_dump_stats(struct device *dev, struct blob_buf *b); struct device *system_if_get_parent(struct device *dev); +bool system_if_force_external(const char *ifname); int system_add_address(struct device *dev, struct device_addr *addr); int system_del_address(struct device *dev, struct device_addr *addr); -- 2.25.1