7 struct uci_context
*uci_ctx
;
9 static void config_parse_interface(struct uci_section
*s
)
11 struct interface
*iface
;
14 DPRINTF("Create interface '%s'\n", s
->e
.name
);
16 iface
= alloc_interface(s
->e
.name
);
17 type
= uci_lookup_option_string(uci_ctx
, s
, "type");
22 if (!strcmp(type
, "bridge"))
23 interface_attach_bridge(iface
, s
);
26 void config_init_interfaces(const char *name
)
28 struct uci_context
*ctx
;
29 struct uci_package
*p
= NULL
;
30 struct uci_element
*e
;
32 ctx
= uci_alloc_context();
35 uci_set_confdir(ctx
, "./config");
37 if (uci_load(ctx
, "network", &p
)) {
38 fprintf(stderr
, "Failed to load network config\n");
42 uci_foreach_element(&p
->sections
, e
) {
43 struct uci_section
*s
= uci_to_section(e
);
45 if (name
&& strcmp(s
->e
.name
, name
) != 0)
48 if (!strcmp(s
->type
, "interface"))
49 config_parse_interface(s
);