]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
parser: add a time_spec rule
authorPatrick McHardy <kaber@trash.net>
Sat, 11 Apr 2015 14:41:32 +0000 (15:41 +0100)
committerPatrick McHardy <kaber@trash.net>
Sun, 12 Apr 2015 18:59:27 +0000 (19:59 +0100)
Signed-off-by: Patrick McHardy <kaber@trash.net>
src/parser_bison.y

index b86381d97ef3f8aa522da29b6a03c64f3de8be37..cd4e096a85f9f399ffb4b6e51124db9ad8b745c0 100644 (file)
@@ -396,6 +396,8 @@ static void location_update(struct location *loc, struct location *rhs, int n)
 %type <string>                 identifier string comment_spec
 %destructor { xfree($$); }     identifier string comment_spec
 
+%type <val>                    time_spec
+
 %type <val>                    type_identifier
 %type <datatype>               data_type
 
@@ -1093,6 +1095,20 @@ string                   :       STRING
                        |       QUOTED_STRING
                        ;
 
+time_spec              :       STRING
+                       {
+                               struct error_record *erec;
+                               uint64_t res;
+
+                               erec = time_parse(&@1, $1, &res);
+                               if (erec != NULL) {
+                                       erec_queue(erec, state->msgs);
+                                       YYERROR;
+                               }
+                               $$ = res;
+                       }
+                       ;
+
 family_spec            :       /* empty */             { $$ = NFPROTO_IPV4; }
                        |       family_spec_explicit
                        ;