diff --git a/CHANGELOG.md b/CHANGELOG.md index f80b26e3..8e27e691 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,8 @@ Expected: October 2023 ### Minor features +* Removed sending restconf config inline using -R when CLICON_BACKEND_RESTCONF_PROCESS=true + * Define RESTCONF_INLINE to revert * Clarified clixon_cli command-line: `clixon_cli [options] [commands] [-- extra-options]` ### Corrected Bugs diff --git a/apps/backend/backend_plugin_restconf.c b/apps/backend/backend_plugin_restconf.c index db6b5b2e..83ec2ed4 100644 --- a/apps/backend/backend_plugin_restconf.c +++ b/apps/backend/backend_plugin_restconf.c @@ -147,7 +147,6 @@ restconf_pseudo_set_inline(clicon_handle h, char **argv; int argc; int i; - char *str = NULL; cxobj *xrestconf; cbuf *cb = NULL; @@ -158,6 +157,8 @@ restconf_pseudo_set_inline(clicon_handle h, for (i=0; i i+1 && argv[i+1]){ if ((cb = cbuf_new()) == NULL){ clicon_err(OE_XML, errno, "cbuf_new"); @@ -175,6 +176,7 @@ restconf_pseudo_set_inline(clicon_handle h, argv[i+1] = str; break; } +#endif } retval = 0; done: @@ -253,7 +255,10 @@ restconf_pseudo_process_control(clicon_handle h) struct stat fstat; int found = 0; - nr = 10; + nr = 8; /* pgm -f -D -l NULL */ +#ifdef RESTCONF_INLINE + nr += 2; +#endif if ((argv = calloc(nr, sizeof(char *))) == NULL){ clicon_err(OE_UNIX, errno, "calloc"); goto done; @@ -307,8 +312,10 @@ restconf_pseudo_process_control(clicon_handle h) argv[i++] = "0"; argv[i++] = "-l"; argv[i++] = "s"; /* There is also log-destination in clixon-restconf.yang */ +#ifdef RESTCONF_INLINE argv[i++] = "-R"; - argv[i++] = ""; + argv[i++] = ""; /* The content is set in restconf_pseudo_set_inline */ +#endif argv[i++] = NULL; assert(i==nr); if (clixon_process_register(h, RESTCONF_PROCESS, @@ -374,7 +381,7 @@ restconf_pseudo_process_commit(clicon_handle h, if (xpath_first(xtarget, NULL, "/restconf[enable='true']") != NULL) enabled++; /* Get debug flag of restconf config, set the restconf start -D daemon flag according - * to it. The restconf daemon cannoit read its debug flag from config initially, + * to it. The restconf daemon cannot read its debug flag from config initially, * but in this way it is set directly in its input args. * Its a trick. */ diff --git a/include/clixon_custom.h b/include/clixon_custom.h index 5e0158c5..6ae3e568 100644 --- a/include/clixon_custom.h +++ b/include/clixon_custom.h @@ -180,3 +180,12 @@ * Disabled does not work */ #define YANG_GROUPING_AUGMENT_SKIP + +/*! Start of restconf from backend (when CLICON_BACKEND_RESTCONF_PROCESS=true) using -R + * + * If set, send initial restconf config via -R parameter at fork/exec. + * Seems to be only an optimization since the config is queried from the backend anyway + * The reason this probably should be undef:ed is that the restconf config appears in ps and other in + * cleartext + */ +#undef RESTCONF_INLINE