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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Liping Zhang <liping.zhang@xxxxxxxxxxxxxx>

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@xxxxxxxxxxxxxx>
---
 src/scanner.l | 7 +++++++
 1 file changed, 7 insertions(+)

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);
-- 
2.5.5


--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux