netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nf-next] x_tables: never register tables by default
Date: Tue, 10 Aug 2021 17:22:56 +0200	[thread overview]
Message-ID: <20210810152256.GA2502@salvia> (raw)
In-Reply-To: <20210803144719.26735-1-fw@strlen.de>

On Tue, Aug 03, 2021 at 04:47:19PM +0200, Florian Westphal wrote:
> For historical reasons x_tables still register tables by default in the
> initial namespace.
> Only newly created net namespaces add the hook on demand.
> 
> This means that the init_net always pays hook cost, even if no filtering
> rules are added (e.g. only used inside a single netns).
> 
> Note that the hooks are added even when 'iptables -L' is called.
> This is because there is no way to tell 'iptables -A' and 'iptables -L'
> apart at kernel level.
> 
> The only solution would be to register the table, but delay hook
> registration until the first rule gets added (or policy gets changed).
> 
> That however means that counters are not hooked either, so 'iptables -L'
> would always show 0-counters even when traffic is flowing which might be
> unexpected.
> 
> This keeps table and hook registration consistent with what is already done
> in non-init netns: first iptables(-save) invocation registers both table
> and hooks.
> 
> This applies the same solution adopted for ebtables.
> All tables register a template that contains the l3 family, the name
> and a constructor function that is called when the initial table has to
> be added.

Applied to nf-next, thanks.

      reply	other threads:[~2021-08-10 15:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-03 14:47 [PATCH nf-next] x_tables: never register tables by default Florian Westphal
2021-08-10 15:22 ` Pablo Neira Ayuso [this message]

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=20210810152256.GA2502@salvia \
    --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 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).