]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
parser: Make debug log for payload substructure rules more clear
authorTobias Brunner <tobias@strongswan.org>
Wed, 2 Oct 2024 07:57:14 +0000 (09:57 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 2 Oct 2024 08:07:36 +0000 (10:07 +0200)
Instead of this

  parsing rule 10 (1258)

we now see this

  parsing rule 10 LIST of PROPOSAL_SUBSTRUCTURE

in the debug log. Particularly useful if the list is empty as there won't
be a message like this following it:

  x bytes left, parsing recursively PROPOSAL_SUBSTRUCTURE

src/libcharon/encoding/parser.c

index 546d39931ead6c05d074032bac096a21cda9d88f..225d5d19d919d0ba1bf04afa262e32e094a69b8c 100644 (file)
@@ -399,8 +399,16 @@ METHOD(parser_t, parse_payload, status_t,
                header_length = pld->get_header_length(pld);
 
                rule = &(this->rules[rule_number]);
-               DBG2(DBG_ENC, "  parsing rule %d %N",
-                        rule_number, encoding_type_names, rule->type);
+               if (rule->type < PAYLOAD_LIST)
+               {
+                       DBG2(DBG_ENC, "  parsing rule %d %N",
+                                rule_number, encoding_type_names, rule->type);
+               }
+               else
+               {
+                       DBG2(DBG_ENC, "  parsing rule %d LIST of %N",
+                                rule_number, payload_type_names, rule->type - PAYLOAD_LIST);
+               }
                switch ((int)rule->type)
                {
                        case U_INT_4: