netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH nft 1/3] datatype: fix parsing of tchandle type
@ 2016-05-29 10:08 Liping Zhang
  2016-05-29 10:08 ` [PATCH nft 2/3] meta: fix endianness in priority Liping Zhang
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Liping Zhang @ 2016-05-29 10:08 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel, Liping Zhang

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(+)

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



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

end of thread, other threads:[~2016-05-30  9:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-29 10:08 [PATCH nft 1/3] datatype: fix parsing of tchandle type Liping Zhang
2016-05-29 10:08 ` [PATCH nft 2/3] meta: fix endianness in priority Liping Zhang
2016-05-30  9:58   ` Pablo Neira Ayuso
2016-05-29 10:08 ` [PATCH nft 3/3] meta: fix a format error display when we set priority to root or none Liping Zhang
2016-05-30  9:58   ` Pablo Neira Ayuso
2016-05-30  9:59 ` [PATCH nft 1/3] datatype: fix parsing of tchandle type 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).