netfilter: nf_tables: missing error reporting for not selected expressions
authorPablo Neira Ayuso <pablo@netfilter.org>
Wed, 19 May 2021 11:32:20 +0000 (13:32 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 20 May 2021 22:51:24 +0000 (00:51 +0200)
commitc781471d67a56d7d4c113669a11ede0463b5c719
treeb25e65a089e5f02bbcf0087feff1f434fab740b1
parent22cbdbcfb61acc78d5fc21ebb13ccc0d7e29f793
netfilter: nf_tables: missing error reporting for not selected expressions

Sometimes users forget to turn on nftables extensions from Kconfig that
they need. In such case, the error reporting from userspace is
misleading:

 $ sudo nft add rule x y counter
 Error: Could not process rule: No such file or directory
 add rule x y counter
 ^^^^^^^^^^^^^^^^^^^^

Add missing NL_SET_BAD_ATTR() to provide a hint:

 $ nft add rule x y counter
 Error: Could not process rule: No such file or directory
 add rule x y counter
              ^^^^^^^

Fixes: 83d9dcba06c5 ("netfilter: nf_tables: extended netlink error reporting for expressions")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_tables_api.c