* [PATCH nft 1/2] evaluate: check for device in non-netdev chains
@ 2020-03-31 18:29 Pablo Neira Ayuso
2020-03-31 18:29 ` [PATCH nft 2/2] parser_bison: simplify error in chain type and hook Pablo Neira Ayuso
0 siblings, 1 reply; 2+ messages in thread
From: Pablo Neira Ayuso @ 2020-03-31 18:29 UTC (permalink / raw)
To: netfilter-devel
# nft -f /tmp/x
/tmp/x:3:26-36: Error: This chain type cannot be bound to device
type filter hook input device eth0 priority 0
^^^^^^^^^^^
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
src/evaluate.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/evaluate.c b/src/evaluate.c
index 84fe89eed657..fcc79386b325 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -3805,6 +3805,9 @@ static int chain_evaluate(struct eval_ctx *ctx, struct chain *chain)
if (!chain->dev_expr)
return __stmt_binary_error(ctx, &chain->loc, NULL,
"Missing `device' in this chain definition");
+ } else if (chain->dev_expr) {
+ return __stmt_binary_error(ctx, &chain->dev_expr->location, NULL,
+ "This chain type cannot be bound to device");
}
}
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH nft 2/2] parser_bison: simplify error in chain type and hook
2020-03-31 18:29 [PATCH nft 1/2] evaluate: check for device in non-netdev chains Pablo Neira Ayuso
@ 2020-03-31 18:29 ` Pablo Neira Ayuso
0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2020-03-31 18:29 UTC (permalink / raw)
To: netfilter-devel
Remove extra string after error, location is sufficient.
# nft -f x
/tmp/x:3:8-11: Error: unknown chain type
type nput hook input device eth0 priority 0
^^^^
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
src/parser_bison.y | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/parser_bison.y b/src/parser_bison.y
index 735f2dffc6e6..3e8d6bd6d8ca 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -1880,7 +1880,7 @@ flowtable_block : /* empty */ { $$ = $<flowtable>-1; }
$$->hook.loc = @3;
$$->hook.name = chain_hookname_lookup($3);
if ($$->hook.name == NULL) {
- erec_queue(error(&@3, "unknown chain hook %s", $3),
+ erec_queue(error(&@3, "unknown chain hook"),
state->msgs);
xfree($3);
YYERROR;
@@ -2049,7 +2049,7 @@ hook_spec : TYPE STRING HOOK STRING dev_spec prio_spec
const char *chain_type = chain_type_name_lookup($2);
if (chain_type == NULL) {
- erec_queue(error(&@2, "unknown chain type %s", $2),
+ erec_queue(error(&@2, "unknown chain type"),
state->msgs);
xfree($2);
YYERROR;
@@ -2061,7 +2061,7 @@ hook_spec : TYPE STRING HOOK STRING dev_spec prio_spec
$<chain>0->hook.loc = @4;
$<chain>0->hook.name = chain_hookname_lookup($4);
if ($<chain>0->hook.name == NULL) {
- erec_queue(error(&@4, "unknown chain hook %s", $4),
+ erec_queue(error(&@4, "unknown chain hook"),
state->msgs);
xfree($4);
YYERROR;
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-03-31 18:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-31 18:29 [PATCH nft 1/2] evaluate: check for device in non-netdev chains Pablo Neira Ayuso
2020-03-31 18:29 ` [PATCH nft 2/2] parser_bison: simplify error in chain type and hook Pablo Neira Ayuso
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.