8 struct uci_context
*uci_ctx
;
10 static void config_parse_interface(struct uci_section
*s
)
12 struct interface
*iface
;
15 DPRINTF("Create interface '%s'\n", s
->e
.name
);
17 iface
= alloc_interface(s
->e
.name
);
18 type
= uci_lookup_option_string(uci_ctx
, s
, "type");
23 if (!strcmp(type
, "bridge"))
24 interface_attach_bridge(iface
, s
);
27 void config_init_interfaces(const char *name
)
29 struct uci_context
*ctx
;
30 struct uci_package
*p
= NULL
;
31 struct uci_element
*e
;
33 ctx
= uci_alloc_context();
36 uci_set_confdir(ctx
, "./config");
38 if (uci_load(ctx
, "network", &p
)) {
39 fprintf(stderr
, "Failed to load network config\n");
43 uci_foreach_element(&p
->sections
, e
) {
44 struct uci_section
*s
= uci_to_section(e
);
46 if (name
&& strcmp(s
->e
.name
, name
) != 0)
49 if (!strcmp(s
->type
, "interface"))
50 config_parse_interface(s
);