+static void uci_to_blob(struct blob_buf *b, struct uci_section *s,
+ const struct config_param_list *p)
+{
+ int i;
+
+ __uci_to_blob(b, s, p);
+ for (i = 0; i < p->n_next; i++)
+ uci_to_blob(b, s, p->next[i]);
+}
+
+static int
+config_parse_bridge_interface(struct uci_section *s)
+{
+ char *name;
+
+ name = alloca(strlen(s->e.name) + 4);
+ sprintf(name, "br-%s", s->e.name);
+ blobmsg_add_string(&b, "name", name);
+
+ uci_to_blob(&b, s, bridge_device_type.config_params);
+ if (!bridge_device_type.create(b.head)) {
+ DPRINTF("Failed to create bridge for interface '%s'\n", s->e.name);
+ return -EINVAL;
+ }
+
+ blob_buf_init(&b, 0);
+ blobmsg_add_string(&b, "ifname", name);
+ return 0;
+}
+