From: Felix Fietkau Date: Sun, 19 Apr 2015 09:49:51 +0000 (+0200) Subject: interface: allow an interface to specify device configs even when there are other... X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=b0720e584f750073a4bc81c889abdaf08983e0ce;p=project%2Fnetifd.git interface: allow an interface to specify device configs even when there are other interfaces attached to the same device Signed-off-by: Felix Fietkau --- diff --git a/device.h b/device.h index 4b36641..753e1fa 100644 --- a/device.h +++ b/device.h @@ -21,6 +21,7 @@ struct device; struct device_user; struct device_hotplug_ops; +struct interface; typedef int (*device_state_cb)(struct device *, bool up); @@ -165,6 +166,8 @@ struct device { bool default_config; bool wireless; + struct interface *config_iface; + /* set interface up or down */ device_state_cb set_state; diff --git a/interface.c b/interface.c index 3281b70..ea018ad 100644 --- a/interface.c +++ b/interface.c @@ -525,9 +525,11 @@ interface_set_device_config(struct interface *iface, struct device *dev) if (!dev || !dev->default_config) return; - if (!iface->device_config && !dev->iface_config) + if (!iface->device_config && + (!dev->iface_config || dev->config_iface != iface)) return; + dev->config_iface = iface; dev->iface_config = iface->device_config; device_apply_config(dev, dev->type, iface->config); }