diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2021-06-08 13:53:43 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2021-06-08 14:45:24 +0200 |
commit | 0276c2fee939e39e5bae60b4fdaa3c00cab7ec38 (patch) | |
tree | d2ea17b563e9b56b60a8be2b8d8e12749b5f252c /src/netlink.c | |
parent | d3c8051cb767693a6902ed9350e923b25198310c (diff) |
cmd: check for table mismatch first in error reporting
If the fuzzy lookup provides a table, check if it is an inexact
matching, in that case, report that the table does not exist and provide
a mispelling suggestion for the non-existing table.
Initialize table to NULL since the fuzzy lookup might return no table
at all.
This patch fixes misleading error reporting:
# nft delete chain xxx yyy
Error: No such file or directory; did you mean chain ‘B’ in table ip ‘A’?
delete chain xxx yyy
^^^
This refers to table 'xxx' but the suggestion refers to the chain instead.
Therefore, if the fuzzy lookup provides an exact matching table, then do
the fuzzy lookup for the next non-existing object (either chain, set,
...).
Fixes: 3a0e07106f66 ("src: combine extended netlink error reporting with mispelling support")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/netlink.c')
0 files changed, 0 insertions, 0 deletions