diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2015-04-17 16:12:14 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2015-04-18 14:08:41 +0200 |
commit | 1d0bd45db042c9dd916f15a5f4e3e5a2f63d0616 (patch) | |
tree | 0a02f33f3104a287f54d16d7ee8ecdffd4d9f490 /snats.c | |
parent | dba19a8f14cefdede3cc7d0f8322fdb9a2c44d50 (diff) | |
download | firewall3-1d0bd45db042c9dd916f15a5f4e3e5a2f63d0616.tar.gz |
ubus: print rule name when reporting errors
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'snats.c')
-rw-r--r-- | snats.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -133,9 +133,12 @@ fw3_load_snats(struct fw3_state *state, struct uci_package *p, struct blob_attr blob_for_each_attr(rule, a, rem) { const char *type = NULL; + const char *name = "ubus rule"; blobmsg_for_each_attr(opt, rule, orem) if (!strcmp(blobmsg_name(opt), "type")) type = blobmsg_get_string(opt); + else if (!strcmp(blobmsg_name(opt), "name")) + name = blobmsg_get_string(opt); if (!type || strcmp(type, "nat")) continue; @@ -143,9 +146,9 @@ fw3_load_snats(struct fw3_state *state, struct uci_package *p, struct blob_attr if (!(snat = alloc_snat(state))) continue; - if (!fw3_parse_blob_options(snat, fw3_snat_opts, rule)) + if (!fw3_parse_blob_options(snat, fw3_snat_opts, rule, name)) { - fprintf(stderr, "ubus section skipped due to invalid options\n"); + fprintf(stderr, "%s skipped due to invalid options\n", name); fw3_free_snat(snat); continue; } |