* switch the namespace.
*/
if (!da->flags.local && namespace->flags.local) namespace = our_parent = fr_dict_root(da->dict);
-
- /*
- * We had an alias in the same namespace,
- * go add more things in.
- */
- if (da->parent != our_parent) {
- fr_assert(namespace == our_parent);
- tmpl_attr_ref_fixup(ctx, vpt, da->parent, our_parent);
- }
}
}
* reference.
*/
fr_assert(our_parent != NULL);
+
+ /*
+ * We had an alias in the same namespace,
+ * go add more things in.
+ */
+ if (da->parent != our_parent) {
+ fr_assert(namespace == our_parent);
+ tmpl_attr_ref_fixup(ctx, vpt, da->parent, our_parent);
+ }
+
goto alloc_ar;
}
* .<oid>
*/
if (fr_sbuff_out(NULL, &oid, name) > 0) {
- namespace = fr_dict_unlocal(namespace);
+ our_parent = namespace = fr_dict_unlocal(namespace);
fr_assert(ar == NULL);
* reference.
*/
da = fr_dict_attr_child_by_num(namespace, oid);
- if (da) goto alloc_ar;
+ if (da) {
+ fr_assert(da->parent == our_parent);
+ goto alloc_ar;
+ }
if (!at_rules->allow_unknown) {
disallow_unknown:
.ar_num = NUM_UNSPEC,
.ar_type = TMPL_ATTR_TYPE_NORMAL,
.ar_da = da,
- .ar_parent = our_parent,
+ .ar_parent = da->parent,
};
do_suffix:
fr_fatal_assert_msg(ar->ar_parent,
"CONSISTENCY CHECK FAILED %s[%u]: attr ref missing parent",
file, line);
+
+ if (ar->ar_parent->type != FR_TYPE_GROUP) {
+ fr_fatal_assert_msg(ar->ar_parent == ar->ar_da->parent,
+ "CONSISTENCY CHECK FAILED %s[%u]: attr ref has wrong parent: "
+ "Expected %s, got %s",
+ file, line,
+ ar->ar_da->parent->name,
+ ar->ar_parent->name);
+
+ }
break;
case TMPL_ATTR_TYPE_UNSPEC: