*
* We just skip one level down an don't create or update
* the key pair.
+ *
+ * @todo - remove after migration_union_key is deleted
*/
if (vp && fr_dict_attr_is_key_field(ar->da) && fr_type_is_leaf(vp->data.type)) {
ar = tmpl_attr_list_next(ar_list, ar);
/*
* Key fields can have children, because we really don't know how else to
* represent the child structures.
+ *
+ * @todo - remove after migration_union_key is deleted
*/
if (fr_dict_attr_is_key_field(da)) goto is_union;
unsigned int has_fixup : 1; //! needs a fixup during dictionary parsing
+ unsigned int migration_union_key; //!< 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
fr_dict_attr_ext_enumv_t *src_ext = src_ext_ptr;
fr_hash_iter_t iter;
fr_dict_enum_value_t *enumv;
- bool has_child = fr_dict_attr_is_key_field(da_src);
+
+ /*
+ * @todo - remove after migration_union_key is deleted
+ */
+ bool has_child = fr_dict_attr_is_key_field(da_src) && !da_src->flags.migration_union_key;
if (!src_ext->value_by_name) return 0;
/*
* Can't clone KEY fields directly, you MUST clone the parent struct.
+ *
+ * @todo - remove after migration_union_key is deleted
*/
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);
key = ext->ref;
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 -1;
}
+ /*
+ * @todo - remove after migration_union_key is deleted
+ */
if (!fr_dict_attr_is_key_field(parent)) {
fr_strerror_printf("Attribute '%s' is not a 'key' attribute", key_attr);
return -1;
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)) {
/*
* Children are allowed here, but ONLY if this
* attribute is a key field.
+ *
+ * @todo - remove after migration_union_key is deleted
*/
if (da->parent && (da->parent->type == FR_TYPE_STRUCT) && fr_dict_attr_is_key_field(da)) return true;
break;
*
* 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");
/*
* Child is a STRUCT which has a parent key field. The
* child pair nesting, though, is in the grandparent.
+ *
+ * @todo - remove after migration_union_key is deleted
*/
if (fr_dict_attr_is_key_field(child->parent)) {
fr_assert(child->parent->parent == parent);
case FR_TYPE_UINT8:
case FR_TYPE_UINT16:
case FR_TYPE_UINT32:
+ /*
+ * @todo - remove after migration_union_key is deleted
+ */
if (fr_dict_attr_is_key_field(parent)) break;
FALL_THROUGH;
* Otherwise if we're creating a child struct (which is magically parented by the key
* field), then don't bother creating the key field. It will be automatically filled in
* by the encoder.
+ *
+ * @todo - remove after migration_union_key is deleted
*/
if ((find != da) && fr_dict_attr_is_key_field(find)) {
continue;
*
* If we're asked to create children of a keyed
* structure, just create the children in the parent.
+ *
+ * @todo - remove after migration_union_key is deleted
*/
if (!fr_type_is_structural(da->type)) {
fr_assert(fr_dict_attr_is_key_field(da));
case FR_TYPE_UINT16:
case FR_TYPE_UINT32:
/*
- * Key fields have children in their namespace, but the children go into the
- * parents context and list.
+ * Key fields have children in their namespace, but for OLD style, the children
+ * go into the parents context and list.
*/
- if (fr_dict_attr_is_key_field(vp->da)) {
+ if (fr_dict_attr_is_key_field(vp->da) && !vp->da->flags.migration_union_key) {
fr_pair_t *parent_vp;
parent_vp = fr_pair_parent(vp);