]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
allow union[...] syntax
authorAlan T. DeKok <aland@freeradius.org>
Thu, 14 Aug 2025 10:57:35 +0000 (06:57 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 14 Aug 2025 18:12:54 +0000 (14:12 -0400)
for size of the union, ala string[1] or octets[1], or struct[1]

src/lib/util/dict_tokenize.c

index 607a3cc3cb82f15fde44341380c2374dd2d69344..82e006d92edf3f3f39bd512882db5fb61bdbe713 100644 (file)
@@ -381,6 +381,9 @@ static int dict_process_type_field(dict_tokenize_ctx_t *dctx, char const *name,
                } else if (strcmp(name, "struct") == 0) {
                        type = FR_TYPE_STRUCT;
 
+               } else if (strcmp(name, "union") == 0) {
+                       type = FR_TYPE_UNION;
+
                } else if (strcmp(name, "bit") == 0) {
                        if (dctx->stack[dctx->stack_depth].da->type != FR_TYPE_STRUCT) {
                                fr_strerror_const("Bit fields can only be used inside of a STRUCT");
@@ -415,7 +418,8 @@ static int dict_process_type_field(dict_tokenize_ctx_t *dctx, char const *name,
                        (*da_p)->flags.flag_byte_offset = length;
 
                } else {
-                       fr_strerror_const("Only 'octets', 'string', 'struct', or 'bit' types can have a 'length' parameter");
+                       fr_strerror_printf("Attributes of type '%s' cannot use the %s[...] syntax",
+                                          name, name);
                        return -1;
                }