summaryrefslogtreecommitdiff
path: root/lib/command.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2019-01-18 22:58:58 -0200
committerRenato Westphal <renato@opensourcerouting.org>2019-01-19 15:56:54 -0200
commit41e195d47732fab800ce4f8bfd0b88561d2fab74 (patch)
treebf6dff97d28d620b2976b091e759c609cbeb4a85 /lib/command.c
parent70fc94ca1d6063b64449b0971678521c021ac916 (diff)
lib: reset the vty xpath index when entering the config mode
The CLI code uses the vty->xpath[] array and the vty->xpath_index variables to keep track of where the user is in the configuration hierarchy. As such, we were resetting vty->xpath_index to zero whenever the user exited from the configuration mode in order to keep the index valid. We weren't doing this in the vty_stop_input() function however, which is called when the user types ^C in the terminal. This was leading to bugs like this: zebra> en zebra# conf t zebra(config)# interface eth0 zebra(config-if)# ^C zebra# conf t zebra(config)# interface eth0 % Configuration failed. Schema node not found. YANG path: /frr-interface:lib/interface[name='eth0'][vrf='default']/frr-interface:lib To fix this, do something more clever: instead of resetting the XPath index whenever the user exits from the configuration mode, do that when the user enters in the configuration mode. This way the XPath index needs to be reset in a single place only, not to mention it's a more robust solution. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'lib/command.c')
-rw-r--r--lib/command.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/lib/command.c b/lib/command.c
index d1dafa3a1a..7d20bae62a 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -1594,8 +1594,6 @@ DEFUN (config_end,
break;
}
- vty->xpath_index = 0;
-
return CMD_SUCCESS;
}