projects
/
project
/
firewall3.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ad958ff
)
Restore iptables-save include functionality
author
Jo-Philipp Wich
<jow@openwrt.org>
Thu, 16 May 2013 20:34:49 +0000
(22:34 +0200)
committer
Jo-Philipp Wich
<jow@openwrt.org>
Fri, 17 May 2013 13:22:58 +0000
(15:22 +0200)
includes.c
patch
|
blob
|
history
main.c
patch
|
blob
|
history
diff --git
a/includes.c
b/includes.c
index
23cfda0
..
42d5b7a
100644
(file)
--- a/
includes.c
+++ b/
includes.c
@@
-83,14
+83,11
@@
fw3_load_includes(struct fw3_state *state, struct uci_package *p)
static void
static void
-print_include(struct fw3_include *include
, enum fw3_family family
)
+print_include(struct fw3_include *include)
{
FILE *f;
char line[1024];
{
FILE *f;
char line[1024];
- if (!fw3_is_family(include, family))
- return;
-
info(" * Loading include '%s'", include->path);
if (!(f = fopen(include->path, "r")))
info(" * Loading include '%s'", include->path);
if (!(f = fopen(include->path, "r")))
@@
-110,14
+107,35
@@
fw3_print_includes(struct fw3_state *state, enum fw3_family family, bool reload)
{
struct fw3_include *include;
{
struct fw3_include *include;
+ bool exec = false;
+ const char *restore = "iptables-restore";
+
+ if (family == FW3_FAMILY_V6)
+ restore = "ip6tables-restore";
+
list_for_each_entry(include, &state->includes, list)
{
if (reload && !include->reload)
continue;
list_for_each_entry(include, &state->includes, list)
{
if (reload && !include->reload)
continue;
- if (include->type == FW3_INC_TYPE_RESTORE)
- print_include(include, family);
+ if (include->type != FW3_INC_TYPE_RESTORE)
+ continue;
+
+ if (!fw3_is_family(include, family))
+ continue;
+
+ if (!exec)
+ {
+ exec = fw3_command_pipe(false, restore, "--noflush");
+
+ if (!exec)
+ return;
+ }
+
+ print_include(include);
}
}
+
+ fw3_command_close();
}
}
diff --git
a/main.c
b/main.c
index
fd6140a
..
7a8969f
100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-294,7
+294,8
@@
start(void)
fw3_ipt_commit(handle);
}
fw3_ipt_commit(handle);
}
- //fw3_print_includes(cfg_state, family, false);
+ if (!print_family)
+ fw3_print_includes(cfg_state, family, false);
family_set(run_state, family, true);
family_set(cfg_state, family, true);
family_set(run_state, family, true);
family_set(cfg_state, family, true);
@@
-384,7
+385,7
@@
start:
fw3_ipt_commit(handle);
}
fw3_ipt_commit(handle);
}
-
//
fw3_print_includes(cfg_state, family, true);
+ fw3_print_includes(cfg_state, family, true);
family_set(run_state, family, true);
family_set(cfg_state, family, true);
family_set(run_state, family, true);
family_set(cfg_state, family, true);