Skip to content

Commit a3073c1

Browse files
committed
netfilter: nf_tables: use nft_set_lookup_global from nf_tables_newsetelem()
Replace opencoded implementation of nft_set_lookup_global() by call to this function. Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 10659cb commit a3073c1

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4032,17 +4032,10 @@ static int nf_tables_newsetelem(struct net *net, struct sock *nlsk,
40324032
if (err < 0)
40334033
return err;
40344034

4035-
set = nf_tables_set_lookup(ctx.table, nla[NFTA_SET_ELEM_LIST_SET],
4036-
genmask);
4037-
if (IS_ERR(set)) {
4038-
if (nla[NFTA_SET_ELEM_LIST_SET_ID]) {
4039-
set = nf_tables_set_lookup_byid(net,
4040-
nla[NFTA_SET_ELEM_LIST_SET_ID],
4041-
genmask);
4042-
}
4043-
if (IS_ERR(set))
4044-
return PTR_ERR(set);
4045-
}
4035+
set = nft_set_lookup_global(net, ctx.table, nla[NFTA_SET_ELEM_LIST_SET],
4036+
nla[NFTA_SET_ELEM_LIST_SET_ID], genmask);
4037+
if (IS_ERR(set))
4038+
return PTR_ERR(set);
40464039

40474040
if (!list_empty(&set->bindings) && set->flags & NFT_SET_CONSTANT)
40484041
return -EBUSY;

0 commit comments

Comments
 (0)