diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-11-12 05:17:37 +0000 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-11-12 05:17:37 +0000 |
| commit | 07321a065d1126c00766ca3d6698e57936699f82 (patch) | |
| tree | a7dac2bb2248d87f40b1c3c2af7440d9bea35421 /lib/command.c | |
| parent | 17aca20bfbb9d7e980a04c9b017f87f027901839 (diff) | |
| parent | 11ec76edb225c0f0e6a57b1d667179b14aa2ac20 (diff) | |
Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Conflicts:
lib/command.c
lib/vty.c
Diffstat (limited to 'lib/command.c')
| -rw-r--r-- | lib/command.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/lib/command.c b/lib/command.c index 593822a66e..bf7e269acc 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1350,6 +1350,9 @@ DEFUN (config_write, return CMD_SUCCESS; } + if (host.noconfig) + return CMD_SUCCESS; + /* Check and see if we are operating under vtysh configuration */ if (host.config == NULL) { @@ -1478,6 +1481,11 @@ DEFUN (show_startup_config, char buf[BUFSIZ]; FILE *confp; + if (host.noconfig) + return CMD_SUCCESS; + if (host.config == NULL) + return CMD_WARNING; + confp = fopen (host.config, "r"); if (confp == NULL) { @@ -2281,7 +2289,11 @@ install_default (enum node_type node) install_element (node, &show_running_config_cmd); } -/* Initialize command interface. Install basic nodes and commands. */ +/* Initialize command interface. Install basic nodes and commands. + * + * terminal = 0 -- vtysh / no logging, no config control + * terminal = 1 -- normal daemon + * terminal = -1 -- watchquagga / no logging, but minimal config control */ void cmd_init (int terminal) { @@ -2296,6 +2308,7 @@ cmd_init (int terminal) host.enable = NULL; host.logfile = NULL; host.config = NULL; + host.noconfig = (terminal < 0); host.lines = -1; host.motd = default_motd; host.motdfile = NULL; @@ -2338,12 +2351,17 @@ cmd_init (int terminal) { install_element (ENABLE_NODE, &config_logmsg_cmd); install_default (CONFIG_NODE); + + install_element (VIEW_NODE, &show_thread_cpu_cmd); + install_element (ENABLE_NODE, &clear_thread_cpu_cmd); + + install_element (VIEW_NODE, &show_work_queues_cmd); } install_element (CONFIG_NODE, &hostname_cmd); install_element (CONFIG_NODE, &no_hostname_cmd); - if (terminal) + if (terminal > 0) { install_element (CONFIG_NODE, &password_cmd); install_element (CONFIG_NODE, &enable_password_cmd); @@ -2373,11 +2391,6 @@ cmd_init (int terminal) install_element (CONFIG_NODE, &service_terminal_length_cmd); install_element (CONFIG_NODE, &no_service_terminal_length_cmd); - install_element (VIEW_NODE, &show_thread_cpu_cmd); - - install_element (ENABLE_NODE, &clear_thread_cpu_cmd); - install_element (VIEW_NODE, &show_work_queues_cmd); - vrf_install_commands (); } srandom(time(NULL)); |
