summaryrefslogtreecommitdiffstats
path: root/iptables
diff options
context:
space:
mode:
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>2013-07-31 15:18:52 +0300
committerPablo Neira Ayuso <pablo@netfilter.org>2013-12-30 23:50:41 +0100
commitf8781d3da3943a0fc10212e77cdbcd0697943596 (patch)
tree9b78f31861b1dfe9f1fb2f3244bbe8111dfb27d4 /iptables
parentcea310bd1d078618e87b83410f8c6f75b34de450 (diff)
xtables: Do not dump before command parsing has been finished
On xtables-save.c, -d will not output right away but after the full command line hase been parsed. Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'iptables')
-rw-r--r--iptables/xtables-save.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/iptables/xtables-save.c b/iptables/xtables-save.c
index db030901..990c0fe6 100644
--- a/iptables/xtables-save.c
+++ b/iptables/xtables-save.c
@@ -78,6 +78,7 @@ int
xtables_save_main(int argc, char *argv[])
{
const char *tablename = NULL;
+ bool dump = false;
struct nft_handle h = {
.family = AF_INET, /* default to AF_INET */
};
@@ -118,8 +119,8 @@ xtables_save_main(int argc, char *argv[])
xtables_modprobe_program = optarg;
break;
case 'd':
- do_output(&h, tablename, show_counters);
- exit(0);
+ dump = true;
+ break;
case '4':
h.family = AF_INET;
break;
@@ -135,5 +136,10 @@ xtables_save_main(int argc, char *argv[])
exit(1);
}
+ if (dump) {
+ do_output(&h, tablename, show_counters);
+ exit(0);
+ }
+
return !do_output(&h, tablename, show_counters);
}