+
+ if (alias) {
+ if (!interface_add_alias(iface, config))
+ goto error_free_config;
+ } else {
+ interface_add(iface, config);
+ }
+
+ /*
+ * need to look up the interface name again, in case of config update,
+ * the pointer will have changed
+ */
+ iface = vlist_find(&interfaces, s->e.name, iface, node);
+ if (!iface)
+ return;
+
+ dev = iface->main_dev.dev;
+ if (!dev || !dev->default_config)
+ return;
+
+ blob_buf_init(&b, 0);
+ uci_to_blob(&b, s, dev->type->config_params);
+ if (blob_len(b.head) == 0)
+ return;
+
+ device_set_config(dev, dev->type, b.head);
+ return;
+error_free_config:
+ free(config);
+error:
+ free(iface);
+}
+
+static void
+config_parse_route(struct uci_section *s, bool v6)
+{
+ void *route;
+
+ blob_buf_init(&b, 0);
+ route = blobmsg_open_array(&b, "route");
+ uci_to_blob(&b, s, &route_attr_list);
+ blobmsg_close_array(&b, route);
+ interface_ip_add_route(NULL, blob_data(b.head), v6);