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
}
/*
- * 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;
}
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);
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",
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;