Linux Netfilter discussions
 help / color / mirror / Atom feed
* Dynamically appending addresses to a named set
@ 2025-03-12 16:08 Lars Noodén
  2025-03-12 19:44 ` Kerin Millar
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Noodén @ 2025-03-12 16:08 UTC (permalink / raw)
  To: Linux Netfilter Users List

Hello,

In NFTables, I have created a named set called 'bar' in the chain input
in the table foo.  I can add elements to the set manually,

# nft add element ip foo bar { 192.168.2.2 }

However, I am not able to guess the syntax to have a regular NFTables
rule do the appending automatically.  I've tried a lot of permutations
of the following, but always with fatal errors,

# nft add rule foo input tcp dport 22 counter add @bar { ip saddr }
Error: Could not process rule: Operation not supported
add rule foo input tcp dport 22 counter add @bar { ip saddr }

# nft add rule foo input tcp dport 22 add element @bar { ip saddr }
Error: syntax error, unexpected element, expecting @ or '$'
add rule foo input tcp dport 22 add element @bar { ip saddr }

What would be the correct syntax to have a rule which automatically adds
a source IP address to the named set when certain conditions are met?

/Lars

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-03-14  6:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-12 16:08 Dynamically appending addresses to a named set Lars Noodén
2025-03-12 19:44 ` Kerin Millar
2025-03-12 19:48   ` Pablo Neira Ayuso
2025-03-12 21:50     ` Kerin Millar
2025-03-12 22:06       ` Pablo Neira Ayuso
2025-03-13  4:31         ` Lars Noodén
2025-03-13  8:59           ` Pablo Neira Ayuso
2025-03-14  6:12             ` Lars Noodén

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox