diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2021-05-19 21:57:41 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2021-05-20 00:13:35 +0200 |
commit | 5008798157e2114f9fc47bff46e4e6f03c9c7a14 (patch) | |
tree | 5c8385d44a563e4cd87ec9bffa6c6c294d51c3cc /src/parser_bison.y | |
parent | 2acf8b2caea19d8abd46d475a908f8d6afb33aa0 (diff) |
libnftables: location-based error reporting for chain type
Store the location of the chain type for better error reporting.
Several users that compile custom kernels reported that error
reporting is misleading when accidentally selecting
CONFIG_NFT_NAT=n.
After this patch, a better hint is provided:
# nft 'add chain x y { type nat hook prerouting priority dstnat; }'
Error: Could not process rule: No such file or directory
add chain x y { type nat hook prerouting priority dstnat; }
^^^
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/parser_bison.y')
-rw-r--r-- | src/parser_bison.y | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/parser_bison.y b/src/parser_bison.y index 957fb528..3a11e697 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -2301,7 +2301,8 @@ hook_spec : TYPE STRING HOOK STRING dev_spec prio_spec xfree($2); YYERROR; } - $<chain>0->type = xstrdup(chain_type); + $<chain>0->type.loc = @2; + $<chain>0->type.str = xstrdup(chain_type); xfree($2); $<chain>0->loc = @$; |