summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas.Eversberg <jolly@eversberg.eu>2011-11-10 23:09:35 +0100
committerHarald Welte <laforge@gnumonks.org>2011-11-12 23:23:36 +0100
commitf948dbc442c44c402d6559bdd746f5ef8d01fff2 (patch)
tree609e49ccbe175144070371f53567023d817e16c9 /src
parentdc3be0a6533be782c76f23ce653f4fc683b3b4f1 (diff)
vty: Fixed vty_down_level to move down from config nodes
When using ^D at config nodes above the CONFIG_NODE, the go_parent_cb function is used to go down by one node. This is equivalent to "exit" command. Written-by: Andreas.Eversberg <jolly@eversberg.eu> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'src')
-rw-r--r--src/vty/vty.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/vty/vty.c b/src/vty/vty.c
index 5f5e6a4c..da035969 100644
--- a/src/vty/vty.c
+++ b/src/vty/vty.c
@@ -802,9 +802,11 @@ static void vty_backward_word(struct vty *vty)
static void vty_down_level(struct vty *vty)
{
vty_out(vty, "%s", VTY_NEWLINE);
- /* FIXME: we need to call the exit function of the specific node
- * in question, not this generic one that doesn't know all nodes */
- (*config_exit_cmd.func) (NULL, vty, 0, NULL);
+ /* call the exit function of the specific node */
+ if (vty->node > CONFIG_NODE)
+ vty_go_parent(vty);
+ else
+ (*config_exit_cmd.func) (NULL, vty, 0, NULL);
vty_prompt(vty);
vty->cp = 0;
}