diff --git a/apps/restconf/restconf_main_native.c b/apps/restconf/restconf_main_native.c index 4c5e4e22..9cb6af8b 100644 --- a/apps/restconf/restconf_main_native.c +++ b/apps/restconf/restconf_main_native.c @@ -138,6 +138,7 @@ #include #include #include +#include #include #include @@ -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; diff --git a/yang/clixon/clixon-restconf@2021-03-15.yang b/yang/clixon/clixon-restconf@2021-03-15.yang index 25ec9b21..ef0604da 100644 --- a/yang/clixon/clixon-restconf@2021-03-15.yang +++ b/yang/clixon/clixon-restconf@2021-03-15.yang @@ -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;