X-Git-Url: http://git.archive.openwrt.org/?p=project%2Ffirewall3.git;a=blobdiff_plain;f=options.c;h=c212218f671be51c74929185f4fec9cd5c711a4c;hp=6f96681561cbeec9b782da075dab1880a8568400;hb=3b4303ddcf81b281321a2ee486bbcdd2f2671fef;hpb=d54cb962ebafdf2fde7256e234a2f3cfe8223c71 diff --git a/options.c b/options.c index 6f96681..c212218 100644 --- a/options.c +++ b/options.c @@ -853,7 +853,7 @@ fw3_parse_setmatch(void *ptr, const char *val, bool is_list) } -void +bool fw3_parse_options(void *s, const struct fw3_option *opts, struct uci_section *section) { @@ -863,6 +863,7 @@ fw3_parse_options(void *s, const struct fw3_option *opts, struct uci_option *o; const struct fw3_option *opt; struct list_head *dest; + bool valid = true; uci_foreach_element(§ion->options, e) { @@ -882,6 +883,7 @@ fw3_parse_options(void *s, const struct fw3_option *opts, if (!opt->elem_size) { warn_elem(e, "must not be a list"); + valid = false; } else { @@ -895,6 +897,7 @@ fw3_parse_options(void *s, const struct fw3_option *opts, if (!opt->parse(dest, l->name, true)) { warn_elem(e, "has invalid value '%s'", l->name); + valid = false; continue; } } @@ -910,7 +913,10 @@ fw3_parse_options(void *s, const struct fw3_option *opts, if (!opt->elem_size) { if (!opt->parse((char *)s + opt->offset, o->v.string, false)) + { warn_elem(e, "has invalid value '%s'", o->v.string); + valid = false; + } } else { @@ -921,6 +927,7 @@ fw3_parse_options(void *s, const struct fw3_option *opts, if (!opt->parse(dest, p, true)) { warn_elem(e, "has invalid value '%s'", p); + valid = false; continue; } } @@ -934,6 +941,8 @@ fw3_parse_options(void *s, const struct fw3_option *opts, if (!known) warn_elem(e, "is unknown"); } + + return valid; }