From: Pablo Neira Ayuso <pablo@netfilter.org>
To: ѽ҉ᶬḳ℠ <vtol@gmx.net>
Cc: netfilter@vger.kernel.org
Subject: Re: [nftables] netdev rate limiting | timeouts rfq
Date: Wed, 23 Sep 2020 10:30:42 +0200 [thread overview]
Message-ID: <20200923083042.GB10267@salvia> (raw)
In-Reply-To: <5c60c340-d6d8-1f7c-67da-2782360a92fe@gmx.net>
On Tue, Sep 22, 2020 at 10:49:00PM +0000, ѽ҉ᶬḳ℠ wrote:
> kernel 5.9.0-rc6 armv7l | nft 0.9.6
>
> ------
>
> (1) netdev rate limiting
>
> /table netdev filter {//
> // set glv4 {//
> // type ipv4_addr//
> // size 65535//
> // flags dynamic,timeout//
> // counter//
> // timeout 15m//
> // gc-interval 10s//
> // }//
> // chain input {//
> // type filter hook ingress device "eth2" priority -500;
> policy accept;//
> // ip saddr @glv4 counter packets 0 bytes 0 log prefix
> "nd glv4 DROP" flags all drop//
> // }
>
> /Then however
>
> /nft add rule netdev filter input ip protocol tcp { ip saddr limit rate
> over 50/second burst 15 packets } update @glv4 { ip saddr }/
table ip filter {
set glv4 {
type ipv4_addr
size 65535
flags dynamic,timeout
timeout 15m
gc-interval 10s
}
chain input {
ip protocol tcp update @glv4 { ip saddr limit rate over 50/second burst 15 packets }
}
}
This reads: update set 'glv4' with ip saddr using limit rate over
50/second burst 15 packets.
You cannot combine counter and limit yet though.
> producing:
>
> Error: syntax error, unexpected saddr, expecting comma or '}'
> add rule netdev filter input ip protocol tcp { ip saddr limit rate over
> 50/second burst 15 packets } update @glv4 { ip saddr }
> ^^^^^
>
> Is rate limiting not meant for the netdev chain or where do I go wrong
> with the syntax?
>
> ----
>
> (2) timeouts
>
> Like in the above statement is the timeout applicable to the entire set,
> i.e. the entire gets wiped after 15 min, or the timeout applies
> selectively to each entry?
>
> Perusing
> https://www.netfilter.org/projects/nftables/manpage.html#lbANhttps://www.netfilter.org/projects/nftables/manpage.html#lbAN
>
> /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
>
> /I fail to comprehend what the first statement (/timeout 10s/) achieves;
> what is the purpose?
>
> As for the second statement (/timeout 1m/) I am wondering whether it
> would clash with or supersede the statement in the set (e.g. /timeout
> 15m/ as in the above example)?
timeout in your rule (if specified), eg.
... update @xyz { ip saddr *timeout 1m* }
overrides the global set timeout policy.
next prev parent reply other threads:[~2020-09-23 8:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-22 22:49 [nftables] netdev rate limiting | timeouts rfq ѽ҉ᶬḳ℠
2020-09-23 8:30 ` Pablo Neira Ayuso [this message]
2020-09-28 11:02 ` ѽ҉ᶬḳ℠
2020-09-28 11:52 ` Pablo Neira Ayuso
2020-09-28 12:08 ` ѽ҉ᶬḳ℠
2020-09-28 12:24 ` Pablo Neira Ayuso
2020-09-28 13:10 ` ѽ҉ᶬḳ℠
2020-09-28 15:43 ` Pablo Neira Ayuso
2020-09-28 16:03 ` ѽ҉ᶬḳ℠
2020-09-28 16:23 ` Pablo Neira Ayuso
2020-09-28 16:47 ` ѽ҉ᶬḳ℠
2020-09-28 17:01 ` Pablo Neira Ayuso
2020-09-28 17:38 ` ѽ҉ᶬḳ℠
2020-09-28 17:56 ` Pablo Neira Ayuso
2020-09-28 18:15 ` ѽ҉ᶬḳ℠
2020-09-28 19:19 ` ѽ҉ᶬḳ℠
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=20200923083042.GB10267@salvia \
--to=pablo@netfilter.org \
--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