From: Alan T. DeKok Date: Mon, 27 Oct 2025 13:17:33 +0000 (-0400) Subject: allow children of UNION to be TLV or leaf. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa4e795d59794595fd17475e1cd01f3fef2279c1;p=thirdparty%2Ffreeradius-server.git allow children of UNION to be TLV or leaf. because the struct encoder can be updated to allow that. Note that the struct encode / decode has not yet been updated --- diff --git a/src/lib/util/dict_validate.c b/src/lib/util/dict_validate.c index 1017550c534..7ae276b25d3 100644 --- a/src/lib/util/dict_validate.c +++ b/src/lib/util/dict_validate.c @@ -608,7 +608,7 @@ bool dict_attr_flags_valid(fr_dict_attr_t *da) break; case FR_TYPE_UNION: - if (da->type != FR_TYPE_STRUCT) { + if (!((da->type == FR_TYPE_STRUCT) || (da->type == FR_TYPE_TLV) || fr_type_is_leaf(da->type))) { fr_strerror_printf("Attributes of type '%s' cannot be children of the 'union' type", fr_type_to_str(type)); return false; diff --git a/src/tests/unit/protocols/radius/dictionary.test b/src/tests/unit/protocols/radius/dictionary.test index 1839b97b04c..f53b4e447e7 100644 --- a/src/tests/unit/protocols/radius/dictionary.test +++ b/src/tests/unit/protocols/radius/dictionary.test @@ -50,6 +50,11 @@ MEMBER Nested-Uint1 uint8 MEMBER Nested-Uint2 uint8 END Test-Struct2.Data +BEGIN Test-Struct2.Data +ATTRIBUTE Thingy 2 tlv +ATTRIBUTE Child .1 string +END Test-Struct2.Data + ATTRIBUTE Unit-TLV 254 tlv ATTRIBUTE Milliseconds 254.1 date precision=milliseconds ATTRIBUTE Delta-MSec 254.2 time_delta precision=milliseconds