diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2018-11-19 13:02:03 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2018-11-19 13:53:15 +0100 |
commit | 285bb67a11ad2a6cac29b9f0eff3cf6066e0d39f (patch) | |
tree | 85f6388725415ba5752943bdbfdeb768efab4644 /src/rule.c | |
parent | 9f7817a4e0223c5e285a3f4a4dccbf1dafa7fc4e (diff) |
src: introduce simple hints on incorrect set
# nft rule x y ip saddr @y
Error: No such file or directory; did you mean set ‘y’ in table inet ‘x’?
rule x y ip saddr @y
^^
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/rule.c')
-rw-r--r-- | src/rule.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -350,6 +350,24 @@ struct set *set_lookup(const struct table *table, const char *name) return NULL; } +struct set *set_lookup_fuzzy(const char *set_name, + const struct nft_cache *cache, + const struct table **t) +{ + struct table *table; + struct set *set; + + list_for_each_entry(table, &cache->list, list) { + list_for_each_entry(set, &table->sets, list) { + if (!strcmp(set->handle.set.name, set_name)) { + *t = table; + return set; + } + } + } + return NULL; +} + struct set *set_lookup_global(uint32_t family, const char *table, const char *name, struct nft_cache *cache) { |