netfilter: nf_tables: Audit log dump reset after the fact
authorPhil Sutter <phil@nwl.cc>
Fri, 9 Aug 2024 13:07:30 +0000 (15:07 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 14 Aug 2024 21:37:35 +0000 (23:37 +0200)
commite0b6648b0446e59522819c75ba1dcb09e68d3e94
treef1c682151c3edcb5963ec9cf138f16495f871aa7
parentea2306f0330c59ac8cd6ba13193497f0a6a02684
netfilter: nf_tables: Audit log dump reset after the fact

In theory, dumpreset may fail and invalidate the preceeding log message.
Fix this and use the occasion to prepare for object reset locking, which
benefits from a few unrelated changes:

* Add an early call to nfnetlink_unicast if not resetting which
  effectively skips the audit logging but also unindents it.
* Extract the table's name from the netlink attribute (which is verified
  via earlier table lookup) to not rely upon validity of the looked up
  table pointer.
* Do not use local variable family, it will vanish.

Fixes: 8e6cf365e1d5 ("audit: log nftables configuration change events")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Reviewed-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_tables_api.c