mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-10 03:24:01 +00:00
lib: fix issue with yang_str2enum
The same issue with derived enum types that was already fixed for yang_data_new_enum was still present here, so I simply applied the same fix. Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
This commit is contained in:
parent
8427e0e674
commit
bb359ba2f2
@ -171,6 +171,7 @@ int yang_str2enum(const char *xpath, const char *value)
|
|||||||
{
|
{
|
||||||
const struct lys_node *snode;
|
const struct lys_node *snode;
|
||||||
const struct lys_node_leaf *sleaf;
|
const struct lys_node_leaf *sleaf;
|
||||||
|
const struct lys_type *type;
|
||||||
const struct lys_type_info_enums *enums;
|
const struct lys_type_info_enums *enums;
|
||||||
|
|
||||||
snode = ly_ctx_get_node(ly_native_ctx, NULL, xpath, 0);
|
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;
|
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++) {
|
for (unsigned int i = 0; i < enums->count; i++) {
|
||||||
const struct lys_type_enum *enm = &enums->enm[i];
|
const struct lys_type_enum *enm = &enums->enm[i];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user