From: Harsha Sharma <harshasharmaiitr@gmail.com>
To: pablo@netfilter.org, harshasharmaiitr@gmail.com
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH] netfilter: nf_tables: delete chains via chain handle
Date: Wed, 10 Jan 2018 00:42:50 +0530 [thread overview]
Message-ID: <20180109191250.13089-1-harshasharmaiitr@gmail.com> (raw)
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
reply other threads:[~2018-01-09 19:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180109191250.13089-1-harshasharmaiitr@gmail.com \
--to=harshasharmaiitr@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).