struct vty *file_vty;
struct stat conf_stat;
+ if (host.noconfig)
+ return CMD_SUCCESS;
+
/* Check and see if we are operating under vtysh configuration */
if (host.config == NULL)
{
unsigned int i;
struct cmd_node *node;
+ if (host.noconfig)
+ return CMD_SUCCESS;
+
if (vty->type == VTY_SHELL_SERV)
{
for (i = 0; i < vector_active (cmdvec); i++)
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)
{
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)
{
host.enable = NULL;
host.logfile = NULL;
host.config = NULL;
+ host.noconfig = (terminal < 0);
host.lines = -1;
host.motd = default_motd;
host.motdfile = NULL;
{
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, &password_text_cmd);
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));