X-Git-Url: http://git.archive.openwrt.org/?p=project%2Ffirewall3.git;a=blobdiff_plain;f=includes.c;h=23cfda0f4f73f7e4d99183d84144336763e08237;hp=4221def04407e57feda25111417b39b2cb7b9106;hb=b3c483a8cdeb2c537c3acf70f56865e5f30cfcfc;hpb=46536e5263c4bf57a91c38b5d08d78c774649dda diff --git a/includes.c b/includes.c index 4221def..23cfda0 100644 --- a/includes.c +++ b/includes.c @@ -25,6 +25,7 @@ const struct fw3_option fw3_include_opts[] = { FW3_OPT("path", string, include, path), FW3_OPT("type", include_type, include, type), FW3_OPT("family", family, include, family), + FW3_OPT("reload", bool, include, reload), { } }; @@ -82,7 +83,7 @@ fw3_load_includes(struct fw3_state *state, struct uci_package *p) static void -print_include(enum fw3_family family, struct fw3_include *include) +print_include(struct fw3_include *include, enum fw3_family family) { FILE *f; char line[1024]; @@ -105,13 +106,18 @@ print_include(enum fw3_family family, struct fw3_include *include) } void -fw3_print_includes(enum fw3_family family, struct fw3_state *state) +fw3_print_includes(struct fw3_state *state, enum fw3_family family, bool reload) { struct fw3_include *include; list_for_each_entry(include, &state->includes, list) + { + if (reload && !include->reload) + continue; + if (include->type == FW3_INC_TYPE_RESTORE) - print_include(family, include); + print_include(include, family); + } } @@ -144,11 +150,16 @@ run_include(struct fw3_include *include) } void -fw3_run_includes(struct fw3_state *state) +fw3_run_includes(struct fw3_state *state, bool reload) { struct fw3_include *include; list_for_each_entry(include, &state->includes, list) + { + if (reload && !include->reload) + continue; + if (include->type == FW3_INC_TYPE_SCRIPT) run_include(include); + } }