All of lore.kernel.org
 help / color / mirror / Atom feed
* nftables: Add anonymous set to named set
@ 2016-10-18 20:52 Leon Merten Lohse
  2016-10-20 15:11   ` Pablo Neira Ayuso
  0 siblings, 1 reply; 3+ messages in thread
From: Leon Merten Lohse @ 2016-10-18 20:52 UTC (permalink / raw)
  To: netfilter

Hi,

I am trying to add an anonymous set that is defined as a variable to a
named set as follows:

define whitelist_v4 = { 1.1.1.1}

table inet filter {
  set whitelist_v4 { type ipv4_addr; }
 
  [ ... ]
}

add element inet filter whitelist_v4 $whitelist_v4

This produces the error:

./testfw.ruleset:290:38-38: Error: syntax error, unexpected '$',
expecting '{' add element inet filter whitelist_v4 $whitelist_v4
                                     ^
If I use curly braces instead, there is no error but a failed assertion:
add element inet filter whitelist_v4 {$whitelist_v4}

produces

BUG: invalid data expression type set
nft: netlink.c:337: netlink_gen_data: Assertion `0' failed.

What is the correct way to use this?

Note: Direct definition as `elements = ...` shows the same behaviour.

The reason I am using this is because I need the whitelist in the nat
(ip) and the filter (inet) table. Yes I could use the anonymous set
directly but that would imho make the rules less readable.

System:
# nft --version
nftables v0.6 (Support Edward Snowden)
# uname -a
Linux maracuja 4.7.0-0.bpo.1-amd64 #1 SMP Debian 4.7.5-1~bpo8+2
(2016-10-01) x86_64 GNU/Linux

Thanks in advance.

Best
Leon

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

end of thread, other threads:[~2016-10-20 15:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-18 20:52 nftables: Add anonymous set to named set Leon Merten Lohse
2016-10-20 15:11 ` Pablo Neira Ayuso
2016-10-20 15:11   ` Pablo Neira Ayuso

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.