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

Andrew Cagney andrew.cagney at gmail.com
Fri Dec 13 20:51:34 UTC 2019


On Fri, 13 Dec 2019 at 14:44, Paul Wouters <paul at nohats.ca> wrote:
>
> 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.

For some, yes.  The above is only triggered when a message arrives.  I
tend to suspect the more likely scenario is that no one is really sure
if/when whack is attached (cur_state, for instance, comes and goes) so
people were hedging their bets.


More information about the Swan-dev mailing list