- blob_buf_init(&b, 0);
- uci_to_blob(&b, s, &interface_attr_list);
- alloc_interface(s->e.name, s, b.head);
+ 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;
+ }
+
+ 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);
+ }