Added YANG deviate flag to not follow orig links
Fixed unbounded loop in deviation
This commit is contained in:
parent
05263e942a
commit
442e0391cc
5 changed files with 66 additions and 5 deletions
|
|
@ -2358,6 +2358,7 @@ yang_deviation(yang_stmt *ys,
|
|||
enum rfc_6020 kw;
|
||||
int min;
|
||||
int max;
|
||||
int inext0;
|
||||
int inext;
|
||||
|
||||
if (yang_keyword_get(ys) != Y_DEVIATION)
|
||||
|
|
@ -2379,8 +2380,8 @@ yang_deviation(yang_stmt *ys,
|
|||
*/
|
||||
}
|
||||
/* Go through deviates of deviation */
|
||||
inext = 0;
|
||||
while ((yd = yn_iter(ys, &inext)) != NULL) {
|
||||
inext0 = 0;
|
||||
while ((yd = yn_iter(ys, &inext0)) != NULL) {
|
||||
/* description / if-feature / reference */
|
||||
if (yang_keyword_get(yd) != Y_DEVIATE)
|
||||
continue;
|
||||
|
|
@ -2448,6 +2449,7 @@ yang_deviation(yang_stmt *ys,
|
|||
/* Make a copy of deviate child and insert. */
|
||||
if ((yc1 = ys_dup(yc)) == NULL)
|
||||
goto done;
|
||||
yang_flag_set(yc1, YANG_FLAG_NOORIG);
|
||||
if (yn_insert(ytarget, yc1) < 0)
|
||||
goto done;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -924,7 +924,7 @@ yang_lib2yspec(clixon_handle h,
|
|||
if ((modmin = yang_len_get(yspec) - (1+veclen - modmin)) < 0)
|
||||
goto fail;
|
||||
if (yang_parse_post(h, yspec, modmin) < 0)
|
||||
goto done;
|
||||
goto fail;
|
||||
retval = 1;
|
||||
done:
|
||||
if (vec)
|
||||
|
|
|
|||
|
|
@ -1482,8 +1482,16 @@ yang_type_get(yang_stmt *ys,
|
|||
if (options)
|
||||
*options = 0x0;
|
||||
/* Use original tree to resolve types */
|
||||
if ((yorig = yang_orig_get(ys)) != NULL) {
|
||||
if ((ytype = yang_find(ys, Y_TYPE, NULL)) == NULL){
|
||||
clixon_err(OE_DB, ENOENT, "mandatory type object is not found");
|
||||
goto done;
|
||||
}
|
||||
if ((yorig = yang_orig_get(ys)) != NULL && yang_flag_get(ytype, YANG_FLAG_NOORIG) == 0){
|
||||
ys = yorig;
|
||||
if ((ytype = yang_find(ys, Y_TYPE, NULL)) == NULL){
|
||||
clixon_err(OE_DB, ENOENT, "mandatory type object is not found");
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
/* Find mandatory type */
|
||||
if ((ytype = yang_find(ys, Y_TYPE, NULL)) == NULL){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue