get_proto_handlers now also dumps the validation info
authorJohn Crispin <blogic@openwrt.org>
Mon, 17 Feb 2014 12:12:23 +0000 (12:12 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 17 Feb 2014 14:10:11 +0000 (15:10 +0100)
Signed-off-by: John Crispin <blogic@openwrt.org>
proto.c

diff --git a/proto.c b/proto.c
index 91219189437dd4b9feb0671e23085bdf964f58cf..e4465eb14e2a1900d3b38a3296dfc4c75f6ea47e 100644 (file)
--- a/proto.c
+++ b/proto.c
@@ -535,7 +535,17 @@ proto_dump_handlers(struct blob_buf *b)
        void *c;
 
        avl_for_each_element(&handlers, p, avl) {
+               void *v;
+
                c = blobmsg_open_table(b, p->name);
+               if (p->config_params->validate) {
+                       int i;
+
+                       v = blobmsg_open_table(b, "validate");
+                       for (i = 0; i < p->config_params->n_params; i++)
+                               blobmsg_add_string(b, p->config_params->params[i].name, uci_get_validate_string(p->config_params, i));
+                       blobmsg_close_table(b, v);
+               }
                blobmsg_add_u8(b, "no_device", !!(p->flags & PROTO_FLAG_NODEV));
                blobmsg_close_table(b, c);
        }