summaryrefslogtreecommitdiffstats
path: root/lib/command.c
diff options
context:
space:
mode:
authorChristian Hopps <chopps@labn.net>2023-05-03 06:41:19 +0200
committerChristian Hopps <chopps@labn.net>2023-05-04 20:48:59 +0200
commit3701780a15f90e9e64a32fd24bb8d2887b3a4ef9 (patch)
tree090451bdba5cca05e6cde063425a2933b24106af /lib/command.c
parentMerge pull request #13357 from Jafaral/fix_ospf_prop (diff)
downloadfrr-3701780a15f90e9e64a32fd24bb8d2887b3a4ef9.tar.xz
frr-3701780a15f90e9e64a32fd24bb8d2887b3a4ef9.zip
lib: log commands read from config file
When the user specifies `--command-log-always` in CLI arguments then also log commands executed from loading the config file. Signed-off-by: Christian Hopps <chopps@labn.net>
Diffstat (limited to 'lib/command.c')
-rw-r--r--lib/command.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/command.c b/lib/command.c
index 27cd3a04b..7a7ce3f5d 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -1303,6 +1303,14 @@ int config_from_file(struct vty *vty, FILE *fp, unsigned int *line_num)
while (fgets(vty->buf, VTY_BUFSIZ, fp)) {
++(*line_num);
+ if (vty_log_commands) {
+ int len = strlen(vty->buf);
+
+ /* now log the command */
+ zlog_notice("config-from-file# %.*s", len ? len - 1 : 0,
+ vty->buf);
+ }
+
ret = command_config_read_one_line(vty, NULL, *line_num, 0);
if (ret != CMD_SUCCESS && ret != CMD_WARNING