From: Alan T. DeKok Date: Thu, 14 Aug 2025 10:57:35 +0000 (-0400) Subject: allow union[...] syntax X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=efe1e4d413cf02a6c19bee1fcbe4cd185867fd66;p=thirdparty%2Ffreeradius-server.git allow union[...] syntax for size of the union, ala string[1] or octets[1], or struct[1] --- diff --git a/src/lib/util/dict_tokenize.c b/src/lib/util/dict_tokenize.c index 607a3cc3cb8..82e006d92ed 100644 --- a/src/lib/util/dict_tokenize.c +++ b/src/lib/util/dict_tokenize.c @@ -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; }