Skip to content

Commit

Permalink
netfilter: nft_set_pipapo: .walk does not deal with generations
Browse files Browse the repository at this point in the history
The .walk callback iterates over the current active set, but it might be
useful to iterate over the next generation set. Use the generation mask
to determine what set view (either current or next generation) is use
for the walk iteration.

Fixes: 3c4287f ("nf_tables: Add set type for arbitrary concatenation of ranges")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Pablo Neira Ayuso committed Jun 20, 2023
1 parent 628bd3e commit 2b84e21
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion net/netfilter/nft_set_pipapo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1974,12 +1974,16 @@ static void nft_pipapo_walk(const struct nft_ctx *ctx, struct nft_set *set,
struct nft_set_iter *iter)
{
struct nft_pipapo *priv = nft_set_priv(set);
struct net *net = read_pnet(&set->net);
struct nft_pipapo_match *m;
struct nft_pipapo_field *f;
int i, r;

rcu_read_lock();
m = rcu_dereference(priv->match);
if (iter->genmask == nft_genmask_cur(net))
m = rcu_dereference(priv->match);
else
m = priv->clone;

if (unlikely(!m))
goto out;
Expand Down

0 comments on commit 2b84e21

Please sign in to comment.