summaryrefslogtreecommitdiff
path: root/vtysh
diff options
context:
space:
mode:
authorajs <ajs>2004-12-07 15:39:31 +0000
committerajs <ajs>2004-12-07 15:39:31 +0000
commit274a4a4447b13f89f8237156a887d05a24a73cc6 (patch)
treed5c2c6ee94bb77ef4346bcc07834808a75210bfd /vtysh
parent5e76477456ce8bc4a1eeaccb5c5e1d3d99ab1300 (diff)
2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* bgp_main.c: (main) The 2nd argument to openzlog has been removed. * isis_main.c: (main) The 2nd argument to openzlog has been removed. * ospf6_main.c: (main) The 2nd argument to openzlog has been removed. Note that stdout logging will no longer be enabled by default when not running as a daemon. * ospf_main.c: (main) The 2nd argument to openzlog has been removed. * rip_main.c: (main) The 2nd argument to openzlog has been removed. * ripng_main.c: (main) The 2nd argument to openzlog has been removed. * main.c: (main) The 2nd argument to openzlog has been removed. So stdout logging will no longer be enabled by default. * irdp_main.c: (irdp_finish) Reduce severity of shutdown message from LOG_WARNING to LOG_INFO. * vtysh.c: Make several functions static instead of global. Added several commands to support destination-specific logging levels. (vtysh_completion) This function is unused, so comment it out. * basic.texi: Document new logging features. Separate basic config commands from basic VTY commands. * log.h: Replace struct zlog flags and maskpri fields with maxlvl array to support individual logging levels for each destination. Remove the 2nd argument to openzlog since the default logging config should be standardized inside the library. Replaced the zlog_set_flag and zlog_reset_flag functions with zlog_set_level. And zlog_set_file now requires an additional log_level argument. Declare zlog_proto_names for use inside command.c in the "show logging" command. Added defines useful for command construction. * log.c: (vzlog) Decide where to send the message based on the individual logging levels configured for each destination. Remove support for ZLOG_STDERR since it was never actually used. Support record-priority for terminal monitors. (zlog_signal,zlog_backtrace_sigsafe) Support destination-specific logging levels. Remove stderr support (was never used). Added support for terminal monitor logging. (_zlog_assert_failed) Increase message severity to LOG_EMERG. (openzlog) Remove 2nd argument since default config should be standardized in library. By default, terminal monitoring is set to debug, and all other logging is disabled. (zlog_set_flag,zlog_reset_flag) Removed. (zlog_set_level) New function to replace zlog_set_flag and zlog_reset_flag. Supports destination-specific logging levels. (zlog_set_file,zlog_reset_file) Support file-specific logging level. (zlog_rotate) Log an error message if fopen fails, and support new file-specific logging level. * command.h: Change DEFUN_CMD_FUNC_DECL and DEFUN_CMD_FUNC_TEXT so that command functions will be static instead of global. Remove declarations for config_exit and config_help. Define new macros DEFUNSH_ATTR, DEFUNSH_HIDDEN, and DEFUNSH_DEPRECATED so we can have deprecated commands in vtysh. Similarly, for completeness, define macros ALIAS_SH, ALIAS_SH_HIDDEN, and ALIAS_SH_DEPRECATED. Also, fix bug in ALIAS_ATTR macro (didn't matter because it was never used). * command.c: Make many functions static instead of global. (facility_name,facility_match,level_match) New functions to support enhanced destination-specific logging levels. (config_write_host) Support new destination-specific logging levels. (config_logmsg) Added new "logmsg" command to help test logging system. (show_logging) Added "show logging" command to show the current configuration of the logging system. (config_log_stdout_level) Support explicit stdout logging level. (no_config_log_stdout) Now takes optional LEVEL arg. (config_log_monitor,config_log_monitor_level,no_config_log_monitor) New commands creating new "log monitor" commands to set terminal monitoring log level. (config_log_file_level) Support explicit file logging level. (config_log_syslog_level) Support explicit syslog logging level. (config_log_facility,no_config_log_facility) Implement new "log facility" command. (cmd_init) Add hooks for new commands: "show logging", "logmsg", "log stdout <level>", "log monitor", "log monitor <level>", "no log monitor", "log file <filename> <level>", "no log file <filename> <level>", "log syslog <level>", "log facility", and "no log facility". * vty.h: Added a "level" argument to vty_log so it can support "log record-priority". Declare new function vty_log_fixed for use in signal handlers. * vty.c: (vty_log,vty_log_out) Added a "level" argument to support "log record-priority" for vty terminal monitors. (vty_down_level) Use config_exit_cmd.func instead of calling config_exit directly (since command functions will now be static instead of global). (vty_log_fixed) New function to send terminal monitor messages from inside a signal handler.
Diffstat (limited to 'vtysh')
-rw-r--r--vtysh/ChangeLog6
-rw-r--r--vtysh/vtysh.c175
2 files changed, 153 insertions, 28 deletions
diff --git a/vtysh/ChangeLog b/vtysh/ChangeLog
index ea611179..5e32f015 100644
--- a/vtysh/ChangeLog
+++ b/vtysh/ChangeLog
@@ -1,3 +1,9 @@
+2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
+
+ * vtysh.c: Make several functions static instead of global.
+ Added several commands to support destination-specific logging levels.
+ (vtysh_completion) This function is unused, so comment it out.
+
2004-11-11 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* vtysh.c: (vtysh_client_execute) Fix flaws in detecting trailing
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index 08bd1275..0a043cf9 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -52,7 +52,7 @@ int vtysh_writeconfig_integrated = 0;
extern char config_default[];
-void
+static void
vclient_close (struct vtysh_client *vclient)
{
if (vclient->fd > 0)
@@ -63,7 +63,7 @@ vclient_close (struct vtysh_client *vclient)
/* Following filled with debug code to trace a problematic condition
* under load - it SHOULD handle it. */
#define ERR_WHERE_STRING "vtysh(): vtysh_client_config(): "
-int
+static int
vtysh_client_config (struct vtysh_client *vclient, char *line)
{
int ret;
@@ -161,7 +161,7 @@ vtysh_client_config (struct vtysh_client *vclient, char *line)
return ret;
}
-int
+static int
vtysh_client_execute (struct vtysh_client *vclient, const char *line, FILE *fp)
{
int ret;
@@ -247,7 +247,7 @@ vtysh_pager_init ()
}
/* Command execution over the vty interface. */
-void
+static void
vtysh_execute_func (const char *line, int pager)
{
int ret, cmd_stat;
@@ -604,7 +604,7 @@ vtysh_rl_describe ()
* correct places only. */
int complete_status;
-char *
+static char *
command_generator (const char *text, int state)
{
vector vline;
@@ -635,7 +635,7 @@ command_generator (const char *text, int state)
return NULL;
}
-char **
+static char **
new_completion (char *text, int start, int end)
{
char **matches;
@@ -652,7 +652,9 @@ new_completion (char *text, int start, int end)
return matches;
}
-char **
+#if 0
+/* This function is not actually being used. */
+static char **
vtysh_completion (char *text, int start, int end)
{
int ret;
@@ -676,6 +678,7 @@ vtysh_completion (char *text, int start, int end)
return (char **) matched;
}
+#endif
/* Vty node structures. */
struct cmd_node bgp_node =
@@ -1015,7 +1018,7 @@ DEFUNSH (VTYSH_ALL,
return CMD_SUCCESS;
}
-int
+static int
vtysh_exit (struct vty *vty)
{
switch (vty->node)
@@ -1265,7 +1268,18 @@ DEFUNSH (VTYSH_ALL,
vtysh_log_stdout_cmd,
"log stdout",
"Logging control\n"
- "Logging goes to stdout\n")
+ "Set stdout logging level\n")
+{
+ return CMD_SUCCESS;
+}
+
+DEFUNSH (VTYSH_ALL,
+ vtysh_log_stdout_level,
+ vtysh_log_stdout_level_cmd,
+ "log stdout "LOG_LEVELS,
+ "Logging control\n"
+ "Set stdout logging level\n"
+ LOG_LEVEL_DESC)
{
return CMD_SUCCESS;
}
@@ -1273,10 +1287,11 @@ DEFUNSH (VTYSH_ALL,
DEFUNSH (VTYSH_ALL,
no_vtysh_log_stdout,
no_vtysh_log_stdout_cmd,
- "no log stdout",
+ "no log stdout [LEVEL]",
NO_STR
"Logging control\n"
- "Logging goes to stdout\n")
+ "Cancel logging to stdout\n"
+ "Logging level\n")
{
return CMD_SUCCESS;
}
@@ -1293,6 +1308,18 @@ DEFUNSH (VTYSH_ALL,
}
DEFUNSH (VTYSH_ALL,
+ vtysh_log_file_level,
+ vtysh_log_file_level_cmd,
+ "log file FILENAME "LOG_LEVELS,
+ "Logging control\n"
+ "Logging to file\n"
+ "Logging filename\n"
+ LOG_LEVEL_DESC)
+{
+ return CMD_SUCCESS;
+}
+
+DEFUNSH (VTYSH_ALL,
no_vtysh_log_file,
no_vtysh_log_file_cmd,
"no log file [FILENAME]",
@@ -1304,12 +1331,66 @@ DEFUNSH (VTYSH_ALL,
return CMD_SUCCESS;
}
+ALIAS_SH (VTYSH_ALL,
+ no_vtysh_log_file,
+ no_vtysh_log_file_level_cmd,
+ "no log file FILENAME LEVEL",
+ NO_STR
+ "Logging control\n"
+ "Cancel logging to file\n"
+ "Logging file name\n"
+ "Logging level\n")
+
+DEFUNSH (VTYSH_ALL,
+ vtysh_log_monitor,
+ vtysh_log_monitor_cmd,
+ "log monitor",
+ "Logging control\n"
+ "Set terminal line (monitor) logging level\n")
+{
+ return CMD_SUCCESS;
+}
+
+DEFUNSH (VTYSH_ALL,
+ vtysh_log_monitor_level,
+ vtysh_log_monitor_level_cmd,
+ "log monitor "LOG_LEVELS,
+ "Logging control\n"
+ "Set terminal line (monitor) logging level\n"
+ LOG_LEVEL_DESC)
+{
+ return CMD_SUCCESS;
+}
+
+DEFUNSH (VTYSH_ALL,
+ no_vtysh_log_monitor,
+ no_vtysh_log_monitor_cmd,
+ "no log monitor [LEVEL]",
+ NO_STR
+ "Logging control\n"
+ "Disable terminal line (monitor) logging\n"
+ "Logging level\n")
+{
+ return CMD_SUCCESS;
+}
+
DEFUNSH (VTYSH_ALL,
vtysh_log_syslog,
vtysh_log_syslog_cmd,
"log syslog",
"Logging control\n"
- "Logging goes to syslog\n")
+ "Set syslog logging level\n")
+{
+ return CMD_SUCCESS;
+}
+
+DEFUNSH (VTYSH_ALL,
+ vtysh_log_syslog_level,
+ vtysh_log_syslog_level_cmd,
+ "log syslog "LOG_LEVELS,
+ "Logging control\n"
+ "Set syslog logging level\n"
+ LOG_LEVEL_DESC)
{
return CMD_SUCCESS;
}
@@ -1317,32 +1398,60 @@ DEFUNSH (VTYSH_ALL,
DEFUNSH (VTYSH_ALL,
no_vtysh_log_syslog,
no_vtysh_log_syslog_cmd,
- "no log syslog",
+ "no log syslog [LEVEL]",
NO_STR
"Logging control\n"
- "Cancel logging to syslog\n")
+ "Cancel logging to syslog\n"
+ "Logging level\n")
{
return CMD_SUCCESS;
}
DEFUNSH (VTYSH_ALL,
- vtysh_log_trap,
- vtysh_log_trap_cmd,
- "log trap (emergencies|alerts|critical|errors|warnings|\
- notifications|informational|debugging)",
+ vtysh_log_facility,
+ vtysh_log_facility_cmd,
+ "log facility "LOG_FACILITIES,
"Logging control\n"
- "Limit logging to specifed level\n")
+ "Facility parameter for syslog messages\n"
+ LOG_FACILITY_DESC)
+
{
return CMD_SUCCESS;
}
DEFUNSH (VTYSH_ALL,
- no_vtysh_log_trap,
- no_vtysh_log_trap_cmd,
- "no log trap",
+ no_vtysh_log_facility,
+ no_vtysh_log_facility_cmd,
+ "no log facility [FACILITY]",
NO_STR
"Logging control\n"
- "Permit all logging information\n")
+ "Reset syslog facility to default (daemon)\n"
+ "Syslog facility\n")
+
+{
+ return CMD_SUCCESS;
+}
+
+DEFUNSH_DEPRECATED (VTYSH_ALL,
+ vtysh_log_trap,
+ vtysh_log_trap_cmd,
+ "log trap "LOG_LEVELS,
+ "Logging control\n"
+ "(Deprecated) Set logging level and default for all destinations\n"
+ LOG_LEVEL_DESC)
+
+{
+ return CMD_SUCCESS;
+}
+
+DEFUNSH_DEPRECATED (VTYSH_ALL,
+ no_vtysh_log_trap,
+ no_vtysh_log_trap_cmd,
+ "no log trap [LEVEL]",
+ NO_STR
+ "Logging control\n"
+ "Permit all logging information\n"
+ "Logging level\n")
{
return CMD_SUCCESS;
}
@@ -1521,7 +1630,8 @@ DEFUN (no_vtysh_integrated_config,
return CMD_SUCCESS;
}
-int write_config_integrated(void)
+static int
+write_config_integrated(void)
{
int ret;
char line[] = "write terminal\n";
@@ -1702,7 +1812,7 @@ DEFUN (vtysh_show_daemons,
}
/* Execute command in child process. */
-int
+static int
execute_command (const char *command, int argc, const char *arg1,
const char *arg2)
{
@@ -1867,14 +1977,14 @@ DEFUN (vtysh_start_zsh,
return CMD_SUCCESS;
}
-void
+static void
vtysh_install_default (enum node_type node)
{
install_element (node, &config_list_cmd);
}
/* Making connection to protocol daemon. */
-int
+static int
vtysh_connect (struct vtysh_client *vclient, const char *path)
{
int ret;
@@ -1957,7 +2067,7 @@ vtysh_connect_all()
}
/* To disable readline's filename completion. */
-char *
+static char *
vtysh_completion_entry_function (const char *ignore, int invoking_key)
{
return NULL;
@@ -2190,13 +2300,22 @@ vtysh_init_vty ()
install_element (ENABLE_NODE, &vtysh_start_zsh_cmd);
install_element (CONFIG_NODE, &vtysh_log_stdout_cmd);
+ install_element (CONFIG_NODE, &vtysh_log_stdout_level_cmd);
install_element (CONFIG_NODE, &no_vtysh_log_stdout_cmd);
install_element (CONFIG_NODE, &vtysh_log_file_cmd);
+ install_element (CONFIG_NODE, &vtysh_log_file_level_cmd);
install_element (CONFIG_NODE, &no_vtysh_log_file_cmd);
+ install_element (CONFIG_NODE, &no_vtysh_log_file_level_cmd);
+ install_element (CONFIG_NODE, &vtysh_log_monitor_cmd);
+ install_element (CONFIG_NODE, &vtysh_log_monitor_level_cmd);
+ install_element (CONFIG_NODE, &no_vtysh_log_monitor_cmd);
install_element (CONFIG_NODE, &vtysh_log_syslog_cmd);
+ install_element (CONFIG_NODE, &vtysh_log_syslog_level_cmd);
install_element (CONFIG_NODE, &no_vtysh_log_syslog_cmd);
install_element (CONFIG_NODE, &vtysh_log_trap_cmd);
install_element (CONFIG_NODE, &no_vtysh_log_trap_cmd);
+ install_element (CONFIG_NODE, &vtysh_log_facility_cmd);
+ install_element (CONFIG_NODE, &no_vtysh_log_facility_cmd);
install_element (CONFIG_NODE, &vtysh_log_record_priority_cmd);
install_element (CONFIG_NODE, &no_vtysh_log_record_priority_cmd);