[Swan-dev] lswlog_enum_short() badness

Paul Wouters paul at nohats.ca
Sun Dec 23 03:45:55 UTC 2018


I was hunting down this message:

Dec 22 22:33:12.253210: "ikev2"[2] 206.248.139.105 #4: responding to AUTH message (ID 1) from 206.248.139.105:7 with encrypted notification INVALID_SYNTAX

I was side tracked due to the bad name "AUTH message". I thought it was
talking about the AUTH payload, but it is talking about IKE_AUTH.
Looking further I found:

         LSWLOG_RC(RC_LOG_SERIOUS, buf) {
                 const enum isakmp_xchg_types ix = md->hdr.isa_xchg;
                 lswlogs(buf, "dropping unexpected ");
                 lswlog_enum_short(buf, &ikev2_exchange_names, ix);
                 lswlogs(buf, " message");

It seems lswlog_enum_short() cuts everything until the last _ so the
name ISAKMP_v2_IKE_AUTH becomes AUTH.

Note there is confusion too because the Exchange Type is logged as:

Dec 22 22:33:12.253637: |    exchange type: ISAKMP_v2_AUTH (0x23)

So we have ISAKMP_v2_AUTH, ISAKMP_v2_IKE_AUTH and AUTH referring to the
same thing.

We used to have a way to print an enum stripping a prefix, but it seems
that functionality has been removed ?

Anyway, can the code be updated so it logs "IKE_AUTH" instead of "AUTH"
for the Exchange Type message?

Paul


More information about the Swan-dev mailing list