public inbox for netfilter@vger.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Slavko <linux@slavino.sk>
Cc: netfilter ML <netfilter@vger.kernel.org>
Subject: Re: set with limit
Date: Wed, 20 Nov 2024 22:49:31 +0100	[thread overview]
Message-ID: <Zz5Za-zEmfGg942e@calendula> (raw)
In-Reply-To: <fd59a4c5-0063-4b32-93e5-e078a44270e8@slavino.sk>

On Wed, Nov 20, 2024 at 09:17:13AM +0100, Slavko wrote:
> Dňa 19. 11. o 19:00 Slavko napísal(a):
> > On 19. novembra 2024 16:06:17 UTC, Florian Westphal <fw@strlen.de> wrote:
> > 
> > > Looks like 5.10 is too old, listing should show limit expression was
> > > attached, i.e.:
> > 
> > Thanks, i will try with meter tomorrow...
> 
> Yes, with meter it works:
> 
>     nft list meter inet filter base_log4
>     table inet filter {
>         meter base_log4 {
>                 type ipv4_addr
>                 size 65535
>                 flags dynamic,timeout
>                 elements = { 10.60.65.78 limit rate 1/minute burst 2
>                              packets timeout 1h expires 59m58s208ms }
>         }
>     }

According to your original example, you could use:

     set log_base4 {
         typeof ip saddr
         size 1000
         flags dynamic,timeout
         limit rate 1/minute burst 2 packets
         timeout 1h
         comment "IPv4 base log limit"
     }

     chain input {
         type filter hook input priority filter + 5; policy accept;
         ...
         update @log_base4 { ip saddr limit rate 1/minute burst 2 packets } log group 0
     }

ie. replace

       update @log_base4 { ip saddr } log group 0

by:

       update @log_base4 { ip saddr limit rate 1/minute burst 2 packets } log group 0

5.10 is lacking this patch:

commit fca05d4d61e65fa573a3768f9019a42143c03349
Author: Pablo Neira Ayuso <pablo@netfilter.org>
Date:   Sat Jan 16 12:26:46 2021 +0100

    netfilter: nft_dynset: honor stateful expressions in set definition

      reply	other threads:[~2024-11-20 21:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-19 12:03 set with limit Slavko
2024-11-19 16:06 ` Florian Westphal
2024-11-19 18:00   ` Slavko
2024-11-20  8:17     ` Slavko
2024-11-20 21:49       ` Pablo Neira Ayuso [this message]

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=Zz5Za-zEmfGg942e@calendula \
    --to=pablo@netfilter.org \
    --cc=linux@slavino.sk \
    --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