summaryrefslogtreecommitdiff
path: root/lib/vty.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/vty.c')
-rw-r--r--lib/vty.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/vty.c b/lib/vty.c
index 683c39f893..86d0a36aa0 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -2199,6 +2199,9 @@ void vty_close(struct vty *vty)
int i;
bool was_stdio = false;
+ /* Drop out of configure / transaction if needed. */
+ vty_config_exit(vty);
+
/* Cancel threads.*/
THREAD_OFF(vty->t_read);
THREAD_OFF(vty->t_write);
@@ -2242,9 +2245,6 @@ void vty_close(struct vty *vty)
list_delete(&vty->error);
}
- /* Check configure. */
- vty_config_exit(vty);
-
/* OK free vty. */
XFREE(MTYPE_VTY, vty);
@@ -2614,14 +2614,18 @@ void vty_config_exit(struct vty *vty)
cnode = vector_lookup(cmdvec, node);
node = cnode->parent_node;
}
- if (node != CONFIG_NODE) {
- vty_out(vty,
- "WARNING: vty_config_exit() from outside CONFIG_NODE!\n");
+ if (node != CONFIG_NODE)
+ /* called outside config, e.g. vty_close() in ENABLE_NODE */
return;
- }
while (vty->node != ENABLE_NODE)
+ /* will call vty_config_node_exit() below */
cmd_exit(vty);
+}
+
+int vty_config_node_exit(struct vty *vty)
+{
+ vty->xpath_index = 0;
/* Check if there's a pending confirmed commit. */
if (vty->t_confirmed_commit_timeout) {
@@ -2644,6 +2648,7 @@ void vty_config_exit(struct vty *vty)
}
vty->config = false;
+ return 1;
}
/* Master of the threads. */