vty: Handle nodes part of the lib in the lib, for the rest call the callback
authorHolger Hans Peter Freyther <zecke@selfish.org>
Thu, 26 Aug 2010 06:37:10 +0000 (14:37 +0800)
committerHolger Hans Peter Freyther <zecke@selfish.org>
Thu, 26 Aug 2010 07:00:52 +0000 (15:00 +0800)
src/vty/command.c

index 6a52321..c55e164 100644 (file)
@@ -141,12 +141,14 @@ static int cmp_desc(const void *p, const void *q)
 
 static int is_config(struct vty *vty)
 {
-       /* ask the application */
-       if (host.app_info->is_config_node)
+       if (vty->node < CONFIG_NODE)
+               return 0;
+       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);
-
-       /* Assume that everything above CONFIG_NODE is a config node */
-       return vty->node > CONFIG_NODE;
+       else
+               return vty->node > CONFIG_NODE;
 }
 
 /* Sort each node's command element according to command string. */