Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Frank Myhr <fmyhr@fhmtech.com>
Cc: "netfilter@vger.kernel.org" <netfilter@vger.kernel.org>
Subject: Re: Advantage(s) of static over dynamic nftables sets?
Date: Wed, 18 Mar 2020 22:35:28 +0100	[thread overview]
Message-ID: <20200318213528.GL979@breakpoint.cc> (raw)
In-Reply-To: <a2d41bb9-2cbe-8b5e-99d9-a00cb086ca0b@fhmtech.com>

Frank Myhr <fmyhr@fhmtech.com> wrote:
> As an nftables newbie I was a bit surprised to discover that defining a set
> as static prevents adding or deleting elements not only from the packet path
> but also from the nft command line:
> 
> #  nft add element ip ip_filter static_set { a.b.c.d }
> Error: Could not process rule: Device or resource busy

Yes, such set is immutable.

> Which is easily remedied by defining the set as dynamic instead.
> 
> So now I wonder: why not define every set as dynamic?

Sets that are made static allow kernel to pick a more efficient
representation for the set type.

> Which would allow
> modification of any set's elements without having to reload the entire
> firewall -- thereby preserving accumulated counters and other stateful
> objects. Would performance and/or memory usage take a significant hit by
> doing this?

I don't think so, but this will probably depend a lot on the
system in question and on the type of elements stored.

  reply	other threads:[~2020-03-18 21:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-18 21:17 Advantage(s) of static over dynamic nftables sets? Frank Myhr
2020-03-18 21:35 ` Florian Westphal [this message]
2020-03-18 22:11   ` Frank Myhr
2020-03-18 22:51     ` Florian Westphal
2020-03-18 23:14       ` Frank Myhr
2020-03-19  0:08         ` Florian Westphal
2020-03-19  0:21           ` Frank Myhr

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=20200318213528.GL979@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=fmyhr@fhmtech.com \
    --cc=netfilter@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