message: Log original message type of unknown payloads
authorTobias Brunner <tobias@strongswan.org>
Fri, 15 May 2015 09:35:40 +0000 (11:35 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Mon, 1 Jun 2015 07:42:11 +0000 (09:42 +0200)
src/libcharon/encoding/message.c

index 478f531..925a5b2 100644 (file)
@@ -1447,6 +1447,19 @@ static char* get_string(private_message_t *this, char *buf, int len)
                        pos += written;
                        len -= written;
                }
+               if (payload->get_type(payload) == PL_UNKNOWN)
+               {
+                       unknown_payload_t *unknown;
+
+                       unknown = (unknown_payload_t*)payload;
+                       written = snprintf(pos, len, "(%d)", unknown->get_type(unknown));
+                       if (written >= len || written < 0)
+                       {
+                               return buf;
+                       }
+                       pos += written;
+                       len -= written;
+               }
        }
        enumerator->destroy(enumerator);