+ 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) {
+ struct uci_section *s = uci_to_section(e);
+ const struct device_type *devtype = NULL;
+ 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) {
+ if (!strcmp(type, "bridge"))
+ devtype = &bridge_device_type;
+ else if (!strcmp(type, "tunnel"))
+ devtype = &tunnel_device_type;
+ else if (!strcmp(type, "macvlan"))
+ devtype = &macvlan_device_type;
+ }
+
+ if (!devtype)
+ devtype = &simple_device_type;
+
+ blob_buf_init(&b, 0);
+ uci_to_blob(&b, s, devtype->config_params);
+ device_create(name, devtype, b.head);
+ }
+}
+
+static struct uci_package *
+config_init_package(const char *config)
+{
+ struct uci_context *ctx = uci_ctx;