From: Florian Westphal <fw@strlen.de>
To: ѽ҉ᶬḳ℠ <vtol@gmx.net>
Cc: "netfilter@vger.kernel.org" <netfilter@vger.kernel.org>
Subject: Re: [nftables] icmp type rate limiting - cumulative for the daddr or selectively per saddr?
Date: Tue, 29 Sep 2020 16:46:27 +0200 [thread overview]
Message-ID: <20200929144627.GB20140@breakpoint.cc> (raw)
In-Reply-To: <407b6fc3-1986-6453-9f68-a066b3ad1974@gmx.net>
ѽ҉ᶬḳ℠ <vtol@gmx.net> wrote:
> https://wiki.nftables.org/wiki-nftables/index.php/Rate_limiting_matchings is
> not clear whether the 'limit rate' stanza applies as:
>
> * cummulutive limit (from any/all saddr) for the daddr within the given
> period
Its always the same, limit has no internal state other than the rate
bucket.
In all these examples the limit applies for every packet that makes
it to the limit expression.
So, f.e.:
nft add rule filter input icmp type echo-request limit rate 10/second
accept
applies the limit to each icmp echo request.
> If it is a cummulutive limit how to go about a limit per saddr? For example:
>
> icmpv6 type 128 ip6 saddr limit rate over 15/second burst 3 packets drop
>
> or
>
> icmpv6 type 128 { ip6 saddr limit rate over 15/second burst 3 packets } drop
>
> producing:
>
> Error: syntax error, unexpected saddr, expecting comma or '}'
Yes, you need to use a dynamic set for this, because the 'limit'
expression has the be kept per set entry.
Example (using older meter syntax):
nft add rule ip6 filter input icmpv6 type 128 meter icmp6limit '{ ip6 saddr limit rate over 15/second burst 3 packets } drop'
This adds a set, adds a 'limit rate' object for every ip6 saddr that
gets added to the set.
Since this needs to insert new entries, you might want to limit size and
forget old entries:
nft add rule ip6 filter input icmpv6 type 128 meter icmp6limit size 8192 '{ ip6 saddr timeout 1m limit rate over 15/second burst 3 packets } drop'
next prev parent reply other threads:[~2020-09-29 14:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-29 13:39 [nftables] icmp type rate limiting - cumulative for the daddr or selectively per saddr? ѽ҉ᶬḳ℠
2020-09-29 14:46 ` Florian Westphal [this message]
2020-09-29 16:13 ` ѽ҉ᶬḳ℠
2020-09-29 14:52 ` 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=20200929144627.GB20140@breakpoint.cc \
--to=fw@strlen.de \
--cc=netfilter@vger.kernel.org \
--cc=vtol@gmx.net \
/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