X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=lib%2Fyang_wrappers.c;h=6273dff3ce8e83cf929e77336b71599b0fb11feb;hb=c52e2ecf95a9be318912caacc0851d9307e679f7;hp=96076d6468b30a8efc9f6417cf84d73efd1a2d6a;hpb=9f7b49e1057b2a950240813bf538e46b4f1566c4;p=mirror_frr.git diff --git a/lib/yang_wrappers.c b/lib/yang_wrappers.c index 96076d646..6273dff3c 100644 --- a/lib/yang_wrappers.c +++ b/lib/yang_wrappers.c @@ -171,6 +171,7 @@ int yang_str2enum(const char *xpath, const char *value) { const struct lys_node *snode; const struct lys_node_leaf *sleaf; + const struct lys_type *type; const struct lys_type_info_enums *enums; snode = ly_ctx_get_node(ly_native_ctx, NULL, xpath, 0); @@ -182,7 +183,12 @@ int yang_str2enum(const char *xpath, const char *value) } sleaf = (const struct lys_node_leaf *)snode; - enums = &sleaf->type.info.enums; + type = &sleaf->type; + enums = &type->info.enums; + while (enums->count == 0 && type->der) { + type = &type->der->type; + enums = &type->info.enums; + } for (unsigned int i = 0; i < enums->count; i++) { const struct lys_type_enum *enm = &enums->enm[i];