From: Christian Hopps Date: Sun, 11 Jun 2023 21:53:10 +0000 (-0400) Subject: vtysh: stop reading config file if user `exit`s from root level. X-Git-Tag: frr-9.0-rc~5^2~5 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=cfca317c597b61049ba9123281b393ade48ca1b6;p=matthieu%2Ffrr.git vtysh: stop reading config file if user `exit`s from root level. This is required to make sure that we properly send the XFRR_end_configuration tag to the daemons. Previously if the user had an `exit` at the root level the parser would just drop out of the config node and so XFRR_end_configuration, even if sent, would be ignored Signed-off-by: Christian Hopps (cherry picked from commit 315e9032e4087494063bbc6f7f52ec8c3d3ce757) --- diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 04f7ff65e9..c94b47fef5 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -880,6 +880,13 @@ int vtysh_config_from_file(struct vty *vty, FILE *fp) if (strmatch(vty_buf_trimmed, "end")) continue; + if (strmatch(vty_buf_trimmed, "exit") && + vty->node == CONFIG_NODE) { + fprintf(stderr, "line %d: Warning[%d]...: %s\n", lineno, + vty->node, "early exit from config file"); + break; + } + ret = command_config_read_one_line(vty, &cmd, lineno, 1); switch (ret) {