vty: Everything <= CONFIG_NODE is not a child of config
authorHolger Hans Peter Freyther <zecke@selfish.org>
Sat, 4 Sep 2010 03:19:39 +0000 (11:19 +0800)
committerHolger Hans Peter Freyther <zecke@selfish.org>
Sat, 4 Sep 2010 03:22:45 +0000 (11:22 +0800)
The method should be renamed to is child of config node
as it was comparing if vty->node > CONFIG_NODE. This is
fixing an assert in go_to_parent as we tried to find a
parent for the CONFIG_NODE.

src/vty/command.c

index c55e164..7525df6 100644 (file)
@@ -141,9 +141,9 @@ static int cmp_desc(const void *p, const void *q)
 
 static int is_config(struct vty *vty)
 {
-       if (vty->node < CONFIG_NODE)
+       if (vty->node <= CONFIG_NODE)
                return 0;
-       else if (vty->node >= CONFIG_NODE && vty->node < _LAST_OSMOVTY_NODE)
+       else if (vty->node > CONFIG_NODE && vty->node < _LAST_OSMOVTY_NODE)
                return 1;
        else if (host.app_info->is_config_node)
                return host.app_info->is_config_node(vty, vty->node);