diff options
-rw-r--r-- | include/osmocom/vty/vty.h | 1 | ||||
-rw-r--r-- | src/vty/vty.c | 8 |
2 files changed, 6 insertions, 3 deletions
diff --git a/include/osmocom/vty/vty.h b/include/osmocom/vty/vty.h index ffe3c591..83506c5e 100644 --- a/include/osmocom/vty/vty.h +++ b/include/osmocom/vty/vty.h @@ -176,6 +176,7 @@ int vty_shell_serv (struct vty *); void vty_hello (struct vty *); void *vty_current_index(struct vty *); int vty_current_node(struct vty *vty); +enum node_type vty_go_parent(struct vty *vty); extern void *tall_vty_ctx; 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; } |