netifd:Make sure interface device config is also cached
authorHans Dedecker <dedeckeh@gmail.com>
Wed, 18 Mar 2015 15:54:48 +0000 (16:54 +0100)
committerSteven Barth <steven@midlink.org>
Thu, 19 Mar 2015 15:27:11 +0000 (16:27 +0100)
Fixes issue interface device config is not applied in some cases.
As the interface device config was applied but not always cached;
an interface device config diff was not always detected.

Simplify device config setting by exposing as api only device_apply_config

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
config.c
device.c
device.h
interface.c
tunnel.c

index b0607ddda6d769a59db90d9d6f6844e6e30df398..132ec430a57066957f70dbe8b412f3eafaf3d615 100644 (file)
--- a/config.c
+++ b/config.c
@@ -137,7 +137,7 @@ config_parse_interface(struct uci_section *s, bool alias)
                return;
 
        if (iface->device_config || dev->settings.flags)
-               device_set_config(dev, dev->type, b.head);
+               device_apply_config(dev, dev->type, b.head);
        return;
 error_free_config:
        free(config);
index 556d9fc89d695ffc6c340a6ea88249e4a7577c67..27064739360c1163a78d49a9fddb52dd7ff3227e 100644 (file)
--- a/device.c
+++ b/device.c
@@ -596,7 +596,7 @@ device_init_pending(void)
        }
 }
 
-enum dev_change_type
+static enum dev_change_type
 device_set_config(struct device *dev, const struct device_type *type,
                  struct blob_attr *attr)
 {
index 6418f169a9baf57dbc2c3aaf872e1013d541b508..cddb340cf36851e015ff1c6988fda7af0cc27f5e 100644 (file)
--- a/device.h
+++ b/device.h
@@ -193,9 +193,6 @@ struct device *device_create(const char *name, const struct device_type *type,
 void device_init_settings(struct device *dev, struct blob_attr **tb);
 void device_init_pending(void);
 
-enum dev_change_type
-device_set_config(struct device *dev, const struct device_type *type,
-                 struct blob_attr *attr);
 enum dev_change_type
 device_apply_config(struct device *dev, const struct device_type *type,
                    struct blob_attr *config);
index 72599e63fd95c344e340f437ee3c0d51212eabd8..444f3ac0f280846c33c1d75d767ee6f85ba9e7f2 100644 (file)
@@ -918,11 +918,11 @@ interface_handle_link(struct interface *iface, const char *name, bool add, bool
        }
 
        if (add) {
-               device_set_present(dev, true);
                if (iface->device_config && dev->default_config)
-                       device_set_config(dev, dev->type, iface->config);
+                       device_apply_config(dev, dev->type, iface->config);
+
+               device_set_present(dev, true);
 
-               system_if_apply_settings(dev, &dev->settings, dev->settings.flags);
                ret = interface_add_link(iface, dev, link_ext);
        } else {
                ret = interface_remove_link(iface, dev);
index cdb83f054b68219e8a6a0132cfca20b04abaf0f5..aa670a3974def3f179c20df0d3bbb8355e21daac 100644 (file)
--- a/tunnel.c
+++ b/tunnel.c
@@ -72,7 +72,7 @@ tunnel_create(const char *name, struct blob_attr *attr)
        device_init(dev, &tunnel_device_type, name);
        tun->set_state = dev->set_state;
        dev->set_state = tunnel_set_state;
-       device_set_config(dev, &tunnel_device_type, attr);
+       device_apply_config(dev, &tunnel_device_type, attr);
        device_set_present(dev, true);
 
        return dev;