ignore mac80211 devices specified in /etc/config/network
[project/netifd.git] / device.c
index 9dcd29a..a2d5637 100644 (file)
--- 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;
@@ -452,26 +455,25 @@ static void __device_set_present(struct device *dev, bool state)
        device_broadcast_event(dev, state ? DEV_EVENT_ADD : DEV_EVENT_REMOVE);
 }
 
-void device_set_present(struct device *dev, bool state)
+void
+device_refresh_present(struct device *dev)
 {
-       if (dev->sys_present == state)
-               return;
+       bool state = dev->sys_present;
 
-       dev->sys_present = state;
-       D(DEVICE, "%s '%s' %s present\n", dev->type->name, dev->ifname, state ? "is now" : "is no longer" );
-
-       if (state && dev->disabled)
-               return;
+       if (dev->disabled || dev->deferred)
+               state = false;
 
        __device_set_present(dev, state);
 }
 
-void
-device_set_disabled(struct device *dev, bool value)
+void device_set_present(struct device *dev, bool state)
 {
-       dev->disabled = value;
-       if (dev->sys_present)
-               __device_set_present(dev, !value);
+       if (dev->sys_present == state)
+               return;
+
+       D(DEVICE, "%s '%s' %s present\n", dev->type->name, dev->ifname, state ? "is now" : "is no longer" );
+       dev->sys_present = state;
+       device_refresh_present(dev);
 }
 
 void device_add_user(struct device_user *dep, struct device *dev)