]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/yang_wrappers.c
zebra: Allow ns delete to happen after under/over flow checks
[mirror_frr.git] / lib / yang_wrappers.c
index da9d37669bf91c40eeefeb0c35aa773d3b92b459..6273dff3ce8e83cf929e77336b71599b0fb11feb 100644 (file)
@@ -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];
 
@@ -840,7 +846,7 @@ void yang_str2ipv4p(const char *value, union prefixptr prefix)
 }
 
 struct yang_data *yang_data_new_ipv4p(const char *xpath,
-                                     const union prefixptr prefix)
+                                     union prefixconstptr prefix)
 {
        char value_str[PREFIX2STR_BUFFER];
 
@@ -950,7 +956,7 @@ void yang_str2ipv6p(const char *value, union prefixptr prefix)
 }
 
 struct yang_data *yang_data_new_ipv6p(const char *xpath,
-                                     const union prefixptr prefix)
+                                     union prefixconstptr prefix)
 {
        char value_str[PREFIX2STR_BUFFER];