Linux Netfilter discussions
 help / color / mirror / Atom feed
From: pauloric@contatogs.com.br
To: netfilter <netfilter@vger.kernel.org>
Subject: Re: Automatically maintaining unique list of addresses
Date: Wed, 19 Feb 2020 08:01:33 -0300 (BRT)	[thread overview]
Message-ID: <1503010567.303.1582110093370.JavaMail.zimbra@contatogs.com.br> (raw)
In-Reply-To: <ab8bf7b2-d135-2e4b-b9a9-7c917f113ddf@gmx.com>

Hi

You can use named sets ( https://wiki.nftables.org/wiki-nftables/index.php/Sets)
 or 
a dictionary...(https://wiki.nftables.org/wiki-nftables/index.php/Dictionaries) 

I think the best would be dictionaries...80)

best regards


----- Mensagem original -----
De: "Lars Noodén" <lars.nooden@gmx.com>
Para: "netfilter" <netfilter@vger.kernel.org>
Enviadas: Quarta-feira, 19 de fevereiro de 2020 4:44:51
Assunto: Automatically maintaining unique list of addresses

If I add an IP address multiple times, I end up with it in the ruleset
three times.  Is there an easy way to try to add IP addresses such that
they aren't duplicated?

/Lars

$ sudo nft add rule ip filter4 input ip \
	saddr 198.51.100.209 counter reject

$ sudo nft add rule ip filter4 input ip \
	saddr 198.51.100.209 counter reject

$ sudo nft add rule ip filter4 input ip \
	saddr 198.51.100.209 counter reject

$ sudo nft list ruleset| grep 51
                ip saddr 198.51.100.209 counter packets 0 bytes 0 reject
                ip saddr 198.51.100.209 counter packets 0 bytes 0 reject
                ip saddr 198.51.100.209 counter packets 0 bytes 0 reject
-- 
Paulo Ricardo Bruck consultor 
tel 011 3596-4881 011 98140-9184(TIM/Whats) 
[ http://www.contatogs.com.br/ | http://www.contatogs.com.br ] 
gpg AAA59989 at wwwkeys.us.pgp.net 
skype: suportecontatogs

  reply	other threads:[~2020-02-19 11:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-19  7:44 Automatically maintaining unique list of addresses Lars Noodén
2020-02-19 11:01 ` pauloric [this message]
2020-02-19 11:39   ` Lars Noodén

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=1503010567.303.1582110093370.JavaMail.zimbra@contatogs.com.br \
    --to=pauloric@contatogs.com.br \
    --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