From patchwork Tue Sep 26 17:09:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pablo Neira Ayuso X-Patchwork-Id: 818741 X-Patchwork-Delegate: pablo@netfilter.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netfilter-devel-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3y1nWZ30xsz9rxl for ; Wed, 27 Sep 2017 03:10:02 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937283AbdIZRKB (ORCPT ); Tue, 26 Sep 2017 13:10:01 -0400 Received: from mail.us.es ([193.147.175.20]:51630 "EHLO mail.us.es" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935589AbdIZRJ7 (ORCPT ); Tue, 26 Sep 2017 13:09:59 -0400 Received: from antivirus1-rhel7.int (unknown [192.168.2.11]) by mail.us.es (Postfix) with ESMTP id F3EED220B5 for ; Tue, 26 Sep 2017 19:09:57 +0200 (CEST) Received: from antivirus1-rhel7.int (localhost [127.0.0.1]) by antivirus1-rhel7.int (Postfix) with ESMTP id E569EB502A for ; Tue, 26 Sep 2017 19:09:57 +0200 (CEST) Received: by antivirus1-rhel7.int (Postfix, from userid 99) id DAF30B5029; Tue, 26 Sep 2017 19:09:57 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on antivirus1-rhel7.int X-Spam-Level: X-Spam-Status: No, score=-108.2 required=7.5 tests=ALL_TRUSTED,BAYES_50, SMTPAUTH_US2,USER_IN_WHITELIST autolearn=disabled version=3.4.1 Received: from antivirus1-rhel7.int (localhost [127.0.0.1]) by antivirus1-rhel7.int (Postfix) with ESMTP id 8F21AB502E; Tue, 26 Sep 2017 19:09:55 +0200 (CEST) Received: from 192.168.1.97 (192.168.1.97) by antivirus1-rhel7.int (F-Secure/fsigk_smtp/550/antivirus1-rhel7.int); Tue, 26 Sep 2017 19:09:55 +0200 (CEST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/antivirus1-rhel7.int) Received: from salvia.here (129.166.216.87.static.jazztel.es [87.216.166.129]) (Authenticated sender: pneira@us.es) by entrada.int (Postfix) with ESMTPA id 4D5AA44581E0; Tue, 26 Sep 2017 19:09:55 +0200 (CEST) X-SMTPAUTHUS: auth mail.us.es From: Pablo Neira Ayuso To: netfilter-devel@vger.kernel.org Cc: fw@strlen.de Subject: [PATCH nft 1/3] parser_bison: consolidate stmt_expr rule Date: Tue, 26 Sep 2017 19:09:49 +0200 Message-Id: <1506445791-20482-1-git-send-email-pablo@netfilter.org> X-Mailer: git-send-email 2.1.4 X-Virus-Scanned: ClamAV using ClamSMTP Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org Extend stmt_expr and use it from all of our statement rules. Add more rules to describe what we take from statement expressions, instead of reusing rhs_expr which is allowing way more things that we actually need here. This is causing us problems when extending the grammar. After this patch, you will hit this: parser_bison.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr] However, this is fixed by the follow up patches: parser_bison: allow helper keyword in ct object kind parser_bison: use keywords in ct expression Signed-off-by: Pablo Neira Ayuso --- src/parser_bison.y | 123 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 102 insertions(+), 21 deletions(-) diff --git a/src/parser_bison.y b/src/parser_bison.y index 31a7e8be2bcd..8bcf64e9903d 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -560,6 +560,18 @@ static void location_update(struct location *loc, struct location *rhs, int n) %type stmt_expr concat_stmt_expr map_stmt_expr %destructor { expr_free($$); } stmt_expr concat_stmt_expr map_stmt_expr +%type multiton_stmt_expr +%destructor { expr_free($$); } multiton_stmt_expr +%type prefix_stmt_expr range_stmt_expr wildcard_stmt_expr +%destructor { expr_free($$); } prefix_stmt_expr range_stmt_expr wildcard_stmt_expr + +%type primary_stmt_expr basic_stmt_expr +%destructor { expr_free($$); } primary_stmt_expr basic_stmt_expr +%type list_stmt_expr shift_stmt_expr +%destructor { expr_free($$); } list_stmt_expr shift_stmt_expr +%type and_stmt_expr exclusive_or_stmt_expr inclusive_or_stmt_expr +%destructor { expr_free($$); } and_stmt_expr exclusive_or_stmt_expr inclusive_or_stmt_expr + %type concat_expr %destructor { expr_free($$); } concat_expr @@ -644,11 +656,8 @@ static void location_update(struct location *loc, struct location *rhs, int n) %destructor { expr_free($$); } rt_expr %type rt_key -%type list_stmt_expr -%destructor { expr_free($$); } list_stmt_expr - -%type ct_expr ct_stmt_expr -%destructor { expr_free($$); } ct_expr ct_stmt_expr +%type ct_expr +%destructor { expr_free($$); } ct_expr %type ct_key ct_key_dir ct_key_dir_optional %type fib_expr @@ -2206,8 +2215,55 @@ nat_stmt_alloc : SNAT } ; -concat_stmt_expr : primary_expr - | concat_stmt_expr DOT primary_expr +primary_stmt_expr : symbol_expr { $$ = $1; } + | integer_expr { $$ = $1; } + | boolean_expr { $$ = $1; } + | meta_expr { $$ = $1; } + | rt_expr { $$ = $1; } + | ct_expr { $$ = $1; } + | numgen_expr { $$ = $1; } + | hash_expr { $$ = $1; } + | payload_expr { $$ = $1; } + | keyword_rhs_expr { $$ = $1; } + ; + +shift_stmt_expr : primary_stmt_expr + | shift_stmt_expr LSHIFT primary_stmt_expr + { + $$ = binop_expr_alloc(&@$, OP_LSHIFT, $1, $3); + } + | shift_stmt_expr RSHIFT primary_rhs_expr + { + $$ = binop_expr_alloc(&@$, OP_RSHIFT, $1, $3); + } + ; + +and_stmt_expr : shift_stmt_expr + | and_stmt_expr AMPERSAND shift_stmt_expr + { + $$ = binop_expr_alloc(&@$, OP_AND, $1, $3); + } + ; + +exclusive_or_stmt_expr : and_stmt_expr + | exclusive_or_stmt_expr CARET and_stmt_expr + { + $$ = binop_expr_alloc(&@$, OP_XOR, $1, $3); + } + ; + +inclusive_or_stmt_expr : exclusive_or_stmt_expr + | inclusive_or_stmt_expr '|' exclusive_or_stmt_expr + { + $$ = binop_expr_alloc(&@$, OP_OR, $1, $3); + } + ; + +basic_stmt_expr : inclusive_or_stmt_expr + ; + +concat_stmt_expr : basic_stmt_expr + | concat_stmt_expr DOT primary_stmt_expr { if ($$->ops->type != EXPR_CONCAT) { $$ = concat_expr_alloc(&@$); @@ -2226,15 +2282,44 @@ concat_stmt_expr : primary_expr } ; -map_stmt_expr : concat_stmt_expr MAP rhs_expr +map_stmt_expr : concat_stmt_expr MAP set_expr { $$ = map_expr_alloc(&@$, $1, $3); } + | concat_stmt_expr { $$ = $1; } + ; + +prefix_stmt_expr : basic_stmt_expr SLASH NUM + { + $$ = prefix_expr_alloc(&@$, $1, $3); + } + ; + +range_stmt_expr : basic_stmt_expr DASH basic_stmt_expr + { + $$ = range_expr_alloc(&@$, $1, $3); + } + ; + +wildcard_stmt_expr : ASTERISK + { + struct expr *expr; + + expr = constant_expr_alloc(&@$, &integer_type, + BYTEORDER_HOST_ENDIAN, + 0, NULL); + $$ = prefix_expr_alloc(&@$, expr, 0); + } + ; + +multiton_stmt_expr : prefix_stmt_expr + | range_stmt_expr + | wildcard_stmt_expr ; stmt_expr : map_stmt_expr - | multiton_rhs_expr - | primary_rhs_expr + | multiton_stmt_expr + | list_stmt_expr ; nat_stmt_args : stmt_expr @@ -3148,15 +3233,15 @@ meta_key_unqualified : MARK { $$ = NFT_META_MARK; } | CGROUP { $$ = NFT_META_CGROUP; } ; -meta_stmt : META meta_key SET expr +meta_stmt : META meta_key SET stmt_expr { $$ = meta_stmt_alloc(&@$, $2, $4); } - | meta_key_unqualified SET expr + | meta_key_unqualified SET stmt_expr { $$ = meta_stmt_alloc(&@$, $1, $3); } - | META STRING SET expr + | META STRING SET stmt_expr { struct error_record *erec; unsigned int key; @@ -3285,15 +3370,11 @@ list_stmt_expr : symbol_expr COMMA symbol_expr } ; -ct_stmt_expr : expr - | list_stmt_expr - ; - -ct_stmt : CT ct_key SET expr +ct_stmt : CT ct_key SET stmt_expr { $$ = ct_stmt_alloc(&@$, $2, -1, $4); } - | CT STRING SET ct_stmt_expr + | CT STRING SET stmt_expr { struct error_record *erec; unsigned int key; @@ -3316,7 +3397,7 @@ ct_stmt : CT ct_key SET expr break; } } - | CT STRING ct_key_dir_optional SET expr + | CT STRING ct_key_dir_optional SET stmt_expr { struct error_record *erec; int8_t direction; @@ -3332,7 +3413,7 @@ ct_stmt : CT ct_key SET expr } ; -payload_stmt : payload_expr SET expr +payload_stmt : payload_expr SET stmt_expr { if ($1->ops->type == EXPR_EXTHDR) $$ = exthdr_stmt_alloc(&@$, $1, $3); From patchwork Tue Sep 26 17:09:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pablo Neira Ayuso X-Patchwork-Id: 818743 X-Patchwork-Delegate: pablo@netfilter.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netfilter-devel-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3y1nWc64C1z9rxl for ; Wed, 27 Sep 2017 03:10:04 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964775AbdIZRKB (ORCPT ); Tue, 26 Sep 2017 13:10:01 -0400 Received: from mail.us.es ([193.147.175.20]:51636 "EHLO mail.us.es" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S937278AbdIZRKA (ORCPT ); Tue, 26 Sep 2017 13:10:00 -0400 Received: from antivirus1-rhel7.int (unknown [192.168.2.11]) by mail.us.es (Postfix) with ESMTP id 2DBB7220BC for ; Tue, 26 Sep 2017 19:09:59 +0200 (CEST) Received: from antivirus1-rhel7.int (localhost [127.0.0.1]) by antivirus1-rhel7.int (Postfix) with ESMTP id 1B6E5C882F for ; Tue, 26 Sep 2017 19:09:59 +0200 (CEST) Received: by antivirus1-rhel7.int (Postfix, from userid 99) id 1AD0C35BA; Tue, 26 Sep 2017 19:09:59 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on antivirus1-rhel7.int X-Spam-Level: X-Spam-Status: No, score=-108.2 required=7.5 tests=ALL_TRUSTED,BAYES_50, SMTPAUTH_US2,USER_IN_WHITELIST autolearn=disabled version=3.4.1 Received: from antivirus1-rhel7.int (localhost [127.0.0.1]) by antivirus1-rhel7.int (Postfix) with ESMTP id DCC74B5024; Tue, 26 Sep 2017 19:09:56 +0200 (CEST) Received: from 192.168.1.97 (192.168.1.97) by antivirus1-rhel7.int (F-Secure/fsigk_smtp/550/antivirus1-rhel7.int); Tue, 26 Sep 2017 19:09:56 +0200 (CEST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/antivirus1-rhel7.int) Received: from salvia.here (129.166.216.87.static.jazztel.es [87.216.166.129]) (Authenticated sender: pneira@us.es) by entrada.int (Postfix) with ESMTPA id 867D344581E0; Tue, 26 Sep 2017 19:09:56 +0200 (CEST) X-SMTPAUTHUS: auth mail.us.es From: Pablo Neira Ayuso To: netfilter-devel@vger.kernel.org Cc: fw@strlen.de Subject: [PATCH nft 2/3] parser_bison: use keywords in ct expression Date: Tue, 26 Sep 2017 19:09:50 +0200 Message-Id: <1506445791-20482-2-git-send-email-pablo@netfilter.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1506445791-20482-1-git-send-email-pablo@netfilter.org> References: <1506445791-20482-1-git-send-email-pablo@netfilter.org> X-Virus-Scanned: ClamAV using ClamSMTP Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org Using string give us more chances to hit shift/reduce conflicts when extending this grammar, more specifically, from the stmt_expr rule, so add keywords for this. Signed-off-by: Pablo Neira Ayuso --- src/parser_bison.y | 89 +++++++++++++++++++++--------------------------------- src/scanner.l | 9 ++++++ 2 files changed, 44 insertions(+), 54 deletions(-) diff --git a/src/parser_bison.y b/src/parser_bison.y index 8bcf64e9903d..351b51010f59 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -386,6 +386,15 @@ static void location_update(struct location *loc, struct location *rhs, int n) %token PROTO_SRC "proto-src" %token PROTO_DST "proto-dst" %token ZONE "zone" +%token DIRECTION "direction" +%token EVENT "event" +%token EXPIRATION "expiration" +%token HELPER "helper" +%token LABEL "label" +%token STATE "state" +%token STATUS "status" +%token ORIGINAL "original" +%token REPLY "reply" %token COUNTER "counter" %token NAME "name" @@ -658,7 +667,7 @@ static void location_update(struct location *loc, struct location *rhs, int n) %type ct_expr %destructor { expr_free($$); } ct_expr -%type ct_key ct_key_dir ct_key_dir_optional +%type ct_key ct_dir ct_key_dir_optional ct_key_dir %type fib_expr %destructor { expr_free($$); } fib_expr @@ -3061,6 +3070,9 @@ keyword_rhs_expr : ETHER { $$ = symbol_value(&@$, "ether"); } | SNAT { $$ = symbol_value(&@$, "snat"); } | ECN { $$ = symbol_value(&@$, "ecn"); } | RESET { $$ = symbol_value(&@$, "reset"); } + | ORIGINAL { $$ = symbol_value(&@$, "original"); } + | REPLY { $$ = symbol_value(&@$, "reply"); } + | LABEL { $$ = symbol_value(&@$, "label"); } ; primary_rhs_expr : symbol_expr { $$ = $1; } @@ -3306,41 +3318,33 @@ ct_expr : CT ct_key { $$ = ct_expr_alloc(&@$, $2, -1); } - | CT STRING + | CT ct_dir ct_key_dir { - struct error_record *erec; - unsigned int key; - - erec = ct_key_parse(&@$, $2, &key); - xfree($2); - if (erec != NULL) { - erec_queue(erec, state->msgs); - YYERROR; - } - - $$ = ct_expr_alloc(&@$, key, -1); + $$ = ct_expr_alloc(&@$, $3, $2); } - | CT STRING ct_key_dir - { - struct error_record *erec; - int8_t direction; - - erec = ct_dir_parse(&@$, $2, &direction); - xfree($2); - if (erec != NULL) { - erec_queue(erec, state->msgs); - YYERROR; - } + ; - $$ = ct_expr_alloc(&@$, $3, direction); - } +ct_dir : ORIGINAL { $$ = IP_CT_DIR_ORIGINAL; } + | REPLY { $$ = IP_CT_DIR_REPLY; } ; ct_key : L3PROTOCOL { $$ = NFT_CT_L3PROTOCOL; } | PROTOCOL { $$ = NFT_CT_PROTOCOL; } | MARK { $$ = NFT_CT_MARK; } + | STATE { $$ = NFT_CT_STATE; } + | DIRECTION { $$ = NFT_CT_DIRECTION; } + | STATUS { $$ = NFT_CT_STATUS; } + | EXPIRATION { $$ = NFT_CT_EXPIRATION; } + | HELPER { $$ = NFT_CT_HELPER; } + | SADDR { $$ = NFT_CT_SRC; } + | DADDR { $$ = NFT_CT_DST; } + | PROTO_SRC { $$ = NFT_CT_PROTO_SRC; } + | PROTO_DST { $$ = NFT_CT_PROTO_DST; } + | LABEL { $$ = NFT_CT_LABELS; } + | EVENT { $$ = NFT_CT_EVENTMASK; } | ct_key_dir_optional ; + ct_key_dir : SADDR { $$ = NFT_CT_SRC; } | DADDR { $$ = NFT_CT_DST; } | L3PROTOCOL { $$ = NFT_CT_L3PROTOCOL; } @@ -3356,6 +3360,7 @@ ct_key_dir_optional : BYTES { $$ = NFT_CT_BYTES; } | ZONE { $$ = NFT_CT_ZONE; } ; + list_stmt_expr : symbol_expr COMMA symbol_expr { $$ = list_expr_alloc(&@$); @@ -3372,44 +3377,20 @@ list_stmt_expr : symbol_expr COMMA symbol_expr ct_stmt : CT ct_key SET stmt_expr { - $$ = ct_stmt_alloc(&@$, $2, -1, $4); - } - | CT STRING SET stmt_expr - { - struct error_record *erec; - unsigned int key; - - erec = ct_key_parse(&@$, $2, &key); - xfree($2); - if (erec != NULL) { - erec_queue(erec, state->msgs); - YYERROR; - } - - switch (key) { + switch ($2) { case NFT_CT_HELPER: $$ = objref_stmt_alloc(&@$); $$->objref.type = NFT_OBJECT_CT_HELPER; $$->objref.expr = $4; break; default: - $$ = ct_stmt_alloc(&@$, key, -1, $4); + $$ = ct_stmt_alloc(&@$, $2, -1, $4); break; } } - | CT STRING ct_key_dir_optional SET stmt_expr + | CT ct_dir ct_key_dir_optional SET stmt_expr { - struct error_record *erec; - int8_t direction; - - erec = ct_dir_parse(&@$, $2, &direction); - xfree($2); - if (erec != NULL) { - erec_queue(erec, state->msgs); - YYERROR; - } - - $$ = ct_stmt_alloc(&@$, $3, direction, $5); + $$ = ct_stmt_alloc(&@$, $3, $2, $5); } ; diff --git a/src/scanner.l b/src/scanner.l index 0cfb6c50e418..186fb47eb763 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -484,6 +484,15 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr}) "proto-src" { return PROTO_SRC; } "proto-dst" { return PROTO_DST; } "zone" { return ZONE; } +"original" { return ORIGINAL; } +"reply" { return REPLY; } +"direction" { return DIRECTION; } +"event" { return EVENT; } +"expiration" { return EXPIRATION; } +"helper" { return HELPER; } +"label" { return LABEL; } +"state" { return STATE; } +"status" { return STATUS; } "numgen" { return NUMGEN; } "inc" { return INC; } From patchwork Tue Sep 26 17:09:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pablo Neira Ayuso X-Patchwork-Id: 818742 X-Patchwork-Delegate: pablo@netfilter.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netfilter-devel-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3y1nWb5qXsz9t3Z for ; Wed, 27 Sep 2017 03:10:03 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966192AbdIZRKC (ORCPT ); Tue, 26 Sep 2017 13:10:02 -0400 Received: from mail.us.es ([193.147.175.20]:51650 "EHLO mail.us.es" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S937280AbdIZRKB (ORCPT ); Tue, 26 Sep 2017 13:10:01 -0400 Received: from antivirus1-rhel7.int (unknown [192.168.2.11]) by mail.us.es (Postfix) with ESMTP id CED5D220BF for ; Tue, 26 Sep 2017 19:09:59 +0200 (CEST) Received: from antivirus1-rhel7.int (localhost [127.0.0.1]) by antivirus1-rhel7.int (Postfix) with ESMTP id C03B1B5027 for ; Tue, 26 Sep 2017 19:09:59 +0200 (CEST) Received: by antivirus1-rhel7.int (Postfix, from userid 99) id B5E29B5024; Tue, 26 Sep 2017 19:09:59 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on antivirus1-rhel7.int X-Spam-Level: X-Spam-Status: No, score=-108.2 required=7.5 tests=ALL_TRUSTED,BAYES_50, SMTPAUTH_US2,USER_IN_WHITELIST autolearn=disabled version=3.4.1 Received: from antivirus1-rhel7.int (localhost [127.0.0.1]) by antivirus1-rhel7.int (Postfix) with ESMTP id A0367B5028; Tue, 26 Sep 2017 19:09:57 +0200 (CEST) Received: from 192.168.1.97 (192.168.1.97) by antivirus1-rhel7.int (F-Secure/fsigk_smtp/550/antivirus1-rhel7.int); Tue, 26 Sep 2017 19:09:57 +0200 (CEST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/antivirus1-rhel7.int) Received: from salvia.here (129.166.216.87.static.jazztel.es [87.216.166.129]) (Authenticated sender: pneira@us.es) by entrada.int (Postfix) with ESMTPA id 5ED7444581E0; Tue, 26 Sep 2017 19:09:57 +0200 (CEST) X-SMTPAUTHUS: auth mail.us.es From: Pablo Neira Ayuso To: netfilter-devel@vger.kernel.org Cc: fw@strlen.de Subject: [PATCH nft 3/3] parser_bison: allow helper keyword in ct object kind Date: Tue, 26 Sep 2017 19:09:51 +0200 Message-Id: <1506445791-20482-3-git-send-email-pablo@netfilter.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1506445791-20482-1-git-send-email-pablo@netfilter.org> References: <1506445791-20482-1-git-send-email-pablo@netfilter.org> X-Virus-Scanned: ClamAV using ClamSMTP Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org The helper keyword clashes with the string rule, make sure we still accept ct helper object types from the parser. Signed-off-by: Pablo Neira Ayuso --- src/parser_bison.y | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/parser_bison.y b/src/parser_bison.y index 351b51010f59..2261b9c7a583 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -877,7 +877,7 @@ add_cmd : TABLE table_spec { $$ = cmd_alloc(CMD_ADD, CMD_OBJ_QUOTA, &$2, &@$, $3); } - | CT STRING obj_spec ct_obj_alloc '{' ct_block '}' stmt_separator + | CT ct_obj_kind obj_spec ct_obj_alloc '{' ct_block '}' stmt_separator { struct error_record *erec; int type; @@ -961,7 +961,7 @@ create_cmd : TABLE table_spec { $$ = cmd_alloc(CMD_CREATE, CMD_OBJ_QUOTA, &$2, &@$, $3); } - | CT STRING obj_spec ct_obj_alloc '{' ct_block '}' stmt_separator + | CT ct_obj_kind obj_spec ct_obj_alloc '{' ct_block '}' stmt_separator { struct error_record *erec; int type; @@ -1019,7 +1019,7 @@ delete_cmd : TABLE table_spec { $$ = cmd_alloc(CMD_DELETE, CMD_OBJ_QUOTA, &$2, &@$, NULL); } - | CT STRING obj_spec ct_obj_alloc + | CT ct_obj_kind obj_spec ct_obj_alloc { struct error_record *erec; int type; @@ -1123,7 +1123,7 @@ list_cmd : TABLE table_spec { $$ = cmd_alloc(CMD_LIST, CMD_OBJ_MAP, &$2, &@$, NULL); } - | CT STRING obj_spec + | CT ct_obj_kind obj_spec { struct error_record *erec; int type; @@ -1137,7 +1137,7 @@ list_cmd : TABLE table_spec $$ = cmd_alloc_obj_ct(CMD_LIST, type, &$3, &@$, NULL); } - | CT STRING TABLE table_spec + | CT ct_obj_kind TABLE table_spec { int cmd; @@ -2882,6 +2882,7 @@ quota_obj : quota_config ; ct_obj_kind : STRING { $$ = $1; } + | HELPER { $$ = xstrdup("helper"); } ; ct_l4protoname : TCP { $$ = IPPROTO_TCP; }