]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
parser_bison: store location of basechain definition
authorPablo Neira Ayuso <pablo@netfilter.org>
Tue, 31 Mar 2020 11:53:39 +0000 (13:53 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 31 Mar 2020 12:27:15 +0000 (14:27 +0200)
Wrap basechain definition field around structure, add field later.
This is useful for error reporting.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/rule.h
src/parser_bison.y

index 06fefef8a5d848bee687c021958c5ba87e599175..ac69b30673e82069798503f1686d84a5413c0b91 100644 (file)
@@ -217,13 +217,16 @@ struct chain {
        struct location         location;
        unsigned int            refcnt;
        uint32_t                flags;
-       struct prio_spec        priority;
-       struct hook_spec        hook;
-       struct expr             *policy;
-       const char              *type;
-       const char              **dev_array;
-       struct expr             *dev_expr;
-       int                     dev_array_len;
+       struct {
+               struct location         loc;
+               struct prio_spec        priority;
+               struct hook_spec        hook;
+               struct expr             *policy;
+               const char              *type;
+               const char              **dev_array;
+               struct expr             *dev_expr;
+               int                     dev_array_len;
+       };
        struct scope            scope;
        struct list_head        rules;
 };
index ebaef17c904c7364a4707574e2322507aac75526..735f2dffc6e6ee6ca589601341c4a3ea3ff9fb79 100644 (file)
@@ -2057,6 +2057,7 @@ hook_spec         :       TYPE            STRING          HOOK            STRING          dev_spec        prio_spec
                                $<chain>0->type         = xstrdup(chain_type);
                                xfree($2);
 
+                               $<chain>0->loc = @$;
                                $<chain>0->hook.loc = @4;
                                $<chain>0->hook.name = chain_hookname_lookup($4);
                                if ($<chain>0->hook.name == NULL) {