]> git.ipfire.org Git - thirdparty/nftables.git/commit
evaluate: misleading error reporting with sets and maps
authorPablo Neira Ayuso <pablo@netfilter.org>
Wed, 6 Mar 2019 10:56:59 +0000 (11:56 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 6 Mar 2019 11:01:42 +0000 (12:01 +0100)
commitd34a6bacc6be36388a72350fe3c9e0d9ce81ac5a
tree573207e9594c53a8846e1e99adc38ab5ba19f2b3
parentb1436403417697b8647956ff91d40a5982aba477
evaluate: misleading error reporting with sets and maps

When trying to list a map content, if set is used, nft reports:

 # nft list set filter group_7933
 Error: No such file or directory; did you mean set ‘group_7933’ in table ip ‘filter’?
 list set filter group_7933
                 ^^^^^^^^^^

Which is confusing in case user wants to list an existing map:

 # nft list map filter group_7933
 table ip filter {
        map group_7933 {
                type ipv4_addr : classid
                flags interval
                elements = { 10.4.22.0/24 : 1:c7cb }
        }
 }

Instead, give a hint to user that probably wants to list a map, not a set:

 # nft list set filter group_7933
 Error: No such file or directory; did you mean map ‘group_7933’ in table ip ‘filter’?
 list set filter group_7933
                 ^^^^^^^^^^

Fixes: 285bb67a11ad ("src: introduce simple hints on incorrect set")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/evaluate.c