netfilter: nf_tables: extended netlink error reporting for chain type
authorPablo Neira Ayuso <pablo@netfilter.org>
Wed, 19 May 2021 19:16:40 +0000 (21:16 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 20 May 2021 22:51:24 +0000 (00:51 +0200)
commit983c4fcb81d6bd19c6035e5dda6bf1fca058c320
treea915d31fb19d7d63a02b86abd878082a70856a3b
parentc781471d67a56d7d4c113669a11ede0463b5c719
netfilter: nf_tables: extended netlink error reporting for chain type

Users that forget to select the NAT chain type in netfilter's Kconfig
hit ENOENT when adding the basechain.

This report is however sparse since it might be the table, the chain
or the kernel module that is missing/does not exist.

This patch provides extended netlink error reporting for the
NFTA_CHAIN_TYPE netlink attribute, which conveys the basechain type.
If the user selects a basechain that his custom kernel does not support,
the netlink extended error provides a more accurate hint on the
described issue.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_tables_api.c