Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Victor Julien <lists@inliniac.net>
Cc: netfilter@vger.kernel.org
Subject: Re: named counters vs flush ruleset
Date: Sat, 8 Feb 2025 22:49:45 +0100	[thread overview]
Message-ID: <Z6fRedYWO14e0l7e@calendula> (raw)
In-Reply-To: <5f970dae-b21b-4837-9e96-955bedbdf69f@inliniac.net>

Hi Victor,

On Sat, Feb 08, 2025 at 03:35:27PM +0100, Victor Julien wrote:
> Hi all,
> 
> I'm working on finally supporting nftables in Vuurmuur.
> 
> In the iptables support, I have special rules per interface to get per iface
> packets and bytes. Essentially my tool reads the iptables -vnL output and
> parses all the things. When a user applies a ruleset change, Vuurmuur reads
> the most current values, constructs a new input file to `iptables-restore`
> and loads the rules. This works but is tedious, and also lacks some
> precision as we are not counting the packets/bytes while Vuurmuur is
> working.
> 
> In the nftables support, I'm more or less looking at the same logic. The
> ruleset is build as a .nft file that is loaded with `nft -f`.
> 
> Now I found the the named counter feature, and also the json output `nft -j
> list counters`. This combination seems perfect.
> 
> I guess my main question is if we can make these counters persistent
> somehow. As part of the ruleset reload, I issue a `flush ruleset`, which
> also removes the counters.
> 
> So can we make counters survive a `flush ruleset`, or is there a better way
> to load a new ruleset?

Would it work for you to destroy all other existing objects (not the
table and counters) instead?

  reply	other threads:[~2025-02-08 21:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-08 14:35 named counters vs flush ruleset Victor Julien
2025-02-08 21:49 ` Pablo Neira Ayuso [this message]
2025-02-09 10:58   ` Victor Julien
2025-02-25 23:47     ` Pablo Neira Ayuso
2025-03-02 12:01       ` Victor Julien

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=Z6fRedYWO14e0l7e@calendula \
    --to=pablo@netfilter.org \
    --cc=lists@inliniac.net \
    --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