From 4abda9ea26403e24b2d91b83a1e4c81f5fb4b003 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Thu, 21 Nov 2019 00:19:36 +0700 Subject: logging/vty: fix: actually ignore deprecated logging commands We shall not prevent programs from starting if their configuration files contain deprecated 'logging level ...' commands. Just print a warning and return CMD_SUCCESS instead of CMD_WARNING. While writing a unit test, another funny bug has been uncovered. Parsing of a deprecated command indeed triggers a deprecation warning, originated from libosmovty's log_deprecated_func(). This function simply calls vty_out(), but... Since the invocation of the vty_out() happens _before_ the VTY is initialized, the process is actually writing that warning to its own stdin! Most likely, because we use talloc_zero() to allocate a new instance of struct 'vty'. As a side effect, the evil warning magically appears in the output of 'make check', breaking the test statistics. Let's work around this bug for now by redirecting stdin to /dev/null. Change-Id: Ia934581410cd41594791d4e14ee74c16abe1009a Fixes: Ic9c1b566ec4a459f03e6319cf369691903cf9d00 --- src/vty/logging_vty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/vty') diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c index b4c3776e..6d908d9e 100644 --- a/src/vty/logging_vty.c +++ b/src/vty/logging_vty.c @@ -998,7 +998,7 @@ static int config_write_log(struct vty *vty) static int log_deprecated_func(struct cmd_element *cmd, struct vty *vty, int argc, const char *argv[]) { vty_out(vty, "%% Ignoring deprecated '%s'%s", cmd->string, VTY_NEWLINE); - return CMD_WARNING; + return CMD_SUCCESS; /* Otherwise the process would terminate */ } void logging_vty_add_deprecated_subsys(void *ctx, const char *name) -- cgit v1.2.3