netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH 3/3] parser: remove duplicated grammar for chain policy
Date: Wed, 25 Mar 2015 21:00:27 +0000	[thread overview]
Message-ID: <1427317227-11313-3-git-send-email-kaber@trash.net> (raw)
In-Reply-To: <1427317227-11313-1-git-send-email-kaber@trash.net>

Signed-off-by: Patrick McHardy <kaber@trash.net>
---
 src/parser_bison.y | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/src/parser_bison.y b/src/parser_bison.y
index ea3ff52..b86381d 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -409,7 +409,7 @@ static void location_update(struct location *loc, struct location *rhs, int n)
 %destructor { handle_free(&$$); } table_spec tables_spec chain_spec chain_identifier ruleid_spec ruleset_spec
 %type <handle>			set_spec set_identifier
 %destructor { handle_free(&$$); } set_spec set_identifier
-%type <val>			handle_spec family_spec family_spec_explicit position_spec
+%type <val>			handle_spec family_spec family_spec_explicit position_spec chain_policy
 
 %type <table>			table_block_alloc table_block
 %destructor { close_scope(state); table_free($$); }	table_block_alloc
@@ -1071,26 +1071,21 @@ hook_spec		:	TYPE		STRING		HOOK		STRING		PRIORITY	NUM
 			}
 			;
 
-policy_spec		:	POLICY		ACCEPT
+policy_spec		:	POLICY		chain_policy
 			{
 				if ($<chain>0->policy != -1) {
 					erec_queue(error(&@$, "you cannot set chain policy twice"),
 						   state->msgs);
 					YYERROR;
 				}
-				$<chain>0->policy	= NF_ACCEPT;
-			}
-			|	POLICY		DROP
-			{
-				if ($<chain>0->policy != -1) {
-					erec_queue(error(&@$, "you cannot set chain policy twice"),
-						   state->msgs);
-					YYERROR;
-				}
-				$<chain>0->policy	= NF_DROP;
+				$<chain>0->policy	= $2;
 			}
 			;
 
+chain_policy		:	ACCEPT		{ $$ = NF_ACCEPT; }
+			|	DROP		{ $$ = NF_DROP;   }
+			;
+
 identifier		:	STRING
 			;
 
-- 
2.1.0


      parent reply	other threads:[~2015-03-25 21:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-25 21:00 [PATCH 1/3] netlink: fix use after free in netlink_get_table() Patrick McHardy
2015-03-25 21:00 ` [PATCH 2/3] netlink_delinarize: fix payload dependency killing of link layer dependencies Patrick McHardy
2015-03-25 21:00 ` Patrick McHardy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1427317227-11313-3-git-send-email-kaber@trash.net \
    --to=kaber@trash.net \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).