summaryrefslogtreecommitdiffstats
path: root/src/rule.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2018-11-19 11:41:07 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2018-11-19 13:49:34 +0100
commitd7476ddd5f7de35cbc1b5b13d52733f788172ada (patch)
tree0c3f9534c38f8ee73b8828814c26de7b2fd4907c /src/rule.c
parenta4cac0c5d7810c9ff447d678cf20bc32ad543277 (diff)
src: introduce simple hints on incorrect table
This patch adds simple infrastructure to provide a hints to user on references to incorrect table. While at it, remove "Could not process rule:" which I think it is implicit in the error. # nft rule x y ip saddr @y Error: No such file or directory; did you mean table ‘x’ in family inet? Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/rule.c')
-rw-r--r--src/rule.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/rule.c b/src/rule.c
index 524db41e..3553b43d 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -1103,6 +1103,18 @@ struct table *table_lookup(const struct handle *h,
return NULL;
}
+struct table *table_lookup_fuzzy(const struct handle *h,
+ const struct nft_cache *cache)
+{
+ struct table *table;
+
+ list_for_each_entry(table, &cache->list, list) {
+ if (!strcmp(table->handle.table.name, h->table.name))
+ return table;
+ }
+ return NULL;
+}
+
const char *table_flags_name[TABLE_FLAGS_MAX] = {
"dormant",
};