netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH nft] parser_bison: keep snat/dnat existing syntax unchanged
@ 2016-08-22 15:34 Liping Zhang
  2016-08-22 16:14 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Liping Zhang @ 2016-08-22 15:34 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel, Liping Zhang

From: Liping Zhang <liping.zhang@spreadtrum.com>

We should keep existing syntax unchanged, and this was emphasized
in the commit 850f0a56b6ad ("src: add 'to' for snat and dnat")'s
commit log: "Existing syntax is still preserved, but the listing
shows the one including 'to'."

This problem was found by running shell test:
  # ./run-tests.sh
  [ ... ]
  W: [FAILED]	./testcases/maps/anonymous_snat_map_0
  I: [OK]		./testcases/maps/map_with_flags_0
  W: [FAILED]	./testcases/maps/named_snat_map_0
  [ ... ]

Fixes: 850f0a56b6ad ("src: add 'to' for snat and dnat")
Signed-off-by: Liping Zhang <liping.zhang@spreadtrum.com>
---
 src/parser_bison.y | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/parser_bison.y b/src/parser_bison.y
index 8025415..bf43608 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -1649,15 +1649,28 @@ stmt_expr		:	map_stmt_expr
 			|	primary_rhs_expr
 			;
 
-nat_stmt_args		:	TO	stmt_expr
+nat_stmt_args		:	stmt_expr
+			{
+				$<stmt>0->nat.addr = $1;
+			}
+			|	TO	stmt_expr
 			{
 				$<stmt>0->nat.addr = $2;
 			}
+			|	stmt_expr	COLON	stmt_expr
+			{
+				$<stmt>0->nat.addr = $1;
+				$<stmt>0->nat.proto = $3;
+			}
 			|	TO	stmt_expr	COLON	stmt_expr
 			{
 				$<stmt>0->nat.addr = $2;
 				$<stmt>0->nat.proto = $4;
 			}
+			|	COLON		stmt_expr
+			{
+				$<stmt>0->nat.proto = $2;
+			}
 			|	TO	COLON		stmt_expr
 			{
 				$<stmt>0->nat.proto = $3;
-- 
2.5.5



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

* Re: [PATCH nft] parser_bison: keep snat/dnat existing syntax unchanged
  2016-08-22 15:34 [PATCH nft] parser_bison: keep snat/dnat existing syntax unchanged Liping Zhang
@ 2016-08-22 16:14 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2016-08-22 16:14 UTC (permalink / raw)
  To: Liping Zhang; +Cc: netfilter-devel, Liping Zhang

On Mon, Aug 22, 2016 at 11:34:15PM +0800, Liping Zhang wrote:
> From: Liping Zhang <liping.zhang@spreadtrum.com>
> 
> We should keep existing syntax unchanged, and this was emphasized
> in the commit 850f0a56b6ad ("src: add 'to' for snat and dnat")'s
> commit log: "Existing syntax is still preserved, but the listing
> shows the one including 'to'."
> 
> This problem was found by running shell test:
>   # ./run-tests.sh
>   [ ... ]
>   W: [FAILED]	./testcases/maps/anonymous_snat_map_0
>   I: [OK]		./testcases/maps/map_with_flags_0
>   W: [FAILED]	./testcases/maps/named_snat_map_0
>   [ ... ]

Applied, thanks!

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

end of thread, other threads:[~2016-08-22 16:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-22 15:34 [PATCH nft] parser_bison: keep snat/dnat existing syntax unchanged Liping Zhang
2016-08-22 16:14 ` Pablo Neira Ayuso

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