[Swan-dev] calling loglog(RC_LOG_SERIOUS, ...) when processing a message

Paul Wouters paul at nohats.ca
Fri Dec 13 19:44:31 UTC 2019


On Fri, 13 Dec 2019, Andrew Cagney wrote:

> First a fun fact:
>
>    whack_log_fd is valid IFF pluto is executing the whack event handler.
>
> Consequently any code logging to whack outside of the whack event
> handler needs to use a reference saved in either state or pending.
>
> When processing a raw message, whack_log_fd is never valid and a
> matching state has yet to be found, so trying to log to whack using:
>
>               loglog(RC_LOG_SERIOUS,
>                        "message %s contained an unknown critical
> payload type (%s)",
>                        role, enum_show(&ikev2_payload_names, np));
>
> is pointless.  This means, as best I can tell, I can reduce calls like this to:
>
>               plog_md(md,
>                        "message %s contained an unknown critical
> payload type (%s)",
>                        role, enum_show(&ikev2_payload_names, np));

I guess the idea is that some code can be called with an administrator
waiting at the whack socket, but sometimes the same code is timer
triggered without an administrator.

Paul


More information about the Swan-dev mailing list