* New clixon-config@2022-02-11.yang revision
* Added option: `CLICON_LOG_STRING_LIMIT`
This commit is contained in:
parent
396680d0b3
commit
6ae749c9dd
11 changed files with 1204 additions and 9 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
# Clixon Changelog
|
# Clixon Changelog
|
||||||
|
|
||||||
* [5.6.0](#560) Expected: Matrch 2022
|
* [5.6.0](#560) Expected: March 2022
|
||||||
* [5.5.0](#550) 20 January 2022
|
* [5.5.0](#550) 20 January 2022
|
||||||
* [5.4.0](#540) 30 November 2021
|
* [5.4.0](#540) 30 November 2021
|
||||||
* [5.3.0](#530) 27 September 2021
|
* [5.3.0](#530) 27 September 2021
|
||||||
|
|
@ -49,6 +49,13 @@ Users may have to change how they access the system
|
||||||
* `configure --with-wwwdir=<dir>` is removed
|
* `configure --with-wwwdir=<dir>` is removed
|
||||||
* Command field of clixon-lib:process-control RPC reply used CDATA encoding but now uses regular XML encoding
|
* Command field of clixon-lib:process-control RPC reply used CDATA encoding but now uses regular XML encoding
|
||||||
|
|
||||||
|
### Minor features
|
||||||
|
|
||||||
|
* New `clixon-config@2022-02-11.yang` revision
|
||||||
|
* Added option: `CLICON_LOG_STRING_LIMIT`
|
||||||
|
* Limit the length of log and debug messages. Some log messages are dependendent on sizes that can be very large, such as packet lengths. This new option constrains the length of all messgaes. By default no limits.
|
||||||
|
|
||||||
|
|
||||||
### Corrected Bugs
|
### Corrected Bugs
|
||||||
|
|
||||||
* Fixed: input RPC validation of choice (non-case)
|
* Fixed: input RPC validation of choice (non-case)
|
||||||
|
|
|
||||||
|
|
@ -509,6 +509,7 @@ main(int argc,
|
||||||
size_t cligen_buflen;
|
size_t cligen_buflen;
|
||||||
size_t cligen_bufthreshold;
|
size_t cligen_bufthreshold;
|
||||||
int dbg;
|
int dbg;
|
||||||
|
size_t sz;
|
||||||
|
|
||||||
/* In the startup, logs to stderr & syslog and debug flag set later */
|
/* In the startup, logs to stderr & syslog and debug flag set later */
|
||||||
clicon_log_init(__PROGRAM__, LOG_INFO, logdst);
|
clicon_log_init(__PROGRAM__, LOG_INFO, logdst);
|
||||||
|
|
@ -690,6 +691,9 @@ main(int argc,
|
||||||
cligen_buflen = clicon_option_int(h, "CLICON_CLI_BUF_START");
|
cligen_buflen = clicon_option_int(h, "CLICON_CLI_BUF_START");
|
||||||
cligen_bufthreshold = clicon_option_int(h, "CLICON_CLI_BUF_THRESHOLD");
|
cligen_bufthreshold = clicon_option_int(h, "CLICON_CLI_BUF_THRESHOLD");
|
||||||
cbuf_alloc_set(cligen_buflen, cligen_bufthreshold);
|
cbuf_alloc_set(cligen_buflen, cligen_bufthreshold);
|
||||||
|
|
||||||
|
if ((sz = clicon_option_int(h, "CLICON_LOG_STRING_LIMIT")) != 0)
|
||||||
|
clicon_log_string_limit_set(sz);
|
||||||
|
|
||||||
#ifndef HAVE_LIBXML2
|
#ifndef HAVE_LIBXML2
|
||||||
if (clicon_yang_regexp(h) == REGEXP_LIBXML2){
|
if (clicon_yang_regexp(h) == REGEXP_LIBXML2){
|
||||||
|
|
|
||||||
|
|
@ -648,6 +648,9 @@ main(int argc,
|
||||||
cligen_helpstring_truncate_set(cli_cligen(h), nr);
|
cligen_helpstring_truncate_set(cli_cligen(h), nr);
|
||||||
nr = clicon_option_int(h, "CLICON_CLI_HELPSTRING_LINES");
|
nr = clicon_option_int(h, "CLICON_CLI_HELPSTRING_LINES");
|
||||||
cligen_helpstring_lines_set(cli_cligen(h), nr);
|
cligen_helpstring_lines_set(cli_cligen(h), nr);
|
||||||
|
|
||||||
|
if ((nr = clicon_option_int(h, "CLICON_LOG_STRING_LIMIT")) != 0)
|
||||||
|
clicon_log_string_limit_set(nr);
|
||||||
|
|
||||||
/* Setup signal handlers */
|
/* Setup signal handlers */
|
||||||
cli_signal_init(h);
|
cli_signal_init(h);
|
||||||
|
|
|
||||||
|
|
@ -662,6 +662,7 @@ main(int argc,
|
||||||
size_t cligen_buflen;
|
size_t cligen_buflen;
|
||||||
size_t cligen_bufthreshold;
|
size_t cligen_bufthreshold;
|
||||||
int dbg = 0;
|
int dbg = 0;
|
||||||
|
size_t sz;
|
||||||
|
|
||||||
/* Create handle */
|
/* Create handle */
|
||||||
if ((h = clicon_handle_init()) == NULL)
|
if ((h = clicon_handle_init()) == NULL)
|
||||||
|
|
@ -791,6 +792,9 @@ main(int argc,
|
||||||
cligen_bufthreshold = clicon_option_int(h, "CLICON_CLI_BUF_THRESHOLD");
|
cligen_bufthreshold = clicon_option_int(h, "CLICON_CLI_BUF_THRESHOLD");
|
||||||
cbuf_alloc_set(cligen_buflen, cligen_bufthreshold);
|
cbuf_alloc_set(cligen_buflen, cligen_bufthreshold);
|
||||||
|
|
||||||
|
if ((sz = clicon_option_int(h, "CLICON_LOG_STRING_LIMIT")) != 0)
|
||||||
|
clicon_log_string_limit_set(sz);
|
||||||
|
|
||||||
/* Set default namespace according to CLICON_NAMESPACE_NETCONF_DEFAULT */
|
/* Set default namespace according to CLICON_NAMESPACE_NETCONF_DEFAULT */
|
||||||
xml_nsctx_namespace_netconf_default(h);
|
xml_nsctx_namespace_netconf_default(h);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -312,6 +312,7 @@ main(int argc,
|
||||||
cxobj *xerr = NULL;
|
cxobj *xerr = NULL;
|
||||||
char *wwwuser;
|
char *wwwuser;
|
||||||
char *inline_config = NULL;
|
char *inline_config = NULL;
|
||||||
|
size_t sz;
|
||||||
|
|
||||||
/* In the startup, logs to stderr & debug flag set later */
|
/* In the startup, logs to stderr & debug flag set later */
|
||||||
clicon_log_init(__PROGRAM__, LOG_INFO, logdst);
|
clicon_log_init(__PROGRAM__, LOG_INFO, logdst);
|
||||||
|
|
@ -438,6 +439,9 @@ main(int argc,
|
||||||
cligen_bufthreshold = clicon_option_int(h, "CLICON_CLI_BUF_THRESHOLD");
|
cligen_bufthreshold = clicon_option_int(h, "CLICON_CLI_BUF_THRESHOLD");
|
||||||
cbuf_alloc_set(cligen_buflen, cligen_bufthreshold);
|
cbuf_alloc_set(cligen_buflen, cligen_bufthreshold);
|
||||||
|
|
||||||
|
if ((sz = clicon_option_int(h, "CLICON_LOG_STRING_LIMIT")) != 0)
|
||||||
|
clicon_log_string_limit_set(sz);
|
||||||
|
|
||||||
/* Set default namespace according to CLICON_NAMESPACE_NETCONF_DEFAULT */
|
/* Set default namespace according to CLICON_NAMESPACE_NETCONF_DEFAULT */
|
||||||
xml_nsctx_namespace_netconf_default(h);
|
xml_nsctx_namespace_netconf_default(h);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1210,6 +1210,7 @@ restconf_clixon_init(clicon_handle h,
|
||||||
cxobj *xrestconf = NULL;
|
cxobj *xrestconf = NULL;
|
||||||
cxobj *xerr = NULL;
|
cxobj *xerr = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
|
size_t sz;
|
||||||
|
|
||||||
/* Set default namespace according to CLICON_NAMESPACE_NETCONF_DEFAULT */
|
/* Set default namespace according to CLICON_NAMESPACE_NETCONF_DEFAULT */
|
||||||
xml_nsctx_namespace_netconf_default(h);
|
xml_nsctx_namespace_netconf_default(h);
|
||||||
|
|
@ -1219,6 +1220,9 @@ restconf_clixon_init(clicon_handle h,
|
||||||
cligen_bufthreshold = clicon_option_int(h, "CLICON_CLI_BUF_THRESHOLD");
|
cligen_bufthreshold = clicon_option_int(h, "CLICON_CLI_BUF_THRESHOLD");
|
||||||
cbuf_alloc_set(cligen_buflen, cligen_bufthreshold);
|
cbuf_alloc_set(cligen_buflen, cligen_bufthreshold);
|
||||||
|
|
||||||
|
if ((sz = clicon_option_int(h, "CLICON_LOG_STRING_LIMIT")) != 0)
|
||||||
|
clicon_log_string_limit_set(sz);
|
||||||
|
|
||||||
/* Add (hardcoded) netconf features in case ietf-netconf loaded here
|
/* Add (hardcoded) netconf features in case ietf-netconf loaded here
|
||||||
* Otherwise it is loaded in netconf_module_load below
|
* Otherwise it is loaded in netconf_module_load below
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,8 @@ int clicon_log_init(char *ident, int upto, int flags);
|
||||||
int clicon_log_exit(void);
|
int clicon_log_exit(void);
|
||||||
int clicon_log_opt(char c);
|
int clicon_log_opt(char c);
|
||||||
int clicon_log_file(char *filename);
|
int clicon_log_file(char *filename);
|
||||||
|
int clicon_log_string_limit_set(size_t sz);
|
||||||
|
size_t clicon_log_string_limit_get(void);
|
||||||
int clicon_get_logflags(void);
|
int clicon_get_logflags(void);
|
||||||
int clicon_log(int level, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
|
int clicon_log(int level, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
|
||||||
int clicon_debug(int dbglevel, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
|
int clicon_debug(int dbglevel, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,9 @@ static int _logflags = 0x0;
|
||||||
/* Set to open file to write debug messages directly to file */
|
/* Set to open file to write debug messages directly to file */
|
||||||
static FILE *_logfile = NULL;
|
static FILE *_logfile = NULL;
|
||||||
|
|
||||||
|
/* Truncate debug strings to this length. 0 means unlimited */
|
||||||
|
static int _clixon_log_trunc = 0;
|
||||||
|
|
||||||
/*! Initialize system logger.
|
/*! Initialize system logger.
|
||||||
*
|
*
|
||||||
* Make syslog(3) calls with specified ident and gates calls of level upto specified level (upto).
|
* Make syslog(3) calls with specified ident and gates calls of level upto specified level (upto).
|
||||||
|
|
@ -165,6 +168,23 @@ clicon_get_logflags(void)
|
||||||
return _logflags;
|
return _logflags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Truncate log/debug string length
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
clicon_log_string_limit_set(size_t sz)
|
||||||
|
{
|
||||||
|
_clixon_log_trunc = sz;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*! Get truncate log/debug string length
|
||||||
|
*/
|
||||||
|
size_t
|
||||||
|
clicon_log_string_limit_get(void)
|
||||||
|
{
|
||||||
|
return _clixon_log_trunc;
|
||||||
|
}
|
||||||
|
|
||||||
/*! Mimic syslog and print a time on file f
|
/*! Mimic syslog and print a time on file f
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
|
|
@ -254,22 +274,28 @@ clicon_log_str(int level,
|
||||||
* @code
|
* @code
|
||||||
clicon_log(LOG_NOTICE, "%s: dump to dtd not supported", __PROGRAM__);
|
clicon_log(LOG_NOTICE, "%s: dump to dtd not supported", __PROGRAM__);
|
||||||
* @endcode
|
* @endcode
|
||||||
* @see clicon_log_init and clicon_log_str
|
* @see clicon_log_init clicon_log_str
|
||||||
|
* @see clicon_log_xml
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
clicon_log(int level,
|
clicon_log(int level,
|
||||||
const char *format, ...)
|
const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
int len;
|
size_t len;
|
||||||
char *msg = NULL;
|
char *msg = NULL;
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
size_t trunc;
|
||||||
|
|
||||||
/* first round: compute length of debug message */
|
/* first round: compute length of debug message */
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
len = vsnprintf(NULL, 0, format, args);
|
len = vsnprintf(NULL, 0, format, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
|
/* Truncate long debug strings */
|
||||||
|
if ((trunc = clicon_log_string_limit_get()) && trunc < len)
|
||||||
|
len = trunc;
|
||||||
|
|
||||||
/* allocate a message string exactly fitting the message length */
|
/* allocate a message string exactly fitting the message length */
|
||||||
if ((msg = malloc(len+1)) == NULL){
|
if ((msg = malloc(len+1)) == NULL){
|
||||||
fprintf(stderr, "malloc: %s\n", strerror(errno)); /* dont use clicon_err here due to recursion */
|
fprintf(stderr, "malloc: %s\n", strerror(errno)); /* dont use clicon_err here due to recursion */
|
||||||
|
|
@ -349,10 +375,11 @@ clicon_debug(int dbglevel,
|
||||||
const char *format, ...)
|
const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
int len;
|
size_t len;
|
||||||
char *msg = NULL;
|
char *msg = NULL;
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
size_t trunc;
|
||||||
|
|
||||||
if (dbglevel > _clixon_debug) /* compare debug mask with global variable */
|
if (dbglevel > _clixon_debug) /* compare debug mask with global variable */
|
||||||
return 0;
|
return 0;
|
||||||
/* first round: compute length of debug message */
|
/* first round: compute length of debug message */
|
||||||
|
|
@ -360,7 +387,11 @@ clicon_debug(int dbglevel,
|
||||||
len = vsnprintf(NULL, 0, format, args);
|
len = vsnprintf(NULL, 0, format, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
/* allocate a message string exactly fitting the messgae length */
|
/* Truncate long debug strings */
|
||||||
|
if ((trunc = clicon_log_string_limit_get()) && trunc < len)
|
||||||
|
len = trunc;
|
||||||
|
|
||||||
|
/* allocate a message string exactly fitting the message length */
|
||||||
if ((msg = malloc(len+1)) == NULL){
|
if ((msg = malloc(len+1)) == NULL){
|
||||||
clicon_err(OE_UNIX, errno, "malloc");
|
clicon_err(OE_UNIX, errno, "malloc");
|
||||||
goto done;
|
goto done;
|
||||||
|
|
|
||||||
|
|
@ -2339,10 +2339,11 @@ clicon_log_xml(int level,
|
||||||
const char *format, ...)
|
const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
int len;
|
size_t len;
|
||||||
char *msg = NULL;
|
char *msg = NULL;
|
||||||
cbuf *cb = NULL;
|
cbuf *cb = NULL;
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
size_t trunc;
|
||||||
|
|
||||||
/* Print xml as cbuf */
|
/* Print xml as cbuf */
|
||||||
if ((cb = cbuf_new()) == NULL){
|
if ((cb = cbuf_new()) == NULL){
|
||||||
|
|
@ -2357,6 +2358,10 @@ clicon_log_xml(int level,
|
||||||
len = vsnprintf(NULL, 0, format, args);
|
len = vsnprintf(NULL, 0, format, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
|
/* Truncate long debug strings */
|
||||||
|
if ((trunc = clicon_log_string_limit_get()) && trunc < len)
|
||||||
|
len = trunc;
|
||||||
|
|
||||||
/* allocate a message string exactly fitting the message length */
|
/* allocate a message string exactly fitting the message length */
|
||||||
if ((msg = malloc(len+1)) == NULL){
|
if ((msg = malloc(len+1)) == NULL){
|
||||||
fprintf(stderr, "malloc: %s\n", strerror(errno)); /* dont use clicon_err here due to recursion */
|
fprintf(stderr, "malloc: %s\n", strerror(errno)); /* dont use clicon_err here due to recursion */
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,7 @@ datarootdir = @datarootdir@
|
||||||
# Also mandatory standard YANGs (see ../mandatory)
|
# Also mandatory standard YANGs (see ../mandatory)
|
||||||
YANG_INSTALLDIR = @YANG_INSTALLDIR@
|
YANG_INSTALLDIR = @YANG_INSTALLDIR@
|
||||||
|
|
||||||
YANGSPECS = clixon-config@2021-07-11.yang # 5.3
|
YANGSPECS = clixon-config@2022-02-11.yang # 5.6
|
||||||
YANGSPECS = clixon-config@2021-12-05.yang # 5.5
|
|
||||||
YANGSPECS += clixon-lib@2021-12-05.yang # 5.5
|
YANGSPECS += clixon-lib@2021-12-05.yang # 5.5
|
||||||
YANGSPECS += clixon-rfc5277@2008-07-01.yang
|
YANGSPECS += clixon-rfc5277@2008-07-01.yang
|
||||||
YANGSPECS += clixon-xml-changelog@2019-03-21.yang
|
YANGSPECS += clixon-xml-changelog@2019-03-21.yang
|
||||||
|
|
|
||||||
1132
yang/clixon/clixon-config@2022-02-11.yang
Normal file
1132
yang/clixon/clixon-config@2022-02-11.yang
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue