From fd715872462ef55381c52caef2cca414dfd8883b Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Tue, 31 Mar 2020 13:53:39 +0200 Subject: 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 --- include/rule.h | 17 ++++++++++------- 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 $0->type = xstrdup(chain_type); xfree($2); + $0->loc = @$; $0->hook.loc = @4; $0->hook.name = chain_hookname_lookup($4); if ($0->hook.name == NULL) { -- cgit v1.2.3