+ vlist_for_each_element(&interfaces, iface, node) {
+ if (iface->available && iface->autostart)
+ interface_set_up(iface);
+ }
+}
+
+static void
+set_config_state(struct interface *iface, enum interface_config_state s)
+{
+ iface->config_state = s;
+ if (iface->state == IFS_DOWN)
+ interface_handle_config_change(iface);
+ else
+ interface_set_down(iface);
+}
+
+static void
+interface_change_config(struct interface *if_old, struct interface *if_new)
+{
+ struct blob_attr *old_config = if_old->config;
+
+ if_old->config = if_new->config;
+ if (!if_old->config_autostart && if_new->config_autostart)
+ if_old->autostart = true;
+
+ if_old->config_autostart = if_new->config_autostart;
+ if_old->ifname = if_new->ifname;
+
+ set_config_state(if_old, IFC_RELOAD);
+ free(old_config);
+ free(if_new);
+}
+
+static void
+interface_update(struct vlist_tree *tree, struct vlist_node *node_new,
+ struct vlist_node *node_old)
+{
+ struct interface *if_old = container_of(node_old, struct interface, node);
+ struct interface *if_new = container_of(node_new, struct interface, node);
+
+ if (node_old && node_new)
+ interface_change_config(if_old, if_new);
+ else if (node_old)
+ set_config_state(if_old, IFC_REMOVE);
+ else if (node_new) {
+ proto_init_interface(if_new, if_new->config);
+ interface_ip_init(if_new);
+ netifd_ubus_add_interface(if_new);