netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH RFC nf-next 0/3] named expressions for nf_tables
Date: Thu, 7 Apr 2016 23:49:42 +0200	[thread overview]
Message-ID: <20160407214942.GB731@breakpoint.cc> (raw)
In-Reply-To: <1459961493-7494-1-git-send-email-pablo@netfilter.org>

Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> This patchset introduces the named stateful expressions for nf_tables,
> that allows userspace to set a name for the stateful expression for
> several reasons:
> 
>  * Provide a unique identifier to fetch and reset it internal state.
>  * Allow to update of their parameters and internal state.
>  * Allow to fetch and reset its internal state.
>  * Refer to the same stateful expression from one or more rules.
>

Can't all of this be achieved via custom chains already...?

> nf_tables currently supports to stateful expressions: limit and counter,
> therefore you can create named instances of this expressions through
> this new infrastructure.

> Several examples on how this would look from userspace:
> 
> * Add the 'tcp-counter' counter to the 'filter' table:
> 
>  # nft add counter filter tcp-counter
> 
> * Delete this counter (only possible if not dereferenced from a rule):
> 
>  # nft delete counter filter tcp-counter
> 
> * List existing named counters:
> 
>  # nft lists counters
>  table ip filter {
>         counter tcp-counter {
>                 packets 6086 bytes 6278052
>         }
>         counter udp-counter {
>                 packets 272 bytes 64690
>         }
>         counter icmp-counter {
>                 packets 10 bytes 840
>         }
>  }

Can't you already create a 'named counter' via

chain tcp-counter {
	counter
}

?

Seems to me we only would have to teach nft list to
allow filtering output on chain names, e.g.

nft list table filter \*-counter

to have something similar using exsiting feature set.

> So far, only counters are supported, but it should be possible to
> support named limits. I have another (imcomplete) patch that allows to
> update the named expressions parameters, this can be useful to
> dynamically update the ratelimiting policies, the command line should
> look like:
> 
>  # nft update limit name user01234 rate 250 mbytes/day

Similar comment here, you could create

chain user01234 {
	limit rate 100 mbytes/day
}

This feature seems strange to me, AFAIU it adds a container for single
expressions, so it just seems to be a subset of what we already have
(namely chains as containers of rules).

What am I missing? :)

Is there something that is too cumbersome to achive with a chain-based
approach?

  parent reply	other threads:[~2016-04-07 21:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-06 16:51 [PATCH RFC nf-next 0/3] named expressions for nf_tables Pablo Neira Ayuso
2016-04-06 16:51 ` [PATCH RFC nf-next 1/3] netfilter: nf_tables: add stateful named expressions Pablo Neira Ayuso
2016-04-06 16:51 ` [PATCH RFC nf-next 2/3] netfilter: nf_tables: support for named expression reference Pablo Neira Ayuso
2016-04-06 16:51 ` [PATCH RFC nf-next 3/3] netfilter: nf_tables: support dump and reset for named expressions Pablo Neira Ayuso
2016-04-07 21:49 ` Florian Westphal [this message]
2016-04-08 11:43   ` [PATCH RFC nf-next 0/3] named expressions for nf_tables Pablo Neira Ayuso
2016-04-08 12:04     ` Florian Westphal
2016-04-08 12:12 ` Florian Westphal
2016-04-11 15:27 ` Andreas Schultz
2016-04-19 19:46   ` Pablo Neira Ayuso
2016-04-20  6:41     ` Pablo Neira Ayuso

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=20160407214942.GB731@breakpoint.cc \
    --to=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).