diff options
author | hasso <hasso> | 2005-01-16 23:31:54 +0000 |
---|---|---|
committer | hasso <hasso> | 2005-01-16 23:31:54 +0000 |
commit | 87d683b071dc7abfb30b666960ec480e64e19ce4 (patch) | |
tree | ec56b3ce34f6871c4b3687681df2b97aa38da57a /lib | |
parent | b854038bd03e6c54b46d35bf4e40d0f39e30dfde (diff) |
* 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).
* 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]
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ChangeLog | 7 | ||||
-rw-r--r-- | lib/command.c | 8 | ||||
-rw-r--r-- | lib/command.h | 2 | ||||
-rw-r--r-- | lib/vty.c | 2 |
4 files changed, 15 insertions, 4 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog index 7c928c6b..ba4bba97 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -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, diff --git a/lib/command.c b/lib/command.c index 92bbac75..8f9b98e5 100644 --- a/lib/command.c +++ b/lib/command.c @@ -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 ) diff --git a/lib/command.h b/lib/command.h index c8699e10..cb76896c 100644 --- a/lib/command.h +++ b/lib/command.h @@ -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); @@ -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) |