Patchwork [iptables-nftables,2/2] xtables: arp: zeroing chain counters

login
register
mail settings
Submitter Giuseppe Longo
Date Sept. 22, 2013, 8:18 a.m.
Message ID <1379837936-2813-2-git-send-email-giuseppelng@gmail.com>
Download mbox | patch
Permalink /patch/276951/
State Accepted
Headers show

Comments

Giuseppe Longo - Sept. 22, 2013, 8:18 a.m.
This small patch permit to reset the chain counters.

Signed-off-by: Giuseppe Longo <giuseppelng@gmail.com>
---
 iptables/xtables-arp.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
Pablo Neira - Sept. 24, 2013, 11:19 a.m.
On Sun, Sep 22, 2013 at 10:18:56AM +0200, Giuseppe Longo wrote:
> This small patch permit to reset the chain counters.

Applied with minor change.

> Signed-off-by: Giuseppe Longo <giuseppelng@gmail.com>
> ---
>  iptables/xtables-arp.c |    5 ++---
>  1 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/iptables/xtables-arp.c b/iptables/xtables-arp.c
> index 4537a58..2f43ce8 100644
> --- a/iptables/xtables-arp.c
> +++ b/iptables/xtables-arp.c
> @@ -1462,9 +1462,8 @@ int do_commandarp(struct nft_handle *h, int argc, char *argv[], char **table)
>  				   options&OPT_NUMERIC,
>  				   /*options&OPT_EXPANDED*/0,
>  				   options&OPT_LINENUMBERS);
> -		/*if (ret)
> -			ret = zero_entries(chain,
> -						options&OPT_VERBOSE, handle);*/
> +		if (ret && (command & CMD_ZERO))
                        ^---------------------^

that seems redundant, we already checked for this above.

Mangled and applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/iptables/xtables-arp.c b/iptables/xtables-arp.c
index 4537a58..2f43ce8 100644
--- a/iptables/xtables-arp.c
+++ b/iptables/xtables-arp.c
@@ -1462,9 +1462,8 @@  int do_commandarp(struct nft_handle *h, int argc, char *argv[], char **table)
 				   options&OPT_NUMERIC,
 				   /*options&OPT_EXPANDED*/0,
 				   options&OPT_LINENUMBERS);
-		/*if (ret)
-			ret = zero_entries(chain,
-						options&OPT_VERBOSE, handle);*/
+		if (ret && (command & CMD_ZERO))
+			ret = nft_chain_zero_counters(h, chain, *table);
 		break;
 	case CMD_NEW_CHAIN:
 		ret = nft_chain_user_add(h, chain, *table);