summaryrefslogtreecommitdiffstats
path: root/include/datatype.h
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2023-05-09 17:46:54 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2023-05-11 18:18:35 +0200
commitd486c9e626405e829221b82d7355558005b26d8a (patch)
treea704df09df488b31302a9c6caa7bd855c295baa2 /include/datatype.h
parent8d586177b843af5e77f10e3f0c532341648582d0 (diff)
datatype: add hint error handler
If user provides a symbol that cannot be parsed and the datatype provides an error handler, provide a hint through the misspell infrastructure. For instance: # cat test.nft table ip x { map y { typeof ip saddr : verdict elements = { 1.2.3.4 : filter_server1 } } } # nft -f test.nft test.nft:4:26-39: Error: Could not parse netfilter verdict; did you mean `jump filter_server1'? elements = { 1.2.3.4 : filter_server1 } ^^^^^^^^^^^^^^ While at it, normalize error to "Could not parse symbolic %s expression". Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include/datatype.h')
-rw-r--r--include/datatype.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/datatype.h b/include/datatype.h
index 391d6ac8..4b59790b 100644
--- a/include/datatype.h
+++ b/include/datatype.h
@@ -167,6 +167,7 @@ struct datatype {
struct error_record *(*parse)(struct parse_ctx *ctx,
const struct expr *sym,
struct expr **res);
+ struct error_record *(*err)(const struct expr *sym);
void (*describe)(struct output_ctx *octx);
const struct symbol_table *sym_tbl;
unsigned int refcnt;