From b5dff507ccd1c666210de51af83fa730d6baf50a Mon Sep 17 00:00:00 2001 From: Arturo Borrero Date: Fri, 7 Nov 2014 12:39:35 +0100 Subject: parser: allow both nat_flags and port specification in redirect This patch changes the parser to permit both nat_flags and port specification in the redirect expression. The resulting syntax is: % nft add rule nat prerouting redirect [port] [nat_flags] The port specification requires a bit of context regardin the transport protocol. Some examples: % nft add rule nat prerouting tcp dport 22 redirect :23 % nft add rule add prerouting udp dport 53 redirect :5353 The nat_flags argument is the last argument: % nft add rule nat prerouting tdp dport 80 redirect :8080 random The port specification can be a range: % nft add rule nat prerouting tcp dport 80 redirect :8080-8090 random While at it, the regression tests files are updated. Suggested-by: Pablo Neira Ayuso Signed-off-by: Arturo Borrero Gonzalez Signed-off-by: Pablo Neira Ayuso --- src/parser.y | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/parser.y b/src/parser.y index 6209e9eb..3992c6a5 100644 --- a/src/parser.y +++ b/src/parser.y @@ -1437,6 +1437,11 @@ redir_stmt_arg : COLON expr { $0->redir.flags = $1; } + | COLON expr nf_nat_flags + { + $0->redir.proto = $2; + $0->redir.flags = $3; + } ; nf_nat_flags : nf_nat_flag -- cgit v1.2.3