From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nf,v2 2/2] netfilter: nf_tables: call set ops .commit when building new ruleset
Date: Thu, 6 Aug 2026 16:48:49 +0200 [thread overview]
Message-ID: <anSe0eK9dl1d2J7-@chamomile> (raw)
In-Reply-To: <anRrLtZvlPXtqJAA@strlen.de>
On Thu, Aug 06, 2026 at 01:08:30PM +0200, Florian Westphal wrote:
> Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> > The rbtree set only builds the b-search array after the new ruleset has
> > been exposed through set ops .commit.
> >
> > This is currently needed by pipapo because it purges the elements from
> > the clone after the transactions are handled, therefore, pipapo still
> > needs the delayed set ops .commit call after the transaction handling.
> >
> > Allow the rbtree to call .commit before the transaction handling which
> > purges the stale elements from the frontend rbtree datastructure.
> >
> > Update rbtree .commit to skip deactivated and expired elements when
> > building the new b-search array.
>
> I'm not following, sorry. What's the difference between pipapo and rbtree?
pipapo needs to call nft_setelem_remove() to purge the deactivated
elements from priv->clone, then the new version of the pipapo lookup
table datastructure can be published.
The rbtree does not need to wait to call nft_setelem_remove() since it
updates the rbtree frontend datastructure that is only exposed to
control plane.
> static void nft_pipapo_commit(struct nft_set *set)
> {
> [..]
> if (time_after_eq(jiffies, priv->last_gc + nft_set_gc_interval(set)))
> pipapo_gc_scan(set, priv->clone);
>
> old = rcu_replace_pointer(priv->match, priv->clone,
> nft_pipapo_transaction_mutex_held(set));
>
> [..] after this, new incarnation is live.
>
> static void nft_rbtree_commit(struct nft_set *set)
> {
> [..]
> if (time_after_eq(jiffies, priv->last_gc + nft_set_gc_interval(set)))
> nft_rbtree_gc_scan(set);
>
> [ ... build the new blob ... ]
>
> err_out:
> priv->array_next->num_intervals = num_intervals;
> old = rcu_replace_pointer(priv->array, priv->array_next,
> lockdep_is_held(&nft_pernet(read_pnet(&set->net))->commit_mutex));
>
>
> [..] after this, new incarnation is live.
>
> What is the problem? These two functions do the same thing, no?
Apparently yes, but...
> Why must the blob be rebuilt before stale node purge in rbtree case?
... there is a gap between the ruleset blob is built and published and
the set .commit interface is called to publish the new version of the
rbtree/pipapo datastructure.
See:
https://lore.kernel.org/netfilter-devel/589d243b-3d88-4138-9786-1bbb4347e79d@app.fastmail.com/
next prev parent reply other threads:[~2026-08-06 14:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-05 17:11 [PATCH nf,v2 1/2] netfilter: nf_tables: move set_update_list to nftables per-netns Pablo Neira Ayuso
2026-08-05 17:11 ` [PATCH nf,v2 2/2] netfilter: nf_tables: call set ops .commit when building new ruleset Pablo Neira Ayuso
2026-08-06 10:30 ` Fernando Fernandez Mancera
2026-08-06 14:35 ` Pablo Neira Ayuso
2026-08-10 9:43 ` Fernando Fernandez Mancera
2026-08-06 11:08 ` Florian Westphal
2026-08-06 14:48 ` Pablo Neira Ayuso [this message]
2026-08-06 18:01 ` Florian Westphal
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=anSe0eK9dl1d2J7-@chamomile \
--to=pablo@netfilter.org \
--cc=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.