* [PATCH] netfilter: nf_tables: delete chains via chain handle
@ 2018-01-09 19:12 Harsha Sharma
0 siblings, 0 replies; only message in thread
From: Harsha Sharma @ 2018-01-09 19:12 UTC (permalink / raw)
To: pablo, harshasharmaiitr; +Cc: netfilter-devel
This patch allows deletion of chains via unique chain handle which can be
listed via '-a' option and table family and table name.
Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
---
net/netfilter/nf_tables_api.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index f12671e0ec48..b4db7bd836d9 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -1660,6 +1660,7 @@ static int nf_tables_delchain(struct net *net, struct sock *nlsk,
int family = nfmsg->nfgen_family;
struct nft_ctx ctx;
u32 use;
+ u64 handle;
int err;
afi = nf_tables_afinfo_lookup(net, family, false);
@@ -1670,7 +1671,12 @@ static int nf_tables_delchain(struct net *net, struct sock *nlsk,
if (IS_ERR(table))
return PTR_ERR(table);
- chain = nf_tables_chain_lookup(table, nla[NFTA_CHAIN_NAME], genmask);
+ if (nla[NFTA_CHAIN_HANDLE]) {
+ handle = be64_to_cpu(nla_get_be64(nla[NFTA_CHAIN_HANDLE]));
+ chain = nf_tables_chain_lookup_byhandle(table, handle, genmask);
+ } else {
+ chain = nf_tables_chain_lookup(table, nla[NFTA_CHAIN_NAME], genmask);
+ }
if (IS_ERR(chain))
return PTR_ERR(chain);
--
2.11.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-01-09 19:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-09 19:12 [PATCH] netfilter: nf_tables: delete chains via chain handle Harsha Sharma
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).