]> git.puffer.fish Git - matthieu/frr.git/commitdiff
* command.[ch], vty.c: cmd_execute_command() function must not attempt
authorhasso <hasso>
Sun, 16 Jan 2005 23:31:54 +0000 (23:31 +0000)
committerhasso <hasso>
Sun, 16 Jan 2005 23:31:54 +0000 (23:31 +0000)
  to walk up in the node tree if called from vtysh. Different daemons
  might have commands with same syntax in different nodes (for example
  "router-id x.x.x.x" commands in zebra/ospfd/ospf6d daemons).

* vtysh.c: Reflect changes in lib. cmd_execute_command() should know
  now that it's called from vtysh and must not attempt to walk up in
  the node tree.

[pullup candidate]

lib/ChangeLog
lib/command.c
lib/command.h
lib/vty.c
vtysh/ChangeLog
vtysh/vtysh.c

index 7c928c6be2abad3f346789d998e5e771cc9119ce..ba4bba9763577ac34a987cb3c4666a9311da5e53 100644 (file)
@@ -1,3 +1,10 @@
+2005-01-17 Hasso Tepper <hasso at quagga.net>
+
+       * command.[ch], vty.c: cmd_execute_command() function must not attempt
+         to walk up in the node tree if called from vtysh. Different daemons
+         might have commands with same syntax in different nodes (for example
+         "router-id x.x.x.x" commands in zebra/ospfd/ospf6d daemons).
+
 2005-01-14 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
 
        * command.c (print_version): Do not bother even to examine host.name,
index 92bbac7572b817b0864a478d091758bf758f21b3..8f9b98e5e42d20c33130270faaa18b435574d1f7 100644 (file)
@@ -1,5 +1,5 @@
 /*
-   $Id: command.c,v 1.33 2005/01/14 17:09:38 ajs Exp $
+   $Id: command.c,v 1.34 2005/01/16 23:31:54 hasso Exp $
 
    Command interpreter routine for virtual terminal [aka TeletYpe]
    Copyright (C) 1997, 98, 99 Kunihiro Ishiguro
@@ -2092,7 +2092,8 @@ cmd_execute_command_real (vector vline, struct vty *vty, struct cmd_element **cm
 
 
 int
-cmd_execute_command (vector vline, struct vty *vty, struct cmd_element **cmd) {
+cmd_execute_command (vector vline, struct vty *vty, struct cmd_element **cmd,
+                    int vtysh) {
   int ret, saved_ret, tried = 0;
   enum node_type onode, try_node;
 
@@ -2123,6 +2124,9 @@ cmd_execute_command (vector vline, struct vty *vty, struct cmd_element **cmd) {
 
   saved_ret = ret = cmd_execute_command_real (vline, vty, cmd);
 
+  if (vtysh)
+    return saved_ret;
+
   /* This assumes all nodes above CONFIG_NODE are childs of CONFIG_NODE */
   while ( ret != CMD_SUCCESS && ret != CMD_WARNING 
          && vty->node > CONFIG_NODE )
index c8699e1091624c44bbafa22c3db5ead58f08d6b9..cb76896cec4595cd1464c2871395acf70ef2990c 100644 (file)
@@ -329,7 +329,7 @@ vector cmd_describe_command ();
 char **cmd_complete_command ();
 const char *cmd_prompt (enum node_type);
 int config_from_file (struct vty *, FILE *);
-int cmd_execute_command (vector, struct vty *, struct cmd_element **);
+int cmd_execute_command (vector, struct vty *, struct cmd_element **, int);
 int cmd_execute_command_strict (vector, struct vty *, struct cmd_element **);
 void config_replace_string (struct cmd_element *, char *, ...);
 void cmd_init (int);
index 25366fb454acb7dfa67a91c39c513681685fc688..42487330fafb67173bbbf65de2da7cbbe8e31e44 100644 (file)
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -361,7 +361,7 @@ vty_command (struct vty *vty, char *buf)
   if (vline == NULL)
     return CMD_SUCCESS;
 
-  ret = cmd_execute_command (vline, vty, NULL);
+  ret = cmd_execute_command (vline, vty, NULL, 0);
 
   if (ret != CMD_SUCCESS)
     switch (ret)
index de0b1a80e471a7e31012e41f751b22b711114629..d0cd068ef775c326ab592370239b28ece9761810 100644 (file)
@@ -1,3 +1,9 @@
+2005-01-10 Hasso Tepper <hasso at quagga.net>
+
+       * vtysh.c: Reflect changes in lib. cmd_execute_command() should know
+         now that it's called from vtysh and must not attempt to walk up in
+         the node tree.
+
 2004-12-22 Hasso Tepper <hasso at quagga.net>
 
        * vtysh_config.c: No delimiter between "ip forwarding" and "ipv6
index 04d9d7d2cb7192682dbe018358806e6afa4a4eba..6ece45f84af3ff04c827973a52b26f577c4b9a64 100644 (file)
@@ -262,7 +262,7 @@ vtysh_execute_func (const char *line, int pager)
   if (vline == NULL)
     return;
 
-  ret = cmd_execute_command (vline, vty, &cmd);
+  ret = cmd_execute_command (vline, vty, &cmd, 1);
 
   cmd_free_strvec (vline);
 
@@ -340,7 +340,7 @@ vtysh_execute_func (const char *line, int pager)
                    return;
                  }
 
-               ret = cmd_execute_command (vline, vty, &cmd);
+               ret = cmd_execute_command (vline, vty, &cmd, 1);
                cmd_free_strvec (vline);
                if (ret != CMD_SUCCESS_DAEMON)
                  break;