]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
parser_bison: allow to use mark as datatype for maps and sets
authorPablo Neira Ayuso <pablo@netfilter.org>
Tue, 16 Jun 2015 15:49:22 +0000 (17:49 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 16 Jun 2015 15:53:18 +0000 (17:53 +0200)
Update the grammar to accept a MARK token as datatype.

Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1012
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/parser_bison.y

index eac3fcbeb638003042ae2d343032b629b037985f..5c4e2727b9df406fd35109bebc2d128ffe8fd05f 100644 (file)
@@ -396,12 +396,12 @@ static void location_update(struct location *loc, struct location *rhs, int n)
 %token XML                     "xml"
 %token JSON                    "json"
 
-%type <string>                 identifier string comment_spec
-%destructor { xfree($$); }     identifier string comment_spec
+%type <string>                 identifier type_identifier string comment_spec
+%destructor { xfree($$); }     identifier type_identifier string comment_spec
 
 %type <val>                    time_spec
 
-%type <val>                    type_identifier
+%type <val>                    type_identifier_list
 %type <datatype>               data_type
 
 %type <cmd>                    line
@@ -1025,7 +1025,7 @@ set_policy_spec           :       PERFORMANCE     { $$ = NFT_SET_POL_PERFORMANCE; }
                        |       MEMORY          { $$ = NFT_SET_POL_MEMORY; }
                        ;
 
-data_type              :       type_identifier
+data_type              :       type_identifier_list
                        {
                                if ($1 & ~TYPE_MASK)
                                        $$ = concat_type_alloc($1);
@@ -1034,7 +1034,7 @@ data_type         :       type_identifier
                        }
                        ;
 
-type_identifier                :       identifier
+type_identifier_list   :       type_identifier
                        {
                                const struct datatype *dtype = datatype_lookup_byname($1);
                                if (dtype == NULL) {
@@ -1044,7 +1044,7 @@ type_identifier           :       identifier
                                }
                                $$ = dtype->type;
                        }
-                       |       type_identifier DOT             identifier
+                       |       type_identifier_list    DOT     type_identifier
                        {
                                const struct datatype *dtype = datatype_lookup_byname($3);
                                if (dtype == NULL) {
@@ -1056,6 +1056,10 @@ type_identifier          :       identifier
                        }
                        ;
 
+type_identifier                :       STRING  { $$ = $1; }
+                       |       MARK    { $$ = xstrdup("mark"); }
+                       ;
+
 hook_spec              :       TYPE            STRING          HOOK            STRING          PRIORITY        NUM
                        {
                                $<chain>0->type         = chain_type_name_lookup($2);