diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2017-03-06 17:46:20 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2017-03-06 18:23:23 +0100 |
commit | c7a72e3fdb5d77486ca3a0ac942c0a2e0d80d5bb (patch) | |
tree | 6ed84607ebb0bb3cf04047d7be9312408ea48879 /net/netfilter/nft_dynset.c | |
parent | c56e3956c17bb24d18470122c0513d963e332205 (diff) | |
download | linux-c7a72e3fdb5d77486ca3a0ac942c0a2e0d80d5bb.tar.gz linux-c7a72e3fdb5d77486ca3a0ac942c0a2e0d80d5bb.tar.bz2 linux-c7a72e3fdb5d77486ca3a0ac942c0a2e0d80d5bb.zip |
netfilter: nf_tables: add nft_set_lookup()
This new function consolidates set lookup via either name or ID by
introducing a new nft_set_lookup() function. Replace existing spots
where we can use this too.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter/nft_dynset.c')
-rw-r--r-- | net/netfilter/nft_dynset.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/net/netfilter/nft_dynset.c b/net/netfilter/nft_dynset.c index 049ad2d9ee66..3948da380259 100644 --- a/net/netfilter/nft_dynset.c +++ b/net/netfilter/nft_dynset.c @@ -133,16 +133,10 @@ static int nft_dynset_init(const struct nft_ctx *ctx, priv->invert = true; } - set = nf_tables_set_lookup(ctx->table, tb[NFTA_DYNSET_SET_NAME], - genmask); - if (IS_ERR(set)) { - if (tb[NFTA_DYNSET_SET_ID]) - set = nf_tables_set_lookup_byid(ctx->net, - tb[NFTA_DYNSET_SET_ID], - genmask); - if (IS_ERR(set)) - return PTR_ERR(set); - } + set = nft_set_lookup(ctx->net, ctx->table, tb[NFTA_DYNSET_SET_NAME], + tb[NFTA_DYNSET_SET_ID], genmask); + if (IS_ERR(set)) + return PTR_ERR(set); if (set->ops->update == NULL) return -EOPNOTSUPP; |