Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Duncan Roe <duncan_roe@optusnet.com.au>
To: Devin Bayer <dev@doubly.so>
Cc: "netminder (Eric Peterson)" <netminder@gmail.com>,
	netfilter@vger.kernel.org
Subject: Re: meter directive
Date: Mon, 28 Sep 2020 22:32:13 +1000	[thread overview]
Message-ID: <20200928123213.GF20886@dimstar.local.net> (raw)
In-Reply-To: <b3d4b568-3d53-a9cf-6730-a47b35132b5f@doubly.so>

On Mon, Sep 28, 2020 at 12:01:52PM +0200, Devin Bayer wrote:
> On 28/09/2020 04.10, Duncan Roe wrote:
> >
> > Hi Davin,
>
> Thanks for the reply Duncan.
>
> > a) from b):
> > > Note that the meter keyword is obsolete, the dynamic set and map syntax is now preferred for consistency.
>
> I see. In that case, I would like to update the man page to use the new
> syntax. The examples there use meter, but without any explanation.
>
>
> For example the blacklist example:
>
>
>
> 	nft add rule ip filter input tcp flags syn tcp dport ssh meter flood size
> 128000 { ip saddr timeout 10s limit rate over 10/second} add @blackhole { ip
> saddr timeout 1m } drop
>
> So would this be the set equivalent?
>
>     set flood {
>         type ipv4_addr;
>         size 128000;
>         flags dynamic, timeout;
>         timeout 1m;
>     }
>     ...
>     tcp flags syn tcp dport ssh \
>         add @flood { ip saddr limit rate over 10/second } \
>         add @blackhole { ip saddr timeout 1m } drop
>
>
> Is there a map equivalent? I couldn't get anything to work.
>
> > b) Still documented at https://wiki.nftables.org/wiki-nftables/index.php/Meters,
> >     but the examples are updated to use dynamic sets.
>
> It's quite confusing and doesn't work as described though.
>
> > c) counters in dynamic sets are special: you get a counter for each set member.
>
> Right - but how can I see the counters? If you look at my example I just see
> this:
>
> 	3.10.95.11 . 22 expires 14s492ms limit rate 10/second,
>
> ~ Devin

It used to be the case with meters that you could have limit or counter but not
both.

I don't know if that is still the case with dynamic sets. If it is, you will
have to have 2 sets: 1 with limits and 1 with counters.

(counter with limit is ambiguous: do you want to count packets received or
packets accepted? Both are do-able with 2 sets).

Please post your rules that add set members if you have further questions.

Cheers ... Duncan.

  reply	other threads:[~2020-09-28 12:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-04  8:38 meter directive Devin Bayer
2020-09-27 12:27 ` Devin Bayer
     [not found]   ` <20200928021034.GB20886@dimstar.local.net>
2020-09-28 10:01     ` Devin Bayer
2020-09-28 12:32       ` Duncan Roe [this message]
2020-09-28 13:00         ` Devin Bayer
2020-09-28 16:08           ` Pablo Neira Ayuso
2020-09-28 16:12             ` Devin Bayer
2020-09-28 16:21               ` Pablo Neira Ayuso
2020-09-28 16:26                 ` Devin Bayer
2020-09-28 16:40                   ` Pablo Neira Ayuso
  -- strict thread matches above, loose matches on Subject: below --
2020-09-28 20:17 Eric Peterson

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=20200928123213.GF20886@dimstar.local.net \
    --to=duncan_roe@optusnet.com.au \
    --cc=dev@doubly.so \
    --cc=netfilter@vger.kernel.org \
    --cc=netminder@gmail.com \
    /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