]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
netfilter: nf_tables: use nft_set_lookup_global from nf_tables_newsetelem()
authorPablo Neira Ayuso <pablo@netfilter.org>
Wed, 28 Mar 2018 10:06:50 +0000 (12:06 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 30 Mar 2018 09:29:20 +0000 (11:29 +0200)
Replace opencoded implementation of nft_set_lookup_global() by call to
this function.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_tables_api.c

index 769d84015073b2f4f838fadfd0faa816a6cae4f0..2bd80fa9b070ec486956f23945aa93f2d0f157b4 100644 (file)
@@ -4032,17 +4032,10 @@ static int nf_tables_newsetelem(struct net *net, struct sock *nlsk,
        if (err < 0)
                return err;
 
-       set = nf_tables_set_lookup(ctx.table, nla[NFTA_SET_ELEM_LIST_SET],
-                                  genmask);
-       if (IS_ERR(set)) {
-               if (nla[NFTA_SET_ELEM_LIST_SET_ID]) {
-                       set = nf_tables_set_lookup_byid(net,
-                                       nla[NFTA_SET_ELEM_LIST_SET_ID],
-                                       genmask);
-               }
-               if (IS_ERR(set))
-                       return PTR_ERR(set);
-       }
+       set = nft_set_lookup_global(net, ctx.table, nla[NFTA_SET_ELEM_LIST_SET],
+                                   nla[NFTA_SET_ELEM_LIST_SET_ID], genmask);
+       if (IS_ERR(set))
+               return PTR_ERR(set);
 
        if (!list_empty(&set->bindings) && set->flags & NFT_SET_CONSTANT)
                return -EBUSY;