summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/command.c13
-rw-r--r--lib/compiler.h17
-rw-r--r--lib/vty.c1
3 files changed, 25 insertions, 6 deletions
diff --git a/lib/command.c b/lib/command.c
index e5e0623163..0e16f30a8a 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -1053,9 +1053,16 @@ static int cmd_execute_command_real(vector vline, enum cmd_filter_type filter,
if (matched_element->daemon)
ret = CMD_SUCCESS_DAEMON;
else {
- /* Clear enqueued configuration changes. */
- vty->num_cfg_changes = 0;
- memset(&vty->cfg_changes, 0, sizeof(vty->cfg_changes));
+ if (vty->config) {
+ /* Clear array of enqueued configuration changes. */
+ vty->num_cfg_changes = 0;
+ memset(&vty->cfg_changes, 0, sizeof(vty->cfg_changes));
+
+ /* Regenerate candidate configuration. */
+ if (frr_get_cli_mode() == FRR_CLI_CLASSIC)
+ nb_config_replace(vty->candidate_config,
+ running_config, true);
+ }
ret = matched_element->func(matched_element, vty, argc, argv);
}
diff --git a/lib/compiler.h b/lib/compiler.h
index 9ce91e3361..696fb0d040 100644
--- a/lib/compiler.h
+++ b/lib/compiler.h
@@ -173,6 +173,11 @@ extern "C" {
#endif
#endif
+#ifdef container_of
+#undef container_of
+#endif
+
+#if !(defined(__cplusplus) || defined(test__cplusplus))
/* this variant of container_of() retains 'const' on pointers without needing
* to be told to do so. The following will all work without warning:
*
@@ -191,9 +196,6 @@ extern "C" {
* struct cont *x = container_of(cp, const struct cont, member);
* struct cont *x = container_of(p, const struct cont, member);
*/
-#ifdef container_of
-#undef container_of
-#endif
#define container_of(ptr, type, member) \
(__builtin_choose_expr( \
__builtin_types_compatible_p(typeof(&((type *)0)->member), \
@@ -209,6 +211,15 @@ extern "C" {
offsetof(type, member)); \
}) \
))
+#else
+/* current C++ compilers don't have the builtins used above; so this version
+ * of the macro doesn't do the const check. */
+#define container_of(ptr, type, member) \
+ ({ \
+ const typeof(((type *)0)->member) *__mptr = (ptr); \
+ (type *)((char *)__mptr - offsetof(type, member)); \
+ })
+#endif
#define container_of_null(ptr, type, member) \
({ \
diff --git a/lib/vty.c b/lib/vty.c
index e306e69b87..d0605b49b4 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -2289,6 +2289,7 @@ static void vty_read_file(struct nb_config *config, FILE *confp)
vty->wfd = STDERR_FILENO;
vty->type = VTY_FILE;
vty->node = CONFIG_NODE;
+ vty->config = true;
if (config)
vty->candidate_config = config;
else {