From 07679ad98ab97a4b783f7ae54f88d4d70a5729de Mon Sep 17 00:00:00 2001 From: Igor Ryzhov Date: Sun, 8 Aug 2021 22:38:50 +0300 Subject: *: explicitly print "exit" at the end of every node config There is a possibility that the same line can be matched as a command in some node and its parent node. In this case, when reading the config, this line is always executed as a command of the child node. For example, with the following config: ``` router ospf network 193.168.0.0/16 area 0 ! mpls ldp discovery hello interval 111 ! ``` Line `mpls ldp` is processed as command `mpls ldp-sync` inside the `router ospf` node. This leads to a complete loss of `mpls ldp` node configuration. To eliminate this issue and all possible similar issues, let's print an explicit "exit" at the end of every node config. This commit also changes indentation for a couple of existing exit commands so that all existing commands are on the same level as their corresponding node-entering commands. Fixes #9206. Signed-off-by: Igor Ryzhov --- pimd/pim_instance.c | 2 +- pimd/pim_vty.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'pimd') diff --git a/pimd/pim_instance.c b/pimd/pim_instance.c index 6dda66b79..8a9527d7c 100644 --- a/pimd/pim_instance.c +++ b/pimd/pim_instance.c @@ -220,7 +220,7 @@ static int pim_vrf_config_write(struct vty *vty) pim_global_config_write_worker(pim, vty); if (vrf->vrf_id != VRF_DEFAULT) - vty_endframe(vty, " exit-vrf\n!\n"); + vty_endframe(vty, "exit-vrf\n!\n"); } return 0; diff --git a/pimd/pim_vty.c b/pimd/pim_vty.c index 95882cf58..e4dec9ee8 100644 --- a/pimd/pim_vty.c +++ b/pimd/pim_vty.c @@ -451,7 +451,7 @@ int pim_interface_config_write(struct vty *vty) pim_bfd_write_config(vty, ifp); ++writes; } - vty_endframe(vty, "!\n"); + vty_endframe(vty, "exit\n!\n"); ++writes; } } -- cgit v1.2.3