]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix ext debugging
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 3 Dec 2020 21:04:23 +0000 (14:04 -0700)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 3 Dec 2020 21:04:23 +0000 (14:04 -0700)
src/lib/util/dict_ext.c
src/lib/util/dict_ext.h
src/lib/util/ext.c

index 10bc6b35fe6d718bb116a7b324c9ff02e24c40ac..d219564e84ad47c995954c1ff4d62ea44f91298f 100644 (file)
@@ -30,12 +30,14 @@ RCSID("$Id$")
 #include <freeradius-devel/util/talloc.h>
 
 static fr_table_num_ordered_t const dict_attr_ext_table[] = {
-       { L("name"),            FR_DICT_ATTR_EXT_NAME           },
-       { L("children"),        FR_DICT_ATTR_EXT_CHILDREN       },
-       { L("vendor"),          FR_DICT_ATTR_EXT_REF            },
-       { L("enumv"),           FR_DICT_ATTR_EXT_VENDOR         },
-       { L("da_stack"),        FR_DICT_ATTR_EXT_ENUMV          },
-       { L("name"),            FR_DICT_ATTR_EXT_DA_STACK       }
+       { L("name"),                    FR_DICT_ATTR_EXT_NAME                   },
+       { L("children"),                FR_DICT_ATTR_EXT_CHILDREN               },
+       { L("ref"),                     FR_DICT_ATTR_EXT_REF                    },
+       { L("vendor"),                  FR_DICT_ATTR_EXT_VENDOR                 },
+       { L("da_stack"),                FR_DICT_ATTR_EXT_DA_STACK               },
+       { L("enumv"),                   FR_DICT_ATTR_EXT_ENUMV                  },
+       { L("namespace"),               FR_DICT_ATTR_EXT_NAMESPACE              },
+       { L("protocol-specific"),       FR_DICT_ATTR_EXT_PROTOCOL_SPECIFIC      }
 };
 static size_t dict_attr_ext_table_len = NUM_ELEMENTS(dict_attr_ext_table);
 
@@ -188,6 +190,11 @@ static fr_table_num_ordered_t const dict_enum_ext_table[] = {
 };
 static size_t dict_enum_ext_table_len = NUM_ELEMENTS(dict_enum_ext_table);
 
+void fr_dict_attr_ext_debug(fr_dict_attr_t const *da)
+{
+       fr_ext_debug(&fr_dict_attr_ext_def, da->name, da);
+}
+
 /** Holds additional information about extension structures
  *
  */
index 0d23071b9ca254a4c5d5491df2520329dc5eb4c1..edaa974e4824e41c4ca7986bb1a315671b47b88e 100644 (file)
@@ -209,6 +209,8 @@ static inline fr_dict_attr_t const *fr_dict_vendor_da_by_da(fr_dict_attr_t const
 
 /** @} */
 
+void fr_dict_attr_ext_debug(fr_dict_attr_t const *da);
+
 #ifdef __cplusplus
 }
 #endif
index de42c25da8195eb3f6f54ab1b54f3d95608a699d..bee011b29cd8dde32478abd0797c27b6d7e74c0a 100644 (file)
@@ -239,9 +239,9 @@ void fr_ext_debug(fr_ext_t const *def, char const *name, void const *chunk)
 {
        int i;
 
-       FR_FAULT_LOG("%sext total_len=%zu", name, talloc_get_size(chunk));
+       FR_FAULT_LOG("%s ext total_len=%zu", name, talloc_get_size(chunk));
        for (i = 0; i < (int)def->max; i++) {
-               uint8_t *chunk_ext = CHUNK_EXT(def->info, def->offset_of_exts);
+               uint8_t *chunk_ext = CHUNK_EXT(chunk, def->offset_of_exts);
                if (chunk_ext[i]) {
                        void            *ext = CHUNK_EXT_PTR(chunk, chunk_ext, i);
                        size_t          ext_len = fr_ext_len(def, chunk, i);
@@ -251,12 +251,12 @@ void fr_ext_debug(fr_ext_t const *def, char const *name, void const *chunk)
                                                                                i, "<INVALID>");
 
                        if (ext_len > 1024) {
-                               FR_FAULT_LOG("%sext id=%s - possibly bad length %zu - limiting dump to 1024",
+                               FR_FAULT_LOG("%s ext id=%s - possibly bad length %zu - limiting dump to 1024",
                                             name, ext_name, ext_len);
                                ext_len = 1024;
                        }
 
-                       FR_FAULT_LOG("%sext id=%s start=%p end=%p len=%zu",
+                       FR_FAULT_LOG("%s ext id=%s start=%p end=%p len=%zu",
                                     name, ext_name, ext, ((uint8_t *)ext) + ext_len, ext_len);
                        FR_FAULT_LOG_HEX(ext, ext_len);
                }