All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Martin Zaharinov <micron10@gmail.com>
Cc: Florian Westphal <fw@strlen.de>,
	netfilter <netfilter@vger.kernel.org>,
	netfilter-devel@vger.kernel.org, pablo@netfilter.org
Subject: Re: bug report and future request
Date: Mon, 21 Mar 2022 22:27:50 +0100	[thread overview]
Message-ID: <20220321212750.GB24574@breakpoint.cc> (raw)
In-Reply-To: <AE6DAC96-EC3E-43C9-A95A-B230842DD7B1@gmail.com>

Martin Zaharinov <micron10@gmail.com> wrote:
> if have 1k rule
> 
> table inet nft-qos-static {
>         chain upload {
>                 type filter hook postrouting priority filter; policy accept;
>                 ip saddr 10.0.0.9 limit rate over 12 mbytes/second burst 50000 kbytes drop
> .........
> ip saddr 10.0.0.254 limit rate over 12 mbytes/second burst 50000 kbytes drop
>         }

1k rules? Thats insane.  Don't do that.
There is no need for that many rules, its also super slow.

Use a static/immutable ruleset with a named set and then add/remove elements from the set.

table inet nft-qos-static {
	set limit_ul {
		typeof ip saddr
		flags dynamic
		elements = { 10.0.0.9 limit rate over 12 mbytes/second burst 50000 kbytes, 10.0.0.254 limit rate over 12 mbytes/second burst 50000 kbytes }
	}

	chain upload {
		type filter hook postrouting priority filter; policy accept;
		ip saddr @limit_ul drop
	}
}

static ruleset: no need to add/delete a rule:

nft add element inet nft-qos-static limit_ul "{ 10.1.2.4 limit rate over 1 mbytes/second burst 1234 kbytes  }"
nft delete element inet nft-qos-static limit_ul "{ 10.1.2.4 limit rate over 1 mbytes/second burst 1234 kbytes }"

You can add/delete multiple elements in { }, sepearate by ",".


  reply	other threads:[~2022-03-21 23:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-21 20:44 bug report and future request Martin Zaharinov
2022-03-21 21:27 ` Florian Westphal [this message]
2022-03-22  7:14   ` Martin Zaharinov
2022-03-22 10:32     ` Florian Westphal
2022-03-22 22:55       ` Martin Zaharinov
2022-03-24  7:52         ` Martin Zaharinov
2022-03-24 12:09           ` Martin Zaharinov
2022-03-24 12:20             ` Pablo Neira Ayuso
2022-03-24 12:23               ` Martin Zaharinov
2022-03-24 21:43                 ` Martin Zaharinov
2022-04-05 14:12                 ` Martin Zaharinov
2022-04-05 14:12                   ` Martin Zaharinov

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=20220321212750.GB24574@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=micron10@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=netfilter@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.