Skip to content

Commit 2a33c21

Browse files
committed
resolve BUGFIX local module for leafrefs in typedefs
... must be that of the typedef instead of the node where the typedef was used. Fixes #1082
1 parent 0599d13 commit 2a33c21

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/resolve.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4235,7 +4235,12 @@ resolve_schema_leafref(struct lys_type *type, struct lys_node *parent, struct un
42354235
op_node && !(op_node->nodetype & (LYS_ACTION | LYS_NOTIF | LYS_RPC));
42364236
op_node = lys_parent(op_node));
42374237

4238-
cur_module = lys_node_module(parent);
4238+
if (type->der->module) {
4239+
/* typedef, take its local module */
4240+
cur_module = type->der->module;
4241+
} else {
4242+
cur_module = lys_node_module(parent);
4243+
}
42394244
do {
42404245
if ((i = parse_path_arg(cur_module, id, &prefix, &pref_len, &name, &nam_len, &parent_times, &has_predicate)) < 1) {
42414246
LOGVAL(ctx, LYE_INCHAR, LY_VLOG_LYS, parent, id[-i], &id[-i]);

0 commit comments

Comments
 (0)