summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2019-07-22 12:16:25 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2019-07-23 21:14:40 +0200
commitb5dfbb3ca2a4acf5238bb3e0b2cc20b2a213041e (patch)
treeb093f01b7f0ce2fb4690136abca3e19cb2cc16bd
parentc013d5fe3d0af3cac70874d79adf1c87dad96125 (diff)
xtables-save: Make COMMIT line optional
Explicit commits are not used by either arp- nor ebtables-save. In order to share code between all the different *-save tools without inducing changes to ruleset dump contents, allow for callers of do_output() to turn COMMIT lines on or off. Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--iptables/xtables-save.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/iptables/xtables-save.c b/iptables/xtables-save.c
index b4d14b5b..249b3960 100644
--- a/iptables/xtables-save.c
+++ b/iptables/xtables-save.c
@@ -67,6 +67,7 @@ static bool ebt_legacy_counter_format;
struct do_output_data {
bool counters;
+ bool commit;
};
static int
@@ -98,7 +99,8 @@ __do_output(struct nft_handle *h, const char *tablename, void *data)
* thereby preventing dependency conflicts */
nft_chain_save(h, chain_list);
nft_rule_save(h, tablename, d->counters ? 0 : FMT_NOCOUNTS);
- printf("COMMIT\n");
+ if (d->commit)
+ printf("COMMIT\n");
now = time(NULL);
printf("# Completed on %s", ctime(&now));
@@ -219,6 +221,7 @@ xtables_save_main(int family, int argc, char *argv[],
init_extensions4();
#endif
tables = xtables_ipv4;
+ d.commit = true;
break;
case NFPROTO_ARP:
tables = xtables_arp;