diff --git a/apps/backend/backend_client.c b/apps/backend/backend_client.c index fc619640..469f7652 100644 --- a/apps/backend/backend_client.c +++ b/apps/backend/backend_client.c @@ -1202,7 +1202,7 @@ from_client_msg(clicon_handle h, } reply: if (cbuf_len(cbret) == 0) - if (netconf_operation_failed(cbret, "application", clicon_err_reason)< 0) + if (netconf_operation_failed(cbret, "application", clicon_errno?clicon_err_reason:"unknown")< 0) goto done; clicon_debug(1, "%s cbret:%s", __FUNCTION__, cbuf_get(cbret)); /* XXX problem here is that cbret has not been parsed so may contain diff --git a/apps/cli/cli_common.c b/apps/cli/cli_common.c index 4979f412..a80c722d 100644 --- a/apps/cli/cli_common.c +++ b/apps/cli/cli_common.c @@ -427,6 +427,38 @@ int cli_debug_backendv(clicon_handle h, cvec *vars, cvec *argv) return cli_debug_backend(h, vars, argv); } +/*! Set debug level on restconf daemon + * @param[in] h Clicon handle + * @param[in] vars If variable "level" exists, its integer value is used + * @param[in] arg Else use the integer value of argument + * @note The level is either what is specified in arg as int argument. + * _or_ if a 'level' variable is present in vars use that value instead. + */ +int +cli_debug_restconf(clicon_handle h, + cvec *vars, + cvec *argv) +{ + int retval = -1; + cg_var *cv; + int level; + + if ((cv = cvec_find_var(vars, "level")) == NULL){ + if (cvec_len(argv) != 1){ + clicon_err(OE_PLUGIN, 0, "%s: Requires either label var or single arg: 0|1", __FUNCTION__); + goto done; + } + cv = cvec_i(argv, 0); + } + level = cv_int32_get(cv); + /* restconf daemon */ + if (0) /* XXX notyet */ + retval = clicon_rpc_debug(h, level); + done: + return retval; +} + + /*! Set syntax mode */ int diff --git a/apps/cli/clixon_cli_api.h b/apps/cli/clixon_cli_api.h index 9c0ececf..3946cfdc 100644 --- a/apps/cli/clixon_cli_api.h +++ b/apps/cli/clixon_cli_api.h @@ -89,6 +89,8 @@ int cli_debug_cliv(clicon_handle h, cvec *vars, cvec *argv); int cli_debug_backend(clicon_handle h, cvec *vars, cvec *argv); int cli_debug_backendv(clicon_handle h, cvec *vars, cvec *argv); +int cli_debug_restconf(clicon_handle h, cvec *vars, cvec *argv); + int cli_set_mode(clicon_handle h, cvec *vars, cvec *argv); int cli_set_modev(clicon_handle h, cvec *vars, cvec *argv); diff --git a/lib/src/clixon_plugin.c b/lib/src/clixon_plugin.c index c8ce70e7..a0f2a4d3 100644 --- a/lib/src/clixon_plugin.c +++ b/lib/src/clixon_plugin.c @@ -126,7 +126,7 @@ clixon_plugin_each_revert(clicon_handle h, int nr) { int i; - clixon_plugin *cp; + clixon_plugin *cp = NULL; clixon_plugin *cpnext = NULL; if (cpprev == NULL) @@ -466,7 +466,7 @@ rpc_callback_delete_all(void) * @param[in] h clicon handle * @param[in] xn Sub-tree (under xorig) at child of rpc: . * @param[out] xret Return XML, error or OK - * @param[in] arg Domain-speific arg (eg client_entry) + * @param[in] arg Domain-speific arg (eg client_entry) * * @retval -1 Error * @retval 0 OK, not found handler. diff --git a/lib/src/clixon_xml_map.c b/lib/src/clixon_xml_map.c index 1be9d750..60ea29a6 100644 --- a/lib/src/clixon_xml_map.c +++ b/lib/src/clixon_xml_map.c @@ -394,6 +394,7 @@ xml_yang_validate_all(cxobj *xt, * @param[out] cvv CLIgen variable vector. Should be freed by cvec_free() * @retval 0 Everything OK, cvv allocated and set * @retval -1 Something wrong, clicon_err() called to set error. No cvv returned + * @note cvv Should be freed by cvec_free() after use. * 'Not recursive' means that only one level of XML bodies is translated to cvec:s. * If range is wriong (eg 1000 for uint8) a warning is logged, the value is * skipped, and continues. @@ -426,7 +427,7 @@ xml2cvec(cxobj *xt, char *name; xc = NULL; - /* Tried to allocate whole cvv here,but some cg_vars may be invalid */ + /* Tried to allocate whole cvv here, but some cg_vars may be invalid */ if ((cvv = cvec_new(0)) == NULL){ clicon_err(OE_UNIX, errno, "cvec_new"); goto err; diff --git a/lib/src/clixon_xsl.c b/lib/src/clixon_xsl.c index 22be2b63..cef4bcfb 100644 --- a/lib/src/clixon_xsl.c +++ b/lib/src/clixon_xsl.c @@ -976,10 +976,10 @@ xpath_first(cxobj *xcur, * } * @endcode * - * Note that the returned pointer points into the original tree so should not be freed + * @note The returned pointer points into the original tree so should not be freed * after use. * @see also xpath, xpath_vec. - * NOTE: uses a static variable: consider replacing with xpath_vec() instead + * @note uses a static variable: consider replacing with xpath_vec() instead */ cxobj * xpath_each(cxobj *xcur,