diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2020-03-31 13:53:39 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2020-03-31 14:27:15 +0200 |
commit | fd715872462ef55381c52caef2cca414dfd8883b (patch) | |
tree | d28c1420718f7e93db97de60a4ac46e2e1b85b7c | |
parent | 673d82af234e24ef841e8409426d5f082f9ea59e (diff) |
parser_bison: store location of basechain definition
Wrap basechain definition field around structure, add field later.
This is useful for error reporting.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r-- | include/rule.h | 17 | ||||
-rw-r--r-- | src/parser_bison.y | 1 |
2 files changed, 11 insertions, 7 deletions
diff --git a/include/rule.h b/include/rule.h index 06fefef8..ac69b306 100644 --- a/include/rule.h +++ b/include/rule.h @@ -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; }; diff --git a/src/parser_bison.y b/src/parser_bison.y index ebaef17c..735f2dff 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -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) { |