]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
xtables: pass format to nft_rule_save()
authorPhil Sutter <phil@nwl.cc>
Thu, 19 Jul 2018 16:32:06 +0000 (18:32 +0200)
committerFlorian Westphal <fw@strlen.de>
Thu, 19 Jul 2018 21:11:32 +0000 (23:11 +0200)
Preparing ebtables-save implementation, allow for callers to pass format
bits to nft_rule_save() instead of just the 'counters' boolean.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Florian Westphal <fw@strlen.de>
iptables/nft.c
iptables/nft.h
iptables/xtables-save.c

index 9f650f5af5fe8dd4311e4c28bd66cec7ba225af8..07e15c7a16f28b61a080b0d65d4773962fc8adee 100644 (file)
@@ -1373,7 +1373,7 @@ retry:
        return list;
 }
 
-int nft_rule_save(struct nft_handle *h, const char *table, bool counters)
+int nft_rule_save(struct nft_handle *h, const char *table, unsigned int format)
 {
        struct nftnl_rule_list *list;
        struct nftnl_rule_list_iter *iter;
@@ -1395,8 +1395,7 @@ int nft_rule_save(struct nft_handle *h, const char *table, bool counters)
                if (strcmp(table, rule_table) != 0)
                        goto next;
 
-               nft_rule_print_save(r, NFT_RULE_APPEND,
-                                   counters ? 0 : FMT_NOCOUNTS);
+               nft_rule_print_save(r, NFT_RULE_APPEND, format);
 
 next:
                r = nftnl_rule_list_iter_next(iter);
index a3f5c202d8f57aa44c6ed5a5cfd1f66bd885a5c2..17031871c8e3d79417423446de86c868a91d1bcc 100644 (file)
@@ -98,7 +98,7 @@ int nft_rule_delete_num(struct nft_handle *h, const char *chain, const char *tab
 int nft_rule_replace(struct nft_handle *h, const char *chain, const char *table, void *data, int rulenum, bool verbose);
 int nft_rule_list(struct nft_handle *h, const char *chain, const char *table, int rulenum, unsigned int format);
 int nft_rule_list_save(struct nft_handle *h, const char *chain, const char *table, int rulenum, int counters);
-int nft_rule_save(struct nft_handle *h, const char *table, bool counters);
+int nft_rule_save(struct nft_handle *h, const char *table, unsigned int format);
 int nft_rule_flush(struct nft_handle *h, const char *chain, const char *table);
 int nft_rule_zero_counters(struct nft_handle *h, const char *chain, const char *table, int rulenum);
 
index c19c9991e5a60b82ed8f07851a54234396cf5f80..e6bad32fa0b8128936804c8e44ef81766ea90e96 100644 (file)
@@ -70,7 +70,7 @@ __do_output(struct nft_handle *h, const char *tablename, bool counters)
        /* Dump out chain names first,
         * thereby preventing dependency conflicts */
        nft_chain_save(h, chain_list, tablename);
-       nft_rule_save(h, tablename, counters);
+       nft_rule_save(h, tablename, counters ? 0 : FMT_NOCOUNTS);
 
        now = time(NULL);
        printf("COMMIT\n");