Merge pull request #203 from dcornejo/master

Add ability to enable core dumps from RESTCONF process
This commit is contained in:
Olof Hagsand 2021-04-15 20:00:30 +02:00 committed by GitHub
commit 51df120e9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 1 deletions

View file

@ -138,6 +138,7 @@
#include <sys/stat.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <sys/resource.h>
#include <openssl/ssl.h>
#include <openssl/rand.h>
@ -1448,6 +1449,21 @@ restconf_openssl_init(clicon_handle h,
yang_spec_dump(clicon_dbspec_yang(h), dbg);
}
}
if ((x = xpath_first(xrestconf, nsc, "enable-core-dump")) != NULL) {
/* core dump is enabled on RESTCONF process */
struct rlimit rlp;
if (strcmp(xml_body(x), "true") == 0) {
rlp.rlim_cur = RLIM_INFINITY;
rlp.rlim_max = RLIM_INFINITY;
} else {
rlp.rlim_cur = 0;
rlp.rlim_max = 0;
}
int status = setrlimit(RLIMIT_CORE, &rlp);
if (status != 0) {
clicon_log(LOG_NOTICE, "%s: setrlimit() failed, %s", __func__, strerror(errno));
}
}
if (init_openssl() < 0)
goto done;

View file

@ -45,7 +45,8 @@ module clixon-restconf {
revision 2021-03-15 {
description
"make authentication-type none a feature";
"make authentication-type none a feature
Added flag to enable core dumps";
}
revision 2020-12-30 {
description
@ -127,6 +128,13 @@ module clixon-restconf {
type uint32;
default 0;
}
leaf enable-core-dump {
description
"enable core dumps.
this is a no-op on systems that don't support it.";
type boolean;
default false;
}
leaf pretty {
type boolean;
default true;