netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] netfilter: nf_tables: fix update chain error
@ 2017-09-23  9:10 JingPiao Chen
  2017-09-29 11:34 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: JingPiao Chen @ 2017-09-23  9:10 UTC (permalink / raw)
  To: netfilter-devel; +Cc: JingPiao Chen

 # nft add table filter
 # nft add chain filter c1
 # nft rename chain filter c1 c2

Error: Could not process rule: No such file or directory
rename chain filter c1 c2
^^^^^^^^^^^^^^^^^^^^^^^^^^

 # nft add chain filter c2
 # nft rename chain filter c1 c2
 # nft list table filter

table ip filter {
	chain c2 {
	}

	chain c2 {
	}
}

Fixes: 664b0f8cd8 ("netfilter: nf_tables: add generation mask to chains")
Signed-off-by: JingPiao Chen <chenjingpiao@gmail.com>
---
 net/netfilter/nf_tables_api.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 9299271..f98ca8c 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -1487,8 +1487,8 @@ static int nf_tables_updchain(struct nft_ctx *ctx, u8 genmask, u8 policy,
 
 		chain2 = nf_tables_chain_lookup(table, nla[NFTA_CHAIN_NAME],
 						genmask);
-		if (IS_ERR(chain2))
-			return PTR_ERR(chain2);
+		if (!IS_ERR(chain2))
+			return -EEXIST;
 	}
 
 	if (nla[NFTA_CHAIN_COUNTERS]) {
-- 
2.7.4


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

* Re: [PATCH] netfilter: nf_tables: fix update chain error
  2017-09-23  9:10 [PATCH] netfilter: nf_tables: fix update chain error JingPiao Chen
@ 2017-09-29 11:34 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2017-09-29 11:34 UTC (permalink / raw)
  To: JingPiao Chen; +Cc: netfilter-devel

On Sat, Sep 23, 2017 at 05:10:44PM +0800, JingPiao Chen wrote:
>  # nft add table filter
>  # nft add chain filter c1
>  # nft rename chain filter c1 c2
> 
> Error: Could not process rule: No such file or directory
> rename chain filter c1 c2
> ^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
>  # nft add chain filter c2
>  # nft rename chain filter c1 c2
>  # nft list table filter
> 
> table ip filter {
> 	chain c2 {
> 	}
> 
> 	chain c2 {
> 	}
> }

Applied, thanks.

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

end of thread, other threads:[~2017-09-29 11:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-23  9:10 [PATCH] netfilter: nf_tables: fix update chain error JingPiao Chen
2017-09-29 11:34 ` 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).