diff options
author | Felix Fietkau <nbd@openwrt.org> | 2011-10-06 02:05:50 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2011-10-06 02:05:50 +0200 |
commit | beaf1b3d4ad313522bdd02f4c561dca94360bd46 (patch) | |
tree | a099436d27baca513f26dae5269bf834624db3bf | |
parent | f1b77140237f2f6e7f6b755b5a60ab212782456e (diff) |
always recreate devices by default if the config attribute list is not the default one
-rw-r--r-- | device.c | 8 | ||||
-rw-r--r-- | vlan.c | 1 |
2 files changed, 7 insertions, 2 deletions
@@ -336,6 +336,7 @@ enum dev_change_type device_reload_config(struct device *dev, struct blob_attr *attr) { struct blob_attr *tb[__DEV_ATTR_MAX], *tb1[__DEV_ATTR_MAX]; + const struct config_param_list *params = dev->type->config_params; blobmsg_parse(dev_attrs, __DEV_ATTR_MAX, tb, blob_data(attr), blob_len(attr)); @@ -345,11 +346,14 @@ device_reload_config(struct device *dev, struct blob_attr *attr) else memset(tb1, 0, sizeof(tb1)); - if (!config_diff(tb, tb1, &device_attr_list, NULL)) + if (!config_diff(tb, tb1, dev->type->config_params, NULL)) return DEV_CONFIG_NO_CHANGE; device_init_settings(dev, tb); - return DEV_CONFIG_APPLIED; + if (params == &device_attr_list) + return DEV_CONFIG_APPLIED; + else + return DEV_CONFIG_RECREATE; } static enum dev_change_type @@ -69,6 +69,7 @@ static struct device *get_vlan_device(struct device *dev, int id, bool create) { static const struct device_type vlan_type = { .name = "VLAN", + .config_params = &device_attr_list, .free = free_vlan_if, }; struct vlan_device *vldev; |