On 2025/5/22 02:23, Florian Westphal wrote:
Lance Yang <lance.yang@xxxxxxxxx> wrote:
There is no need for 'syslog' to be active for 'log_invalid' to be
useful as long as the system in question has e.g. ulogd running
and listening to nflog messages.
If anything, the modprobe should be done only when no logger
is registered.
Yes, could we load the module only when no logger exists? Something
like:
+ if (nf_logger_find_get(NFPROTO_IPV4, NF_LOG_TYPE_LOG) != 0)
+ request_module("%s", "nf_log_syslog");
This function bumps the module refcount, so if the logger exists you
would need to call nf_logger_put() too.
Ah, understood ;)
I'd add a new, simpler helper, that only returns if any logger
is active.
bool nf_log_is_registered(int pf);
or something like that.
Nice, thanks for jumping in! I'll hold until the helper lands, then
rebase and send the v2.
Thanks,
Lance