From: Phil Sutter <phil@nwl.cc>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org, Florian Westphal <fw@strlen.de>
Subject: Re: [nft PATCH 1/4] xt: Delay libxtables access until translation
Date: Fri, 9 Dec 2022 01:14:50 +0100 [thread overview]
Message-ID: <Y5J9+hCSYPWYTl0N@orbyte.nwl.cc> (raw)
In-Reply-To: <Y5JVPqq30gcoYT9X@salvia>
Hi Pablo,
On Thu, Dec 08, 2022 at 10:21:02PM +0100, Pablo Neira Ayuso wrote:
> On Thu, Nov 24, 2022 at 05:56:38PM +0100, Phil Sutter wrote:
> > There is no point in spending efforts setting up the xt match/target
> > when it is not printed afterwards. So just store the statement data from
> > libnftnl in struct xt_stmt and perform the extension lookup from
> > xt_stmt_xlate() instead.
>
> There is nft -i and nft monitor which keep a ruleset cache. Both are
> sort of incomplete: nft -i resorts to cleaning up the cache based on
> the generation number and nft monitor still needs to be updated to
> keep track of incremental ruleset updates via netlink events. Sooner
> or later these two will get better support for incremental ruleset
> updates.
>
> I mean, in those two cases, every call to print the translation will
> trigger the allocation of the xt structures, fill them and then call
> .xlate. I agree it is a bit more work, I guess this won't case any
> noticeable penalty, but it might be work that needs to be done over
> and over again when ruleset uses xt match / target.
So you're saying the overhead when printing a rule might be more
significant than when fetching it. I doubt this simply because the same
rule is usually printed at most once and there are multiple other
commands requiring a rule cache.
IMO we may also just leave the code as-is and wait for someone to
complain about bad performance with rulesets containing many compat
expressions. Depending on the actual report, we may also follow a hybrid
approach and do the match/target lookup only when needed and cache it
for later use.
My patch made most sense with an nft in mind which does not need xtables
support for saving/restoring compat expressions. Users depending on this
for whatever reason will execute the xlate code path in any case now.
Cheers, Phil
next prev parent reply other threads:[~2022-12-09 0:15 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-24 16:56 [nft PATCH 0/4] xt: Rewrite unsupported compat expression dumping Phil Sutter
2022-11-24 16:56 ` [nft PATCH 1/4] xt: Delay libxtables access until translation Phil Sutter
2022-12-08 21:21 ` Pablo Neira Ayuso
2022-12-09 0:14 ` Phil Sutter [this message]
2022-12-09 16:06 ` Pablo Neira Ayuso
2022-11-24 16:56 ` [nft PATCH 2/4] xt: Purify enum nft_xt_type Phil Sutter
2022-11-24 16:56 ` [nft PATCH 3/4] xt: Rewrite unsupported compat expression dumping Phil Sutter
2022-11-24 17:04 ` Florian Westphal
2022-11-24 17:22 ` Phil Sutter
2022-11-24 17:35 ` Florian Westphal
2022-12-09 16:07 ` Pablo Neira Ayuso
2022-12-09 16:45 ` Phil Sutter
2022-12-09 20:10 ` Pablo Neira Ayuso
2022-11-24 16:56 ` [nft PATCH 4/4] xt: Fall back to generic printing from translation Phil Sutter
2022-12-13 14:03 ` [nft PATCH 0/4] xt: Rewrite unsupported compat expression dumping Phil Sutter
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=Y5J9+hCSYPWYTl0N@orbyte.nwl.cc \
--to=phil@nwl.cc \
--cc=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).