Signed-off-by: Felix Fietkau <nbd@openwrt.org>
bool hidden;
bool current_config;
bool hidden;
bool current_config;
bool default_config;
bool wireless;
bool default_config;
bool wireless;
+interface_set_device_config(struct interface *iface, struct device *dev)
+{
+ if (!dev || !dev->default_config)
+ return;
+
+ if (!iface->device_config && !dev->iface_config)
+ return;
+
+ dev->iface_config = iface->device_config;
+ device_apply_config(dev, dev->type, iface->config);
+}
+
+static void
interface_claim_device(struct interface *iface)
{
struct interface *parent;
interface_claim_device(struct interface *iface)
{
struct interface *parent;
} else if (iface->ifname &&
!(iface->proto_handler->flags & PROTO_FLAG_NODEV)) {
dev = device_get(iface->ifname, true);
} else if (iface->ifname &&
!(iface->proto_handler->flags & PROTO_FLAG_NODEV)) {
dev = device_get(iface->ifname, true);
- if (dev && dev->default_config && iface->device_config)
- device_apply_config(dev, dev->type, iface->config);
+ interface_set_device_config(iface, dev);
} else {
dev = iface->ext_dev.dev;
}
} else {
dev = iface->ext_dev.dev;
}
- if (iface->device_config && dev->default_config)
- device_apply_config(dev, dev->type, iface->config);
-
+ interface_set_device_config(iface, dev);
device_set_present(dev, true);
ret = interface_add_link(iface, dev, link_ext);
device_set_present(dev, true);
ret = interface_add_link(iface, dev, link_ext);