]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
remove migration flag for unions
authorAlan T. DeKok <aland@freeradius.org>
Mon, 24 Nov 2025 01:36:43 +0000 (20:36 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 24 Nov 2025 01:36:43 +0000 (20:36 -0500)
src/lib/util/dict.h
src/lib/util/dict_fixup.c
src/lib/util/dict_tokenize.c
src/lib/util/dict_unknown.c
src/lib/util/dict_util.c

index 7d3b5a9319b0592aee9371295b6b88730b769a42..02ff7c04e09528a951e6870bcd8f35b539458c2d 100644 (file)
@@ -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
index f31b88e2d7739fa2b5a0d79e136b74f335148d63..fd4b7b1e4db962dbb55fe91eceda8665b8b73ab2 100644 (file)
@@ -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;
        }
 
index 4aee1d5e921d33ca9b08a5977a5c421e3005ca78..655e32de58f7d6a274fa05c283b59764c5ac4ddf 100644 (file)
@@ -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);
index 59c7eea54b0b4d1467fbb199d7d077169afb7020..db826f3cf23582f6a915360f96045e859680885d 100644 (file)
@@ -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",
index 099e81429261fba21bd2af87fdff60f94187237f..8dc1534f5e6c2c1797135dfac1d0147f5bc14fc8 100644 (file)
@@ -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;