remove the uci dependency from protocol handlers
[project/netifd.git] / config.c
index 2e00364..1649cee 100644 (file)
--- a/config.c
+++ b/config.c
@@ -73,7 +73,7 @@ static void uci_array_to_blob(struct blob_buf *b, struct uci_option *o,
 static void __uci_to_blob(struct blob_buf *b, struct uci_section *s,
                          const struct config_param_list *p)
 {
-       const struct blobmsg_policy *attr;
+       const struct blobmsg_policy *attr = NULL;
        struct uci_element *e;
        struct uci_option *o;
        void *array;
@@ -158,7 +158,11 @@ config_parse_interface(struct uci_section *s)
        if (!iface)
                return;
 
-       proto_init_interface(iface, s);
+       blob_buf_init(&b, 0);
+       if (iface->proto_handler && iface->proto_handler->config_params)
+               uci_to_blob(&b, s, iface->proto_handler->config_params);
+
+       proto_init_interface(iface, b.head);
 }
 
 void