summaryrefslogtreecommitdiffstats
path: root/iptables/xtables.c
diff options
context:
space:
mode:
authorGiuseppe Longo <giuseppelng@gmail.com>2013-06-18 02:29:11 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2013-12-30 23:50:33 +0100
commitb48126ca92cc44e88aa024e6da7ff245914d6a53 (patch)
tree33fabf2d4ded7f1c9be9fc60ada13cbb3629ae14 /iptables/xtables.c
parent2c5850147937cd3da104adf654cc7b2d1f0c0a0b (diff)
xtables: allow to zero chains via -Z
Signed-off-by: Giuseppe Longo <giuseppelng@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'iptables/xtables.c')
-rw-r--r--iptables/xtables.c29
1 files changed, 9 insertions, 20 deletions
diff --git a/iptables/xtables.c b/iptables/xtables.c
index 688844ec..ca057d39 100644
--- a/iptables/xtables.c
+++ b/iptables/xtables.c
@@ -549,14 +549,6 @@ check_entry(const char *chain, const char *table,
}
static int
-zero_entries(const xt_chainlabel chain, int verbose,
- struct xtc_handle *handle)
-{
- /* XXX iterate over chains and reset counters */
- return 1;
-}
-
-static int
list_entries(struct nft_handle *h, const char *chain, const char *table,
int rulenum, int verbose, int numeric, int expanded,
int linenumbers)
@@ -1187,8 +1179,7 @@ int do_commandx(struct nft_handle *h, int argc, char *argv[], char **table)
ret = nft_rule_flush(h, chain, *table);
break;
case CMD_ZERO:
- /* FIXME */
-// ret = zero_entries(chain, cs.options&OPT_VERBOSE, *handle);
+ ret = nft_chain_zero_counters(h, chain, *table);
break;
case CMD_ZERO_NUM:
/* FIXME */
@@ -1197,28 +1188,26 @@ int do_commandx(struct nft_handle *h, int argc, char *argv[], char **table)
case CMD_LIST:
case CMD_LIST|CMD_ZERO:
case CMD_LIST|CMD_ZERO_NUM:
- /* FIXME */
ret = list_entries(h, chain, *table,
rulenum,
cs.options&OPT_VERBOSE,
cs.options&OPT_NUMERIC,
cs.options&OPT_EXPANDED,
cs.options&OPT_LINENUMBERS);
-/* if (ret && (command & CMD_ZERO))
- ret = zero_entries(chain,
- cs.options&OPT_VERBOSE, *handle);
- if (ret && (command & CMD_ZERO_NUM))
+ if (ret && (command & CMD_ZERO))
+ ret = nft_chain_zero_counters(h, chain, *table);
+ /* FIXME */
+/* if (ret && (command & CMD_ZERO_NUM))
ret = iptc_zero_counter(chain, rulenum, *handle); */
break;
case CMD_LIST_RULES:
case CMD_LIST_RULES|CMD_ZERO:
case CMD_LIST_RULES|CMD_ZERO_NUM:
- /* FIXME */
ret = list_rules(h, chain, *table, rulenum, cs.options&OPT_VERBOSE);
-/* if (ret && (command & CMD_ZERO))
- ret = zero_entries(chain,
- cs.options&OPT_VERBOSE, *handle);
- if (ret && (command & CMD_ZERO_NUM))
+ if (ret && (command & CMD_ZERO))
+ ret = nft_chain_zero_counters(h, chain, *table);
+ /* FIXME */
+/* if (ret && (command & CMD_ZERO_NUM))
ret = iptc_zero_counter(chain, rulenum, *handle); */
break;
case CMD_NEW_CHAIN: