netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Bug: nft cannot identify elements in set correctly
@ 2014-08-11  9:18 Yanchuan Nian
  2014-08-11  9:32 ` Florian Westphal
  0 siblings, 1 reply; 2+ messages in thread
From: Yanchuan Nian @ 2014-08-11  9:18 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel, Yanchuan Nian

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.

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

* Re: Bug: nft cannot identify elements in set correctly
  2014-08-11  9:18 Bug: nft cannot identify elements in set correctly Yanchuan Nian
@ 2014-08-11  9:32 ` Florian Westphal
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Westphal @ 2014-08-11  9:32 UTC (permalink / raw)
  To: Yanchuan Nian; +Cc: pablo, netfilter-devel

Yanchuan Nian <ycnian@gmail.com> wrote:
> [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}

> [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.

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

end of thread, other threads:[~2014-08-11  9:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-11  9:18 Bug: nft cannot identify elements in set correctly Yanchuan Nian
2014-08-11  9:32 ` Florian Westphal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).