netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [nftables PATCH] listing: only display wanted chain
@ 2013-11-18  7:40 Eric Leblond
  2013-11-19  9:26 ` Arturo Borrero Gonzalez
  2013-11-19 20:32 ` Pablo Neira Ayuso
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Leblond @ 2013-11-18  7:40 UTC (permalink / raw)
  To: netfilter-devel, pablo; +Cc: eric

When specifying a chain to list, all created chains were displayed
with a void content:

 # nft list chain filter
 table ip filter {
  	chain input {
  	}

  	chain new {
  		 counter packets 17971 bytes 2380637 accept
  		 counter packets 0 bytes 0 accept
  	}
  }

With the attached patch, only the asked chain is displayed:

  # nft list chain filter
  table ip filter {
  	chain new {
  		 counter packets 17971 bytes 2380637 accept # handle 36
  		 counter packets 0 bytes 0 accept # handle 40
  	}
  }

Signed-off-by: Eric Leblond <eric@regit.org>
---
 src/netlink.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/netlink.c b/src/netlink.c
index a62c357..15cba79 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -544,6 +544,10 @@ static int list_chain_cb(struct nft_chain *nlc, void *arg)
 	    strcmp(nft_chain_attr_get_str(nlc, NFT_CHAIN_ATTR_TABLE), h->table) != 0)
 		return 0;
 
+	if (h->chain &&
+	    strcmp(nft_chain_attr_get_str(nlc, NFT_CHAIN_ATTR_NAME), h->chain) != 0)
+		return 0;
+
 	chain = chain_alloc(nft_chain_attr_get_str(nlc, NFT_CHAIN_ATTR_NAME));
 	chain->handle.family =
 		nft_chain_attr_get_u32(nlc, NFT_CHAIN_ATTR_FAMILY);
-- 
1.8.4.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [nftables PATCH] listing: only display wanted chain
  2013-11-18  7:40 [nftables PATCH] listing: only display wanted chain Eric Leblond
@ 2013-11-19  9:26 ` Arturo Borrero Gonzalez
  2013-11-19 20:32 ` Pablo Neira Ayuso
  1 sibling, 0 replies; 3+ messages in thread
From: Arturo Borrero Gonzalez @ 2013-11-19  9:26 UTC (permalink / raw)
  To: Eric Leblond; +Cc: Netfilter Development Mailing list, Pablo Neira Ayuso

On 18 November 2013 08:40, Eric Leblond <eric@regit.org> wrote:
> When specifying a chain to list, all created chains were displayed
> with a void content:
>
>  # nft list chain filter
>  table ip filter {
>         chain input {
>         }
>
>         chain new {
>                  counter packets 17971 bytes 2380637 accept
>                  counter packets 0 bytes 0 accept
>         }
>   }
>
> With the attached patch, only the asked chain is displayed:
>
>   # nft list chain filter
>   table ip filter {
>         chain new {
>                  counter packets 17971 bytes 2380637 accept # handle 36
>                  counter packets 0 bytes 0 accept # handle 40
>         }
>   }
>
> Signed-off-by: Eric Leblond <eric@regit.org>

Hi all,

I've been testing this patch and works fine for me.
I think the old behaviour was a bit odd.

Thanks Eric.
-- 
Arturo Borrero González
--
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [nftables PATCH] listing: only display wanted chain
  2013-11-18  7:40 [nftables PATCH] listing: only display wanted chain Eric Leblond
  2013-11-19  9:26 ` Arturo Borrero Gonzalez
@ 2013-11-19 20:32 ` Pablo Neira Ayuso
  1 sibling, 0 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2013-11-19 20:32 UTC (permalink / raw)
  To: Eric Leblond; +Cc: netfilter-devel

On Mon, Nov 18, 2013 at 08:40:21AM +0100, Eric Leblond wrote:
> When specifying a chain to list, all created chains were displayed
> with a void content:
> 
>  # nft list chain filter
>  table ip filter {
>   	chain input {
>   	}
> 
>   	chain new {
>   		 counter packets 17971 bytes 2380637 accept
>   		 counter packets 0 bytes 0 accept
>   	}
>   }
> 
> With the attached patch, only the asked chain is displayed:
> 
>   # nft list chain filter
>   table ip filter {
>   	chain new {
>   		 counter packets 17971 bytes 2380637 accept # handle 36
>   		 counter packets 0 bytes 0 accept # handle 40
>   	}
>   }

Also applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-11-19 20:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-18  7:40 [nftables PATCH] listing: only display wanted chain Eric Leblond
2013-11-19  9:26 ` Arturo Borrero Gonzalez
2013-11-19 20:32 ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).