+ 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);
+}
+
+static void
+config_parse_rule(struct uci_section *s, bool v6)
+{
+ void *rule;
+
+ blob_buf_init(&b, 0);
+ rule = blobmsg_open_array(&b, "rule");
+ uci_to_blob(&b, s, &rule_attr_list);
+ blobmsg_close_array(&b, rule);
+ iprule_add(blob_data(b.head), v6);
+}
+
+static void
+config_init_devices(void)
+{
+ struct uci_element *e;
+
+ uci_foreach_element(&uci_network->sections, e) {
+ const struct uci_blob_param_list *params = NULL;
+ struct uci_section *s = uci_to_section(e);
+ struct device_type *devtype = NULL;
+ struct device *dev;
+ const char *type, *name;
+
+ if (strcmp(s->type, "device") != 0)
+ continue;
+
+ name = uci_lookup_option_string(uci_ctx, s, "name");
+ if (!name)
+ continue;
+
+ type = uci_lookup_option_string(uci_ctx, s, "type");
+ if (type)
+ devtype = device_type_get(type);
+
+ if (devtype)
+ params = devtype->config_params;
+ if (!params)
+ params = simple_device_type.config_params;
+
+ blob_buf_init(&b, 0);
+ uci_to_blob(&b, s, params);
+ if (devtype) {
+ dev = device_create(name, devtype, b.head);
+ if (!dev)
+ continue;
+ } else {
+ dev = device_get(name, 1);
+ if (!dev)
+ continue;
+
+ dev->current_config = true;
+ device_apply_config(dev, dev->type, b.head);
+ }
+ dev->default_config = false;
+ }
+}
+
+static struct uci_package *
+config_init_package(const char *config)
+{
+ struct uci_context *ctx = uci_ctx;