Bug: nft cannot identify elements in set correctly
nft cannot identify elements in set correctly, look at the result of following commands.
[root@localhost ~]# nft add set ip filter servicelist {type inet_service \;} [root@localhost ~]# nft add element ip filter servicelist {ftp,ssh} <cmdline>:1:35-37: Error: syntax error, unexpected string, expecting '{' add element ip filter servicelist ftp ssh
^^^
[root@localhost ~]# nft add element ip filter servicelist {ftp, ssh}
There must be a space between ftp and ssh, otherwise bison ignores "{". But it's strange that this bug doesn't exist in interactive mode.
[root@localhost nftables]# nft -i
nft> delete element ip filter servicelist {ftp,ssh} nft> add element ip filter servicelist {ftp,ssh} nft>
nft> list table ip filter
table ip filter {
set servicelist {
type inet_service
elements = { ssh, ftp}
}
}nft>
What's the difference between shell mode and interactive mode? I thought they are the same except you don't need to type "nft" at the beginning of each command in interactive mode.
Florian Westphal
maintainerQuoted 4 lines · Yanchuan Nian
[root@localhost ~]# nft add set ip filter servicelist {type
inet_service\;} [root@localhost ~]# nft add element ip filter servicelist {ftp,ssh} <cmdline>:1:35-37: Error: syntax error, unexpected string, expecting '{' add element ip filter servicelist ftp ssh
Missing escape ("\{"), see echo foo{bar,baz}
Quoted 3 lines
[root@localhost ~]# nft add element ip filter servicelist {ftp, ssh}
There must be a space between ftp and ssh, otherwise bison ignores "{".
The { got removed by your shell before passing the arguments to nft.