]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
src: Add priority keyword on base chain description
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Wed, 4 Sep 2013 09:50:21 +0000 (12:50 +0300)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 4 Sep 2013 10:33:04 +0000 (12:33 +0200)
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
src/rule.c

index ec78e7fdf56ba3fc289ff141597931b220f76269..a7dfdcc488ca184aac4dbe0608c9b3ec2390142d 100644 (file)
@@ -767,7 +767,7 @@ 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->hookstr      = chain_hookname_lookup($4);
@@ -776,10 +776,10 @@ hook_spec         :       TYPE            STRING          HOOK            STRING          NUM
                                                   state->msgs);
                                        YYERROR;
                                }
-                               $<chain>0->priority     = $5;
+                               $<chain>0->priority     = $6;
                                $<chain>0->flags        |= CHAIN_F_BASECHAIN;
                        }
-                       |       TYPE            STRING          HOOK            STRING          DASH    NUM
+                       |       TYPE            STRING          HOOK            STRING          PRIORITY        DASH    NUM
                        {
                                $<chain>0->type         = $2;
                                $<chain>0->hookstr      = chain_hookname_lookup($4);
@@ -788,7 +788,7 @@ hook_spec           :       TYPE            STRING          HOOK            STRING          NUM
                                                   state->msgs);
                                        YYERROR;
                                }
-                               $<chain>0->priority     = -$6;
+                               $<chain>0->priority     = -$7;
                                $<chain>0->flags        |= CHAIN_F_BASECHAIN;
                        }
                        ;
index f493cd48a6599dec749c37344b6a0692f1c8628f..42ba37f4a9859dc1ed1eba38f31765d4590f2bce 100644 (file)
@@ -295,7 +295,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->handle.family, chain->hooknum),
                       chain->priority);
        }