Fixed: [Using YANG union with decimal64 and string leads to regexp match fail #226](https://github.com/clicon/clixon/issues/226)
This commit is contained in:
parent
d3b614e67d
commit
60c9172d21
3 changed files with 24 additions and 14 deletions
|
|
@ -78,6 +78,7 @@ Users may have to change how they access the system
|
||||||
|
|
||||||
### Corrected Bugs
|
### Corrected Bugs
|
||||||
|
|
||||||
|
* Fixed: [Using YANG union with decimal64 and string leads to regexp match fail #226](https://github.com/clicon/clixon/issues/226)
|
||||||
* Fixed: [xpath function count did not work properly #224](https://github.com/clicon/clixon/issues/224)
|
* Fixed: [xpath function count did not work properly #224](https://github.com/clicon/clixon/issues/224)
|
||||||
* Fixed: RESTCONF Native: Failed binding of socket in network namespace caused process zombie
|
* Fixed: RESTCONF Native: Failed binding of socket in network namespace caused process zombie
|
||||||
* Fixed problems with XPATH composite operations and functions in netconf get/get-config operations.
|
* Fixed problems with XPATH composite operations and functions in netconf get/get-config operations.
|
||||||
|
|
|
||||||
|
|
@ -2885,7 +2885,7 @@ yang_abs_schema_nodeid(yang_stmt *yn,
|
||||||
/* If p0 is NULL an entry will be: [i0] which needs to be transformed to [NULL:i0] */
|
/* If p0 is NULL an entry will be: [i0] which needs to be transformed to [NULL:i0] */
|
||||||
cv = NULL;
|
cv = NULL;
|
||||||
while ((cv = cvec_each(nodeid_cvv, cv)) != NULL){
|
while ((cv = cvec_each(nodeid_cvv, cv)) != NULL){
|
||||||
if (cv_type_get(cv) != CGV_STRING)
|
if (cv_type_get(cv) != CGV_STRING)
|
||||||
cv_type_set(cv, CGV_STRING);
|
cv_type_set(cv, CGV_STRING);
|
||||||
if ((str = cv_string_get(cv)) == NULL || !strlen(str)){
|
if ((str = cv_string_get(cv)) == NULL || !strlen(str)){
|
||||||
if (cv_string_set(cv, cv_name_get(cv)) < 0){
|
if (cv_string_set(cv, cv_name_get(cv)) < 0){
|
||||||
|
|
|
||||||
|
|
@ -743,10 +743,15 @@ static int ys_cv_validate_union(clicon_handle h,yang_stmt *ys, char **reason,
|
||||||
yang_stmt *yrestype, char *type, char *val, yang_stmt **ysubp);
|
yang_stmt *yrestype, char *type, char *val, yang_stmt **ysubp);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @param[out] reason If given and return val is 0, contains a malloced string
|
* @param[in] h Clixon handle
|
||||||
* @retval -1 Error (fatal), with errno set to indicate error
|
* @param[in] ys Yang statement (union)
|
||||||
* @retval 0 Validation not OK, malloced reason is returned. Free reason with free()
|
* @param[out] reason If given, and return value is 0, contains malloced string
|
||||||
* @retval 1 Validation OK
|
* param[in] yt One of the types in the union
|
||||||
|
* param[in] type Original type
|
||||||
|
* @param[in] val Value to match
|
||||||
|
* @retval -1 Error (fatal), with errno set to indicate error
|
||||||
|
* @retval 0 Validation not OK, malloced reason is returned. Free reason with free()
|
||||||
|
* @retval 1 Validation OK
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
ys_cv_validate_union_one(clicon_handle h,
|
ys_cv_validate_union_one(clicon_handle h,
|
||||||
|
|
@ -792,6 +797,8 @@ ys_cv_validate_union_one(clicon_handle h,
|
||||||
clicon_err(OE_UNIX, errno, "cv_new");
|
clicon_err(OE_UNIX, errno, "cv_new");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
if (cvtype == CGV_DEC64)
|
||||||
|
cv_dec64_n_set(cvt, fraction);
|
||||||
if (val == NULL){ /* Fail validation on NULL */
|
if (val == NULL){ /* Fail validation on NULL */
|
||||||
retval = 0;
|
retval = 0;
|
||||||
goto done;
|
goto done;
|
||||||
|
|
@ -828,21 +835,23 @@ ys_cv_validate_union_one(clicon_handle h,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Validate union
|
/*! Validate union
|
||||||
* @param[in] h Clixon handle
|
* @param[in] h Clixon handle
|
||||||
* @param[in] ys Yang statement (union)
|
* @param[in] ys Yang statement (union)
|
||||||
* @param[out] reason If given, and return value is 0, contains malloced string
|
* @param[out] reason If given, and return value is 0, contains malloced string
|
||||||
* @param[in] val Value to match
|
* param[in] yrestype Resolved Yang type
|
||||||
* @param[out] ysubp Sub-type of ys that matches val
|
* param[in] type Original type
|
||||||
* @retval -1 Error (fatal), with errno set to indicate error
|
* @param[in] val Value to match
|
||||||
* @retval 0 Validation not OK, malloced reason is returned. Free reason with free()
|
* @param[out] ysubp Sub-type of ys that matches val
|
||||||
* @retval 1 Validation OK
|
* @retval -1 Error (fatal), with errno set to indicate error
|
||||||
|
* @retval 0 Validation not OK, malloced reason is returned. Free reason with free()
|
||||||
|
* @retval 1 Validation OK
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
ys_cv_validate_union(clicon_handle h,
|
ys_cv_validate_union(clicon_handle h,
|
||||||
yang_stmt *ys,
|
yang_stmt *ys,
|
||||||
char **reason,
|
char **reason,
|
||||||
yang_stmt *yrestype,
|
yang_stmt *yrestype,
|
||||||
char *type, /* orig type */
|
char *type,
|
||||||
char *val,
|
char *val,
|
||||||
yang_stmt **ysubp)
|
yang_stmt **ysubp)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue