diff mbox

[nft,1/3] datatype: fix parsing of tchandle type

Message ID 1464516489-21616-1-git-send-email-zlpnobody@163.com
State Deferred
Delegated to: Pablo Neira
Headers show

Commit Message

Liping Zhang May 29, 2016, 10:08 a.m. UTC
From: Liping Zhang <liping.zhang@spreadtrum.com>

Properly detect tchandle strings in the lexer without quotation marks,
otherwise nft will complain the syntax error like this:

  # nft add rule filter test meta priority set 1:2
  <cmdline>:1:41-41: Error: syntax error, unexpected colon, expecting end of file or newline or semicolon
  add rule filter test meta priority set 1:2
                                          ^

Signed-off-by: Liping Zhang <liping.zhang@spreadtrum.com>
---
 src/scanner.l | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Pablo Neira Ayuso May 30, 2016, 9:59 a.m. UTC | #1
On Sun, May 29, 2016 at 06:08:07PM +0800, Liping Zhang wrote:
> From: Liping Zhang <liping.zhang@spreadtrum.com>
> 
> Properly detect tchandle strings in the lexer without quotation marks,
> otherwise nft will complain the syntax error like this:
> 
>   # nft add rule filter test meta priority set 1:2
>   <cmdline>:1:41-41: Error: syntax error, unexpected colon, expecting end of file or newline or semicolon
>   add rule filter test meta priority set 1:2
>                                           ^

This is breaking several tests under tests/py/ (see nft-tests.py
script), so I'll keep this back by now. Let me have a look into this.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/src/scanner.l b/src/scanner.l
index b022114..9ca6d4d 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -120,6 +120,8 @@  slash		\/
 
 timestring	([0-9]+d)?([0-9]+h)?([0-9]+m)?([0-9]+s)?
 
+tchstring	([[:xdigit:]]{0,4}:[[:xdigit:]]{0,4})
+
 hex4		([[:xdigit:]]{1,4})
 v680		(({hex4}:){7}{hex4})
 v670		((:)((:{hex4}){7}))
@@ -479,6 +481,11 @@  addrstring	({macaddr}|{ip4addr}|{ip6addr})
 				return STRING;
 			}
 
+{tchstring}		{
+				yylval->string = xstrdup(yytext);
+				return STRING;
+			}
+
 {decstring}		{
 				errno = 0;
 				yylval->val = strtoull(yytext, NULL, 0);