Patchwork [nftables,tool,3/5] syntax: Add priority keyword on base chain description

login
register
mail settings
Submitter Tomasz Bursztyka
Date Aug. 28, 2013, 8:33 a.m.
Message ID <1377678791-7616-4-git-send-email-tomasz.bursztyka@linux.intel.com>
Download mbox | patch
Permalink /patch/270388/
State Superseded
Headers show

Comments

Tomasz Bursztyka - Aug. 28, 2013, 8:33 a.m.
Instead of:
add chain foo bar { type route hook input 0; }

it should be now:
add chain foo bar { type route hook input priority 0; }

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
---
 src/parser.y | 8 ++++----
 src/rule.c   | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

Patch

diff --git a/src/parser.y b/src/parser.y
index 4df7d44..9a91490 100644
--- a/src/parser.y
+++ b/src/parser.y
@@ -765,11 +765,11 @@  map_block		:	/* empty */	{ $$ = $<set>-1; }
 			}
 			;
 
-hook_spec		:	TYPE		STRING		HOOK		STRING		NUM
+hook_spec		:	TYPE	STRING	HOOK	STRING	PRIORITY	NUM
 			{
 				$<chain>0->type		= $2;
 				$<chain>0->hooknum	= str2hooknum($4);
-				$<chain>0->priority	= $5;
+				$<chain>0->priority	= $6;
 				$<chain>0->flags	|= CHAIN_F_BASECHAIN;
 
 				if ($<chain>0->hooknum == HOOK_NUMHOOKS) {
@@ -778,11 +778,11 @@  hook_spec		:	TYPE		STRING		HOOK		STRING		NUM
 					YYERROR;	
 				}
 			}
-			|	TYPE		STRING		HOOK		STRING		DASH	NUM
+			|	TYPE	STRING	HOOK	STRING	PRIORITY	DASH	NUM
 			{
 				$<chain>0->type		= $2;
 				$<chain>0->hooknum	= str2hooknum($4);
-				$<chain>0->priority	= -$6;
+				$<chain>0->priority	= -$7;
 				$<chain>0->flags	|= CHAIN_F_BASECHAIN;
 
 				if ($<chain>0->hooknum == HOOK_NUMHOOKS) {
diff --git a/src/rule.c b/src/rule.c
index 23b64a7..28a52b0 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -262,7 +262,7 @@  static void chain_print(const struct chain *chain)
 
 	printf("\tchain %s {\n", chain->handle.chain);
 	if (chain->flags & CHAIN_F_BASECHAIN) {
-		printf("\t\t type %s hook %s %u;\n", chain->type,
+		printf("\t\t type %s hook %s priority %u;\n", chain->type,
 		       hooknum2str(chain->hooknum), chain->priority);
 	}
 	list_for_each_entry(rule, &chain->rules, list) {