From: Alan T. DeKok Date: Mon, 24 Nov 2025 01:36:43 +0000 (-0500) Subject: remove migration flag for unions X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=265bc46d4507faaff3e125d0fda1135f9225a435;p=thirdparty%2Ffreeradius-server.git remove migration flag for unions --- diff --git a/src/lib/util/dict.h b/src/lib/util/dict.h index 7d3b5a9319b..02ff7c04e09 100644 --- a/src/lib/util/dict.h +++ b/src/lib/util/dict.h @@ -122,8 +122,6 @@ typedef struct { unsigned int has_fixup : 1; //! needs a fixup during dictionary parsing - unsigned int migration_union_key : 1; //!< for migrating key fields - /* * main: extra is set, then this field is is key, bit, or a uint16 length field. * radius: is one of 9 options for flags diff --git a/src/lib/util/dict_fixup.c b/src/lib/util/dict_fixup.c index f31b88e2d77..fd4b7b1e4db 100644 --- a/src/lib/util/dict_fixup.c +++ b/src/lib/util/dict_fixup.c @@ -556,12 +556,16 @@ int dict_fixup_clone(fr_dict_attr_t **dst_p, fr_dict_attr_t const *src) } /* - * Can't clone KEY fields directly, you MUST clone the parent struct. - * - * @todo - remove after migration_union_key is deleted + * Can't clone members of a struct, you MUST clone the parent struct. You also can't clone a + * union. */ - if (!fr_type_is_non_leaf(src->type) || fr_dict_attr_is_key_field(src) || fr_dict_attr_is_key_field(dst)) { - fr_strerror_printf("Invalid reference from '%s' to %s", dst->name, src->name); + if (src->parent->type == FR_TYPE_STRUCT) { + fr_strerror_printf("Cannot clone members of '%s' of type 'struct", src->parent->name); + return -1; + } + + if (src->type == FR_TYPE_UNION) { + fr_strerror_printf("Cannot clone '%s' of type 'union", src->name); return -1; } diff --git a/src/lib/util/dict_tokenize.c b/src/lib/util/dict_tokenize.c index 4aee1d5e921..655e32de58f 100644 --- a/src/lib/util/dict_tokenize.c +++ b/src/lib/util/dict_tokenize.c @@ -1529,7 +1529,6 @@ static int dict_read_process_attribute(dict_tokenize_ctx_t *dctx, char **argv, i fr_assert(key); fr_assert(fr_dict_attr_is_key_field(key)); da = UNCONST(fr_dict_attr_t *, key); - da->flags.migration_union_key = true; } da = dict_attr_alloc_null(dctx->dict->pool, dctx->dict->proto); diff --git a/src/lib/util/dict_unknown.c b/src/lib/util/dict_unknown.c index 59c7eea54b0..db826f3cf23 100644 --- a/src/lib/util/dict_unknown.c +++ b/src/lib/util/dict_unknown.c @@ -306,11 +306,6 @@ fr_dict_attr_t *fr_dict_attr_unknown_typed_afrom_num_raw(TALLOC_CTX *ctx, fr_dic return NULL; default: - /* - * @todo - remove after migration_union_key is deleted - */ - if (fr_dict_attr_is_key_field(parent)) break; - if (!fr_type_is_structural_except_vsa(parent->type)) { fail: fr_strerror_printf("%s: Cannot allocate unknown %s attribute (%u) with parent type %s", diff --git a/src/lib/util/dict_util.c b/src/lib/util/dict_util.c index 099e8142926..8dc1534f5e6 100644 --- a/src/lib/util/dict_util.c +++ b/src/lib/util/dict_util.c @@ -1954,24 +1954,6 @@ int dict_attr_enum_add_name(fr_dict_attr_t *da, char const *name, return -1; } -#if 0 - /* - * Commented out becuase of share/dictionary/dhcpv6/dictionary.rfc6607. - * - * That dictionary defines a value which is associated with a zero-sized child. - * In order to enforce this check, we need to support zero-sized structures. - * - * Perhaps this can be done as a special case after we convert to UNIONs? Because then - * we can allow ATTRIBUTE Global-VPN 255 struct[0]. - * - * @todo - remove after migration_union_key is deleted - */ - if (fr_dict_attr_is_key_field(da) && !key_child_ref) { - fr_strerror_const("Child attribute must be defined for VALUEs associated with a 'key' attribute"); - return -1; - } -#endif - if (fr_type_is_structural(da->type) || (da->type == FR_TYPE_STRING)) { fr_strerror_printf("Enumeration names cannot be added for data type '%s'", fr_type_to_str(da->type)); return -1;