mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-05 16:29:39 +00:00
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.
This commit is contained in:
parent
5e76477456
commit
274a4a4447
@ -1,3 +1,7 @@
|
|||||||
|
2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
||||||
|
|
||||||
|
* bgp_main.c: (main) The 2nd argument to openzlog has been removed.
|
||||||
|
|
||||||
2004-12-03 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
2004-12-03 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
||||||
|
|
||||||
* bgp_main.c: (sigint) Use zlog_notice for termination message.
|
* bgp_main.c: (sigint) Use zlog_notice for termination message.
|
||||||
|
@ -205,7 +205,7 @@ main (int argc, char **argv)
|
|||||||
/* Preserve name of myself. */
|
/* Preserve name of myself. */
|
||||||
progname = ((p = strrchr (argv[0], '/')) ? ++p : argv[0]);
|
progname = ((p = strrchr (argv[0], '/')) ? ++p : argv[0]);
|
||||||
|
|
||||||
zlog_default = openzlog (progname, ZLOG_NOLOG, ZLOG_BGP,
|
zlog_default = openzlog (progname, ZLOG_BGP,
|
||||||
LOG_CONS|LOG_NDELAY|LOG_PID, LOG_DAEMON);
|
LOG_CONS|LOG_NDELAY|LOG_PID, LOG_DAEMON);
|
||||||
|
|
||||||
/* BGP master init. */
|
/* BGP master init. */
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
||||||
|
|
||||||
|
* basic.texi: Document new logging features. Separate basic config
|
||||||
|
commands from basic VTY commands.
|
||||||
|
|
||||||
2004-11-25 Hasso Tepper <hasso at quagga.net>
|
2004-11-25 Hasso Tepper <hasso at quagga.net>
|
||||||
|
|
||||||
* *.8: Document -g/--group command line switch and some small
|
* *.8: Document -g/--group command line switch and some small
|
||||||
|
141
doc/basic.texi
141
doc/basic.texi
@ -15,9 +15,10 @@ The following sections discuss commands common to all the routing
|
|||||||
daemons.
|
daemons.
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
|
* Terminal Mode Commands:: Common commands used in a VTY
|
||||||
* Config Commands:: Commands used in config files
|
* Config Commands:: Commands used in config files
|
||||||
* Common Invocation Options:: Starting the daemons
|
* Common Invocation Options:: Starting the daemons
|
||||||
* Virtual Terminal Interfaces:: Interacting with the daemons
|
* Virtual Terminal Interfaces:: Interacting with the daemons
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
|
|
||||||
@ -78,47 +79,85 @@ accept connections.
|
|||||||
Set enable password.
|
Set enable password.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
@deffn Command {log trap @var{level}} {}
|
||||||
|
@deffnx Command {no log trap} {}
|
||||||
|
These commands are deprecated and are present only for historical compatibility.
|
||||||
|
The log trap command sets the current logging level for all enabled
|
||||||
|
logging destinations, and it sets the default for all future logging commands
|
||||||
|
that do not specify a level. The normal default
|
||||||
|
logging level is debugging. The @code{no} form of the command resets
|
||||||
|
the default level for future logging commands to debugging, but it does
|
||||||
|
not change the logging level of existing logging destinations.
|
||||||
|
@end deffn
|
||||||
|
|
||||||
|
|
||||||
@deffn Command {log stdout} {}
|
@deffn Command {log stdout} {}
|
||||||
|
@deffnx Command {log stdout @var{level}} {}
|
||||||
@deffnx Command {no log stdout} {}
|
@deffnx Command {no log stdout} {}
|
||||||
Set logging output to stdout.
|
Enable logging output to stdout.
|
||||||
|
If the optional second argument specifying the
|
||||||
|
logging level is not present, the default logging level (typically debugging,
|
||||||
|
but can be changed using the deprecated @code{log trap} command) will be used.
|
||||||
|
The @code{no} form of the command disables logging to stdout.
|
||||||
|
The @code{level} argument must have one of these values:
|
||||||
|
emergencies, alerts, critical, errors, warnings, notifications, informational, or debugging. Note that the existing code logs its most important messages
|
||||||
|
with severity @code{errors}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn Command {log file @var{filename}} {}
|
@deffn Command {log file @var{filename}} {}
|
||||||
If you want to log into a file please specify @code{filename} as
|
@deffnx Command {log file @var{filename} @var{level}} {}
|
||||||
follows.
|
@deffnx Command {no log file} {}
|
||||||
|
If you want to log into a file, please specify @code{filename} as
|
||||||
|
in this example:
|
||||||
@example
|
@example
|
||||||
log file /usr/local/etc/bgpd.log
|
log file /var/log/quagga/bgpd.log informational
|
||||||
@end example
|
@end example
|
||||||
|
If the optional second argument specifying the
|
||||||
|
logging level is not present, the default logging level (typically debugging,
|
||||||
|
but can be changed using the deprecated @code{log trap} command) will be used.
|
||||||
|
The @code{no} form of the command disables logging to a file.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn Command {log syslog} {}
|
@deffn Command {log syslog} {}
|
||||||
|
@deffnx Command {log syslog @var{level}} {}
|
||||||
@deffnx Command {no log syslog} {}
|
@deffnx Command {no log syslog} {}
|
||||||
Set logging output to syslog.
|
Enable logging output to syslog.
|
||||||
|
If the optional second argument specifying the
|
||||||
|
logging level is not present, the default logging level (typically debugging,
|
||||||
|
but can be changed using the deprecated @code{log trap} command) will be used.
|
||||||
|
The @code{no} form of the command disables logging to syslog.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn Command {write terminal} {}
|
@deffn Command {log monitor} {}
|
||||||
Displays the current configuration to the vty interface.
|
@deffnx Command {log monitor @var{level}} {}
|
||||||
|
@deffnx Command {no log monitor} {}
|
||||||
|
Enable logging output to vty terminals that have enabled logging
|
||||||
|
using the @code{terminal monitor} command.
|
||||||
|
By default, monitor logging is enabled at the debugging level, but this
|
||||||
|
command (or the deprecated @code{log trap} command) can be used to change
|
||||||
|
the monitor logging level.
|
||||||
|
If the optional second argument specifying the
|
||||||
|
logging level is not present, the default logging level (typically debugging,
|
||||||
|
but can be changed using the deprecated @code{log trap} command) will be used.
|
||||||
|
The @code{no} form of the command disables logging to terminal monitors.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn Command {write file} {}
|
@deffn Command {log facility @var{facility}} {}
|
||||||
Write current configuration to configuration file.
|
@deffnx Command {no log facility} {}
|
||||||
|
This command changes the facility used in syslog messages. The default
|
||||||
|
facility is @code{daemon}. The @code{no} form of the command resets
|
||||||
|
the facility to the default @code{daemon} facility.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn Command {configure terminal} {}
|
@deffn Command {log record-priority} {}
|
||||||
Change to configuration mode. This command is the first step to
|
@deffnx Command {no log record-priority} {}
|
||||||
configuration.
|
To include the severity in all messages logged to a file, to stdout, or to
|
||||||
@end deffn
|
a terminal monitor (i.e. anything except syslog),
|
||||||
|
use the @code{log record-priority} global configuration command.
|
||||||
@deffn Command {terminal length @var{<0-512>}} {}
|
To disable this option, use the @code{no} form of the command. By default,
|
||||||
Set terminal display length to @var{<0-512>}. If length is 0, no
|
the severity level is not included in logged messages. Note: some
|
||||||
display control is performed.
|
versions of syslogd (including Solaris) can be configured to include
|
||||||
@end deffn
|
the facility and level in the messages emitted.
|
||||||
|
|
||||||
@deffn Command {who} {}
|
|
||||||
@end deffn
|
|
||||||
|
|
||||||
@deffn Command {list} {}
|
|
||||||
List commands.
|
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn Command {service password-encryption} {}
|
@deffn Command {service password-encryption} {}
|
||||||
@ -134,10 +173,6 @@ Set system wide line configuration. This configuration command applies
|
|||||||
to all VTY interfaces.
|
to all VTY interfaces.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn Command {show version} {}
|
|
||||||
Show the current version of @value{PACKAGE_NAME} and its build host information.
|
|
||||||
@end deffn
|
|
||||||
|
|
||||||
@deffn Command {line vty} {}
|
@deffn Command {line vty} {}
|
||||||
Enter vty configuration mode.
|
Enter vty configuration mode.
|
||||||
@end deffn
|
@end deffn
|
||||||
@ -167,8 +202,6 @@ Do not perform timeout at all. This command is as same as
|
|||||||
Restrict vty connections with an access list.
|
Restrict vty connections with an access list.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@node Sample Config File
|
@node Sample Config File
|
||||||
@subsection Sample Config File
|
@subsection Sample Config File
|
||||||
|
|
||||||
@ -204,6 +237,52 @@ comment and the password is set to 'zebra!password'.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@node Terminal Mode Commands
|
||||||
|
@section Terminal Mode Commands
|
||||||
|
|
||||||
|
@deffn Command {write terminal} {}
|
||||||
|
Displays the current configuration to the vty interface.
|
||||||
|
@end deffn
|
||||||
|
|
||||||
|
@deffn Command {write file} {}
|
||||||
|
Write current configuration to configuration file.
|
||||||
|
@end deffn
|
||||||
|
|
||||||
|
@deffn Command {configure terminal} {}
|
||||||
|
Change to configuration mode. This command is the first step to
|
||||||
|
configuration.
|
||||||
|
@end deffn
|
||||||
|
|
||||||
|
@deffn Command {terminal length @var{<0-512>}} {}
|
||||||
|
Set terminal display length to @var{<0-512>}. If length is 0, no
|
||||||
|
display control is performed.
|
||||||
|
@end deffn
|
||||||
|
|
||||||
|
@deffn Command {who} {}
|
||||||
|
Show a list of currently connected vty sessions.
|
||||||
|
@end deffn
|
||||||
|
|
||||||
|
@deffn Command {list} {}
|
||||||
|
List all available commands.
|
||||||
|
@end deffn
|
||||||
|
|
||||||
|
@deffn Command {show version} {}
|
||||||
|
Show the current version of @value{PACKAGE_NAME} and its build host information.
|
||||||
|
@end deffn
|
||||||
|
|
||||||
|
@deffn Command {show logging} {}
|
||||||
|
Shows the current configuration of the logging system. This includes
|
||||||
|
the status of all logging destinations.
|
||||||
|
@end deffn
|
||||||
|
|
||||||
|
@deffn Command {logmsg @var{level} @var{message}} {}
|
||||||
|
Send a message to all logging destinations that are enabled for messages
|
||||||
|
of the given severity.
|
||||||
|
@end deffn
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@node Common Invocation Options
|
@node Common Invocation Options
|
||||||
@section Common Invocation Options
|
@section Common Invocation Options
|
||||||
@c COMMON_OPTIONS
|
@c COMMON_OPTIONS
|
||||||
|
507
doc/quagga.info
507
doc/quagga.info
@ -22,7 +22,7 @@ END-INFO-DIR-ENTRY
|
|||||||
This file documents the Quagga Software Routing Suite which manages
|
This file documents the Quagga Software Routing Suite which manages
|
||||||
common TCP/IP routing protocols.
|
common TCP/IP routing protocols.
|
||||||
|
|
||||||
This is Edition 0.97.3, last updated 7 November 2004 of `The Quagga
|
This is Edition 0.97.3, last updated 8 November 2004 of `The Quagga
|
||||||
Manual', for Quagga Version 0.97.3.
|
Manual', for Quagga Version 0.97.3.
|
||||||
|
|
||||||
Copyright (C) 1999-2004 Kunihiro Ishiguro, et al.
|
Copyright (C) 1999-2004 Kunihiro Ishiguro, et al.
|
||||||
@ -693,12 +693,13 @@ daemons.
|
|||||||
|
|
||||||
* Menu:
|
* Menu:
|
||||||
|
|
||||||
|
* Terminal Mode Commands:: Common commands used in a VTY
|
||||||
* Config Commands:: Commands used in config files
|
* Config Commands:: Commands used in config files
|
||||||
* Common Invocation Options:: Starting the daemons
|
* Common Invocation Options:: Starting the daemons
|
||||||
* Virtual Terminal Interfaces:: Interacting with the daemons
|
* Virtual Terminal Interfaces:: Interacting with the daemons
|
||||||
|
|
||||||
|
|
||||||
File: quagga.info, Node: Config Commands, Next: Common Invocation Options, Up: Basic commands
|
File: quagga.info, Node: Config Commands, Next: Common Invocation Options, Prev: Terminal Mode Commands, Up: Basic commands
|
||||||
|
|
||||||
3.1 Config Commands
|
3.1 Config Commands
|
||||||
===================
|
===================
|
||||||
@ -742,37 +743,78 @@ File: quagga.info, Node: Basic Config Commands, Next: Sample Config File, Up:
|
|||||||
-- Command: enable password PASSWORD
|
-- Command: enable password PASSWORD
|
||||||
Set enable password.
|
Set enable password.
|
||||||
|
|
||||||
|
-- Command: log trap LEVEL
|
||||||
|
-- Command: no log trap
|
||||||
|
These commands are deprecated and are present only for historical
|
||||||
|
compatibility. The log trap command sets the current logging
|
||||||
|
level for all enabled logging destinations, and it sets the
|
||||||
|
default for all future logging commands that do not specify a
|
||||||
|
level. The normal default logging level is debugging. The `no'
|
||||||
|
form of the command resets the default level for future logging
|
||||||
|
commands to debugging, but it does not change the logging level of
|
||||||
|
existing logging destinations.
|
||||||
|
|
||||||
-- Command: log stdout
|
-- Command: log stdout
|
||||||
|
-- Command: log stdout LEVEL
|
||||||
-- Command: no log stdout
|
-- Command: no log stdout
|
||||||
Set logging output to stdout.
|
Enable logging output to stdout. If the optional second argument
|
||||||
|
specifying the logging level is not present, the default logging
|
||||||
|
level (typically debugging, but can be changed using the
|
||||||
|
deprecated `log trap' command) will be used. The `no' form of the
|
||||||
|
command disables logging to stdout. The `level' argument must
|
||||||
|
have one of these values: emergencies, alerts, critical, errors,
|
||||||
|
warnings, notifications, informational, or debugging. Note that
|
||||||
|
the existing code logs its most important messages with severity
|
||||||
|
`errors'.
|
||||||
|
|
||||||
-- Command: log file FILENAME
|
-- Command: log file FILENAME
|
||||||
If you want to log into a file please specify `filename' as
|
-- Command: log file FILENAME LEVEL
|
||||||
follows.
|
-- Command: no log file
|
||||||
log file /usr/local/etc/bgpd.log
|
If you want to log into a file, please specify `filename' as in
|
||||||
|
this example:
|
||||||
|
log file /var/log/quagga/bgpd.log informational
|
||||||
|
If the optional second argument specifying the logging level is
|
||||||
|
not present, the default logging level (typically debugging, but
|
||||||
|
can be changed using the deprecated `log trap' command) will be
|
||||||
|
used. The `no' form of the command disables logging to a file.
|
||||||
|
|
||||||
-- Command: log syslog
|
-- Command: log syslog
|
||||||
|
-- Command: log syslog LEVEL
|
||||||
-- Command: no log syslog
|
-- Command: no log syslog
|
||||||
Set logging output to syslog.
|
Enable logging output to syslog. If the optional second argument
|
||||||
|
specifying the logging level is not present, the default logging
|
||||||
|
level (typically debugging, but can be changed using the
|
||||||
|
deprecated `log trap' command) will be used. The `no' form of the
|
||||||
|
command disables logging to syslog.
|
||||||
|
|
||||||
-- Command: write terminal
|
-- Command: log monitor
|
||||||
Displays the current configuration to the vty interface.
|
-- Command: log monitor LEVEL
|
||||||
|
-- Command: no log monitor
|
||||||
|
Enable logging output to vty terminals that have enabled logging
|
||||||
|
using the `terminal monitor' command. By default, monitor logging
|
||||||
|
is enabled at the debugging level, but this command (or the
|
||||||
|
deprecated `log trap' command) can be used to change the monitor
|
||||||
|
logging level. If the optional second argument specifying the
|
||||||
|
logging level is not present, the default logging level (typically
|
||||||
|
debugging, but can be changed using the deprecated `log trap'
|
||||||
|
command) will be used. The `no' form of the command disables
|
||||||
|
logging to terminal monitors.
|
||||||
|
|
||||||
-- Command: write file
|
-- Command: log facility FACILITY
|
||||||
Write current configuration to configuration file.
|
-- Command: no log facility
|
||||||
|
This command changes the facility used in syslog messages. The
|
||||||
|
default facility is `daemon'. The `no' form of the command resets
|
||||||
|
the facility to the default `daemon' facility.
|
||||||
|
|
||||||
-- Command: configure terminal
|
-- Command: log record-priority
|
||||||
Change to configuration mode. This command is the first step to
|
-- Command: no log record-priority
|
||||||
configuration.
|
To include the severity in all messages logged to a file, to
|
||||||
|
stdout, or to a terminal monitor (i.e. anything except syslog),
|
||||||
-- Command: terminal length <0-512>
|
use the `log record-priority' global configuration command. To
|
||||||
Set terminal display length to <0-512>. If length is 0, no
|
disable this option, use the `no' form of the command. By default,
|
||||||
display control is performed.
|
the severity level is not included in logged messages. Note: some
|
||||||
|
versions of syslogd (including Solaris) can be configured to
|
||||||
-- Command: who
|
include the facility and level in the messages emitted.
|
||||||
|
|
||||||
-- Command: list
|
|
||||||
List commands.
|
|
||||||
|
|
||||||
-- Command: service password-encryption
|
-- Command: service password-encryption
|
||||||
Encrypt password.
|
Encrypt password.
|
||||||
@ -784,9 +826,6 @@ File: quagga.info, Node: Basic Config Commands, Next: Sample Config File, Up:
|
|||||||
Set system wide line configuration. This configuration command
|
Set system wide line configuration. This configuration command
|
||||||
applies to all VTY interfaces.
|
applies to all VTY interfaces.
|
||||||
|
|
||||||
-- Command: show version
|
|
||||||
Show the current version of Quagga and its build host information.
|
|
||||||
|
|
||||||
-- Command: line vty
|
-- Command: line vty
|
||||||
Enter vty configuration mode.
|
Enter vty configuration mode.
|
||||||
|
|
||||||
@ -840,10 +879,47 @@ forward will be ignored as a comment.
|
|||||||
normal character. So in the above example '!' will not be regarded as a
|
normal character. So in the above example '!' will not be regarded as a
|
||||||
comment and the password is set to 'zebra!password'.
|
comment and the password is set to 'zebra!password'.
|
||||||
|
|
||||||
|
|
||||||
|
File: quagga.info, Node: Terminal Mode Commands, Next: Config Commands, Up: Basic commands
|
||||||
|
|
||||||
|
3.2 Terminal Mode Commands
|
||||||
|
==========================
|
||||||
|
|
||||||
|
-- Command: write terminal
|
||||||
|
Displays the current configuration to the vty interface.
|
||||||
|
|
||||||
|
-- Command: write file
|
||||||
|
Write current configuration to configuration file.
|
||||||
|
|
||||||
|
-- Command: configure terminal
|
||||||
|
Change to configuration mode. This command is the first step to
|
||||||
|
configuration.
|
||||||
|
|
||||||
|
-- Command: terminal length <0-512>
|
||||||
|
Set terminal display length to <0-512>. If length is 0, no
|
||||||
|
display control is performed.
|
||||||
|
|
||||||
|
-- Command: who
|
||||||
|
Show a list of currently connected vty sessions.
|
||||||
|
|
||||||
|
-- Command: list
|
||||||
|
List all available commands.
|
||||||
|
|
||||||
|
-- Command: show version
|
||||||
|
Show the current version of Quagga and its build host information.
|
||||||
|
|
||||||
|
-- Command: show logging
|
||||||
|
Shows the current configuration of the logging system. This
|
||||||
|
includes the status of all logging destinations.
|
||||||
|
|
||||||
|
-- Command: logmsg LEVEL MESSAGE
|
||||||
|
Send a message to all logging destinations that are enabled for
|
||||||
|
messages of the given severity.
|
||||||
|
|
||||||
|
|
||||||
File: quagga.info, Node: Common Invocation Options, Next: Virtual Terminal Interfaces, Prev: Config Commands, Up: Basic commands
|
File: quagga.info, Node: Common Invocation Options, Next: Virtual Terminal Interfaces, Prev: Config Commands, Up: Basic commands
|
||||||
|
|
||||||
3.2 Common Invocation Options
|
3.3 Common Invocation Options
|
||||||
=============================
|
=============================
|
||||||
|
|
||||||
These options apply to all Quagga daemons.
|
These options apply to all Quagga daemons.
|
||||||
@ -895,7 +971,7 @@ These options apply to all Quagga daemons.
|
|||||||
|
|
||||||
File: quagga.info, Node: Virtual Terminal Interfaces, Prev: Common Invocation Options, Up: Basic commands
|
File: quagga.info, Node: Virtual Terminal Interfaces, Prev: Common Invocation Options, Up: Basic commands
|
||||||
|
|
||||||
3.3 Virtual Terminal Interfaces
|
3.4 Virtual Terminal Interfaces
|
||||||
===============================
|
===============================
|
||||||
|
|
||||||
VTY - Virtual Terminal [aka TeletYpe] Interface is a command line
|
VTY - Virtual Terminal [aka TeletYpe] Interface is a command line
|
||||||
@ -910,7 +986,7 @@ interface (CLI) for user interaction with the routing daemon.
|
|||||||
|
|
||||||
File: quagga.info, Node: VTY Overview, Next: VTY Modes, Up: Virtual Terminal Interfaces
|
File: quagga.info, Node: VTY Overview, Next: VTY Modes, Up: Virtual Terminal Interfaces
|
||||||
|
|
||||||
3.3.1 VTY Overview
|
3.4.1 VTY Overview
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
VTY stands for Virtual TeletYpe interface. It means you can connect to
|
VTY stands for Virtual TeletYpe interface. It means you can connect to
|
||||||
@ -951,7 +1027,7 @@ all.
|
|||||||
|
|
||||||
File: quagga.info, Node: VTY Modes, Next: VTY CLI Commands, Prev: VTY Overview, Up: Virtual Terminal Interfaces
|
File: quagga.info, Node: VTY Modes, Next: VTY CLI Commands, Prev: VTY Overview, Up: Virtual Terminal Interfaces
|
||||||
|
|
||||||
3.3.2 VTY Modes
|
3.4.2 VTY Modes
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
There are three basic VTY modes:
|
There are three basic VTY modes:
|
||||||
@ -967,7 +1043,7 @@ There are three basic VTY modes:
|
|||||||
|
|
||||||
File: quagga.info, Node: VTY View Mode, Next: VTY Enable Mode, Up: VTY Modes
|
File: quagga.info, Node: VTY View Mode, Next: VTY Enable Mode, Up: VTY Modes
|
||||||
|
|
||||||
3.3.2.1 VTY View Mode
|
3.4.2.1 VTY View Mode
|
||||||
.....................
|
.....................
|
||||||
|
|
||||||
This mode is for read-only access to the CLI. One may exit the mode by
|
This mode is for read-only access to the CLI. One may exit the mode by
|
||||||
@ -976,7 +1052,7 @@ leaving the system, or by entering `enable' mode.
|
|||||||
|
|
||||||
File: quagga.info, Node: VTY Enable Mode, Next: VTY Other Modes, Prev: VTY View Mode, Up: VTY Modes
|
File: quagga.info, Node: VTY Enable Mode, Next: VTY Other Modes, Prev: VTY View Mode, Up: VTY Modes
|
||||||
|
|
||||||
3.3.2.2 VTY Enable Mode
|
3.4.2.2 VTY Enable Mode
|
||||||
.......................
|
.......................
|
||||||
|
|
||||||
This mode is for read-write access to the CLI. One may exit the mode by
|
This mode is for read-write access to the CLI. One may exit the mode by
|
||||||
@ -985,7 +1061,7 @@ leaving the system, or by escaping to view mode.
|
|||||||
|
|
||||||
File: quagga.info, Node: VTY Other Modes, Prev: VTY Enable Mode, Up: VTY Modes
|
File: quagga.info, Node: VTY Other Modes, Prev: VTY Enable Mode, Up: VTY Modes
|
||||||
|
|
||||||
3.3.2.3 VTY Other Modes
|
3.4.2.3 VTY Other Modes
|
||||||
.......................
|
.......................
|
||||||
|
|
||||||
This page is for describing other modes.
|
This page is for describing other modes.
|
||||||
@ -993,7 +1069,7 @@ This page is for describing other modes.
|
|||||||
|
|
||||||
File: quagga.info, Node: VTY CLI Commands, Prev: VTY Modes, Up: Virtual Terminal Interfaces
|
File: quagga.info, Node: VTY CLI Commands, Prev: VTY Modes, Up: Virtual Terminal Interfaces
|
||||||
|
|
||||||
3.3.3 VTY CLI Commands
|
3.4.3 VTY CLI Commands
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
Commands that you may use at the command-line are described in the
|
Commands that you may use at the command-line are described in the
|
||||||
@ -1008,7 +1084,7 @@ following three subsubsections.
|
|||||||
|
|
||||||
File: quagga.info, Node: CLI Movement Commands, Next: CLI Editing Commands, Up: VTY CLI Commands
|
File: quagga.info, Node: CLI Movement Commands, Next: CLI Editing Commands, Up: VTY CLI Commands
|
||||||
|
|
||||||
3.3.3.1 CLI Movement Commands
|
3.4.3.1 CLI Movement Commands
|
||||||
.............................
|
.............................
|
||||||
|
|
||||||
These commands are used for moving the CLI cursor. The <C> character
|
These commands are used for moving the CLI cursor. The <C> character
|
||||||
@ -1038,7 +1114,7 @@ means press the Control Key.
|
|||||||
|
|
||||||
File: quagga.info, Node: CLI Editing Commands, Next: CLI Advanced Commands, Prev: CLI Movement Commands, Up: VTY CLI Commands
|
File: quagga.info, Node: CLI Editing Commands, Next: CLI Advanced Commands, Prev: CLI Movement Commands, Up: VTY CLI Commands
|
||||||
|
|
||||||
3.3.3.2 CLI Editing Commands
|
3.4.3.2 CLI Editing Commands
|
||||||
............................
|
............................
|
||||||
|
|
||||||
These commands are used for editing text on a line. The <C> character
|
These commands are used for editing text on a line. The <C> character
|
||||||
@ -1070,7 +1146,7 @@ means press the Control Key.
|
|||||||
|
|
||||||
File: quagga.info, Node: CLI Advanced Commands, Prev: CLI Editing Commands, Up: VTY CLI Commands
|
File: quagga.info, Node: CLI Advanced Commands, Prev: CLI Editing Commands, Up: VTY CLI Commands
|
||||||
|
|
||||||
3.3.3.3 CLI Advanced Commands
|
3.4.3.3 CLI Advanced Commands
|
||||||
.............................
|
.............................
|
||||||
|
|
||||||
There are several additional CLI commands for command line completions,
|
There are several additional CLI commands for command line completions,
|
||||||
@ -5101,7 +5177,7 @@ Command Index
|
|||||||
* Menu:
|
* Menu:
|
||||||
|
|
||||||
* access-class ACCESS-LIST: Basic Config Commands.
|
* access-class ACCESS-LIST: Basic Config Commands.
|
||||||
(line 83)
|
(line 121)
|
||||||
* access-list NAME deny IPV4-NETWORK: IP Access List. (line 8)
|
* access-list NAME deny IPV4-NETWORK: IP Access List. (line 8)
|
||||||
* access-list NAME permit IPV4-NETWORK: IP Access List. (line 7)
|
* access-list NAME permit IPV4-NETWORK: IP Access List. (line 7)
|
||||||
* aggregate-address A.B.C.D/M: Route Aggregation. (line 7)
|
* aggregate-address A.B.C.D/M: Route Aggregation. (line 7)
|
||||||
@ -5138,7 +5214,7 @@ Command Index
|
|||||||
* auto-cost refrence-bandwidth <1-4294967>: OSPF router. (line 53)
|
* auto-cost refrence-bandwidth <1-4294967>: OSPF router. (line 53)
|
||||||
* bandwidth <1-10000000>: Interface Commands. (line 31)
|
* bandwidth <1-10000000>: Interface Commands. (line 31)
|
||||||
* banner motd default: Basic Config Commands.
|
* banner motd default: Basic Config Commands.
|
||||||
(line 65)
|
(line 103)
|
||||||
* bgp cluster-id A.B.C.D: Route Reflector. (line 7)
|
* bgp cluster-id A.B.C.D: Route Reflector. (line 7)
|
||||||
* bgp config-type cisco: Multiple instance. (line 20)
|
* bgp config-type cisco: Multiple instance. (line 20)
|
||||||
* bgp config-type zebra: Multiple instance. (line 49)
|
* bgp config-type zebra: Multiple instance. (line 49)
|
||||||
@ -5154,8 +5230,8 @@ Command Index
|
|||||||
(line 11)
|
(line 11)
|
||||||
* clear ip prefix-list NAME A.B.C.D/M: Clear counter of ip prefix-list.
|
* clear ip prefix-list NAME A.B.C.D/M: Clear counter of ip prefix-list.
|
||||||
(line 13)
|
(line 13)
|
||||||
* configure terminal: Basic Config Commands.
|
* configure terminal: Terminal Mode Commands.
|
||||||
(line 36)
|
(line 13)
|
||||||
* debug event: More Show IP BGP. (line 33)
|
* debug event: More Show IP BGP. (line 33)
|
||||||
* debug keepalive: More Show IP BGP. (line 37)
|
* debug keepalive: More Show IP BGP. (line 37)
|
||||||
* debug ospf ism: Debugging OSPF. (line 12)
|
* debug ospf ism: Debugging OSPF. (line 12)
|
||||||
@ -5232,9 +5308,9 @@ Command Index
|
|||||||
* enable password PASSWORD: Basic Config Commands.
|
* enable password PASSWORD: Basic Config Commands.
|
||||||
(line 14)
|
(line 14)
|
||||||
* exec-timeout MINUTE: Basic Config Commands.
|
* exec-timeout MINUTE: Basic Config Commands.
|
||||||
(line 71)
|
(line 109)
|
||||||
* exec-timeout MINUTE SECOND: Basic Config Commands.
|
* exec-timeout MINUTE SECOND: Basic Config Commands.
|
||||||
(line 72)
|
(line 110)
|
||||||
* flush_timer TIME: ripngd Configuration.
|
* flush_timer TIME: ripngd Configuration.
|
||||||
(line 12)
|
(line 12)
|
||||||
* hostname HOSTNAME: Basic Config Commands.
|
* hostname HOSTNAME: Basic Config Commands.
|
||||||
@ -5318,16 +5394,34 @@ Command Index
|
|||||||
* ipv6 route NETWORK GATEWAY DISTANCE: Static Route Commands.
|
* ipv6 route NETWORK GATEWAY DISTANCE: Static Route Commands.
|
||||||
(line 78)
|
(line 78)
|
||||||
* line vty: Basic Config Commands.
|
* line vty: Basic Config Commands.
|
||||||
(line 62)
|
(line 100)
|
||||||
* link-detect: Interface Commands. (line 37)
|
* link-detect: Interface Commands. (line 37)
|
||||||
* list: Basic Config Commands.
|
* list: Terminal Mode Commands.
|
||||||
(line 46)
|
(line 24)
|
||||||
|
* log facility FACILITY: Basic Config Commands.
|
||||||
|
(line 74)
|
||||||
* log file FILENAME: Basic Config Commands.
|
* log file FILENAME: Basic Config Commands.
|
||||||
(line 21)
|
(line 41)
|
||||||
|
* log file FILENAME LEVEL: Basic Config Commands.
|
||||||
|
(line 42)
|
||||||
|
* log monitor: Basic Config Commands.
|
||||||
|
(line 61)
|
||||||
|
* log monitor LEVEL: Basic Config Commands.
|
||||||
|
(line 62)
|
||||||
|
* log record-priority: Basic Config Commands.
|
||||||
|
(line 80)
|
||||||
* log stdout: Basic Config Commands.
|
* log stdout: Basic Config Commands.
|
||||||
(line 17)
|
(line 28)
|
||||||
|
* log stdout LEVEL: Basic Config Commands.
|
||||||
|
(line 29)
|
||||||
* log syslog: Basic Config Commands.
|
* log syslog: Basic Config Commands.
|
||||||
(line 26)
|
(line 52)
|
||||||
|
* log syslog LEVEL: Basic Config Commands.
|
||||||
|
(line 53)
|
||||||
|
* log trap LEVEL: Basic Config Commands.
|
||||||
|
(line 17)
|
||||||
|
* logmsg LEVEL MESSAGE: Terminal Mode Commands.
|
||||||
|
(line 34)
|
||||||
* match as-path WORD: Using AS Path in Route Map.
|
* match as-path WORD: Using AS Path in Route Map.
|
||||||
(line 7)
|
(line 7)
|
||||||
* match aspath AS_PATH: Route Map Match Command.
|
* match aspath AS_PATH: Route Map Match Command.
|
||||||
@ -5429,7 +5523,7 @@ Command Index
|
|||||||
* no auto-cost refrence-bandwidth: OSPF router. (line 54)
|
* no auto-cost refrence-bandwidth: OSPF router. (line 54)
|
||||||
* no bandwidth <1-10000000>: Interface Commands. (line 32)
|
* no bandwidth <1-10000000>: Interface Commands. (line 32)
|
||||||
* no banner motd: Basic Config Commands.
|
* no banner motd: Basic Config Commands.
|
||||||
(line 68)
|
(line 106)
|
||||||
* no bgp multiple-instance: Multiple instance. (line 14)
|
* no bgp multiple-instance: Multiple instance. (line 14)
|
||||||
* no debug event: More Show IP BGP. (line 39)
|
* no debug event: More Show IP BGP. (line 39)
|
||||||
* no debug keepalive: More Show IP BGP. (line 43)
|
* no debug keepalive: More Show IP BGP. (line 43)
|
||||||
@ -5462,7 +5556,7 @@ Command Index
|
|||||||
* no distribute-list NAME out (kernel|connected|static|rip|ospf: Redistribute routes to OSPF.
|
* no distribute-list NAME out (kernel|connected|static|rip|ospf: Redistribute routes to OSPF.
|
||||||
(line 42)
|
(line 42)
|
||||||
* no exec-timeout: Basic Config Commands.
|
* no exec-timeout: Basic Config Commands.
|
||||||
(line 79)
|
(line 117)
|
||||||
* no ip address ADDRESS/PREFIX: Interface Commands. (line 15)
|
* no ip address ADDRESS/PREFIX: Interface Commands. (line 15)
|
||||||
* no ip address ADDRESS/PREFIX secondary: Interface Commands. (line 20)
|
* no ip address ADDRESS/PREFIX secondary: Interface Commands. (line 20)
|
||||||
* no ip as-path access-list WORD: AS Path Access List. (line 12)
|
* no ip as-path access-list WORD: AS Path Access List. (line 12)
|
||||||
@ -5511,10 +5605,20 @@ Command Index
|
|||||||
* no ipv6 nd suppress-ra: Router Advertisement.
|
* no ipv6 nd suppress-ra: Router Advertisement.
|
||||||
(line 7)
|
(line 7)
|
||||||
* no link-detect: Interface Commands. (line 38)
|
* no link-detect: Interface Commands. (line 38)
|
||||||
|
* no log facility: Basic Config Commands.
|
||||||
|
(line 75)
|
||||||
|
* no log file: Basic Config Commands.
|
||||||
|
(line 43)
|
||||||
|
* no log monitor: Basic Config Commands.
|
||||||
|
(line 63)
|
||||||
|
* no log record-priority: Basic Config Commands.
|
||||||
|
(line 81)
|
||||||
* no log stdout: Basic Config Commands.
|
* no log stdout: Basic Config Commands.
|
||||||
(line 18)
|
(line 30)
|
||||||
* no log syslog: Basic Config Commands.
|
* no log syslog: Basic Config Commands.
|
||||||
(line 27)
|
(line 54)
|
||||||
|
* no log trap: Basic Config Commands.
|
||||||
|
(line 18)
|
||||||
* no multicast: Interface Commands. (line 28)
|
* no multicast: Interface Commands. (line 28)
|
||||||
* no neighbor A.B.C.D: RIP Configuration. (line 46)
|
* no neighbor A.B.C.D: RIP Configuration. (line 46)
|
||||||
* no neighbor PEER default-originate: BGP Peer commands. (line 48)
|
* no neighbor PEER default-originate: BGP Peer commands. (line 48)
|
||||||
@ -5662,13 +5766,13 @@ Command Index
|
|||||||
(line 24)
|
(line 24)
|
||||||
* router-id A.B.C.D: OSPF6 router. (line 9)
|
* router-id A.B.C.D: OSPF6 router. (line 9)
|
||||||
* service advanced-vty: Basic Config Commands.
|
* service advanced-vty: Basic Config Commands.
|
||||||
(line 52)
|
(line 93)
|
||||||
* service integrated-vtysh-config: VTY shell integrated configuration.
|
* service integrated-vtysh-config: VTY shell integrated configuration.
|
||||||
(line 7)
|
(line 7)
|
||||||
* service password-encryption: Basic Config Commands.
|
* service password-encryption: Basic Config Commands.
|
||||||
(line 49)
|
(line 90)
|
||||||
* service terminal-length <0-512>: Basic Config Commands.
|
* service terminal-length <0-512>: Basic Config Commands.
|
||||||
(line 55)
|
(line 96)
|
||||||
* set as-path prepend AS-PATH: Using AS Path in Route Map.
|
* set as-path prepend AS-PATH: Using AS Path in Route Map.
|
||||||
(line 9)
|
(line 9)
|
||||||
* set as-path prepend AS_PATH: Route Map Set Command.
|
* set as-path prepend AS_PATH: Route Map Set Command.
|
||||||
@ -5819,8 +5923,10 @@ Command Index
|
|||||||
(line 24)
|
(line 24)
|
||||||
* show ipv6forward: zebra Terminal Mode Commands.
|
* show ipv6forward: zebra Terminal Mode Commands.
|
||||||
(line 28)
|
(line 28)
|
||||||
* show version: Basic Config Commands.
|
* show logging: Terminal Mode Commands.
|
||||||
(line 59)
|
(line 30)
|
||||||
|
* show version: Terminal Mode Commands.
|
||||||
|
(line 27)
|
||||||
* shutdown: Interface Commands. (line 9)
|
* shutdown: Interface Commands. (line 9)
|
||||||
* smux peer OID: MIB and command reference.
|
* smux peer OID: MIB and command reference.
|
||||||
(line 28)
|
(line 28)
|
||||||
@ -5828,18 +5934,18 @@ Command Index
|
|||||||
(line 31)
|
(line 31)
|
||||||
* table TABLENO: Static Route Commands.
|
* table TABLENO: Static Route Commands.
|
||||||
(line 81)
|
(line 81)
|
||||||
* terminal length <0-512>: Basic Config Commands.
|
* terminal length <0-512>: Terminal Mode Commands.
|
||||||
(line 40)
|
(line 17)
|
||||||
* timers basic UPDATE TIMEOUT GARBAGE: RIP Timers. (line 7)
|
* timers basic UPDATE TIMEOUT GARBAGE: RIP Timers. (line 7)
|
||||||
* timers spf <0-4294967295> <0-4294967295>: OSPF router. (line 46)
|
* timers spf <0-4294967295> <0-4294967295>: OSPF router. (line 46)
|
||||||
* username USERNAME nopassword: VTY shell username. (line 7)
|
* username USERNAME nopassword: VTY shell username. (line 7)
|
||||||
* version VERSION: RIP Configuration. (line 23)
|
* version VERSION: RIP Configuration. (line 23)
|
||||||
* who: Basic Config Commands.
|
* who: Terminal Mode Commands.
|
||||||
(line 44)
|
(line 21)
|
||||||
* write file: Basic Config Commands.
|
* write file: Terminal Mode Commands.
|
||||||
(line 33)
|
(line 10)
|
||||||
* write terminal: Basic Config Commands.
|
* write terminal: Terminal Mode Commands.
|
||||||
(line 30)
|
(line 7)
|
||||||
|
|
||||||
|
|
||||||
File: quagga.info, Node: VTY Key Index, Prev: Command Index, Up: Top
|
File: quagga.info, Node: VTY Key Index, Prev: Command Index, Up: Top
|
||||||
@ -5912,138 +6018,139 @@ Ref: Linux notes-Footnote-121476
|
|||||||
Node: Build the Software21542
|
Node: Build the Software21542
|
||||||
Node: Install the Software22090
|
Node: Install the Software22090
|
||||||
Node: Basic commands23550
|
Node: Basic commands23550
|
||||||
Node: Config Commands24264
|
Node: Config Commands24325
|
||||||
Node: Basic Config Commands25126
|
Node: Basic Config Commands25218
|
||||||
Node: Sample Config File27530
|
Node: Sample Config File30316
|
||||||
Node: Common Invocation Options28300
|
Node: Terminal Mode Commands31086
|
||||||
Node: Virtual Terminal Interfaces29707
|
Node: Common Invocation Options32183
|
||||||
Node: VTY Overview30218
|
Node: Virtual Terminal Interfaces33590
|
||||||
Node: VTY Modes31469
|
Node: VTY Overview34101
|
||||||
Node: VTY View Mode31919
|
Node: VTY Modes35352
|
||||||
Node: VTY Enable Mode32169
|
Node: VTY View Mode35802
|
||||||
Node: VTY Other Modes32447
|
Node: VTY Enable Mode36052
|
||||||
Node: VTY CLI Commands32623
|
Node: VTY Other Modes36330
|
||||||
Node: CLI Movement Commands33083
|
Node: VTY CLI Commands36506
|
||||||
Node: CLI Editing Commands33606
|
Node: CLI Movement Commands36966
|
||||||
Node: CLI Advanced Commands34194
|
Node: CLI Editing Commands37489
|
||||||
Node: Zebra34960
|
Node: CLI Advanced Commands38077
|
||||||
Node: Invoking zebra35469
|
Node: Zebra38843
|
||||||
Node: Interface Commands36048
|
Node: Invoking zebra39352
|
||||||
Node: Static Route Commands37580
|
Node: Interface Commands39931
|
||||||
Node: zebra Terminal Mode Commands40853
|
Node: Static Route Commands41463
|
||||||
Node: RIP41818
|
Node: zebra Terminal Mode Commands44736
|
||||||
Node: Starting and Stopping ripd42755
|
Node: RIP45701
|
||||||
Node: RIP netmask44168
|
Node: Starting and Stopping ripd46638
|
||||||
Node: RIP Configuration45267
|
Node: RIP netmask48051
|
||||||
Node: How to Announce RIP route49532
|
Node: RIP Configuration49150
|
||||||
Node: Filtering RIP Routes52095
|
Node: How to Announce RIP route53415
|
||||||
Node: RIP Metric Manipulation53562
|
Node: Filtering RIP Routes55978
|
||||||
Node: RIP distance54475
|
Node: RIP Metric Manipulation57445
|
||||||
Node: RIP route-map55290
|
Node: RIP distance58358
|
||||||
Node: RIP Authentication57806
|
Node: RIP route-map59173
|
||||||
Node: RIP Timers58913
|
Node: RIP Authentication61689
|
||||||
Node: Show RIP Information60199
|
Node: RIP Timers62796
|
||||||
Node: RIP Debug Commands61572
|
Node: Show RIP Information64082
|
||||||
Node: RIPng62568
|
Node: RIP Debug Commands65455
|
||||||
Node: Invoking ripngd62888
|
Node: RIPng66451
|
||||||
Node: ripngd Configuration63137
|
Node: Invoking ripngd66771
|
||||||
Node: ripngd Terminal Mode Commands63888
|
Node: ripngd Configuration67020
|
||||||
Node: ripngd Filtering Commands64252
|
Node: ripngd Terminal Mode Commands67771
|
||||||
Node: OSPFv264761
|
Node: ripngd Filtering Commands68135
|
||||||
Node: Configuring ospfd65320
|
Node: OSPFv268644
|
||||||
Node: OSPF router65788
|
Node: Configuring ospfd69203
|
||||||
Node: OSPF area68944
|
Node: OSPF router69671
|
||||||
Node: OSPF interface74126
|
Node: OSPF area72827
|
||||||
Node: Redistribute routes to OSPF77509
|
Node: OSPF interface78009
|
||||||
Node: Showing OSPF information79672
|
Node: Redistribute routes to OSPF81392
|
||||||
Node: Debugging OSPF80918
|
Node: Showing OSPF information83555
|
||||||
Node: OSPFv381957
|
Node: Debugging OSPF84801
|
||||||
Node: OSPF6 router82277
|
Node: OSPFv385840
|
||||||
Node: OSPF6 area82631
|
Node: OSPF6 router86160
|
||||||
Node: OSPF6 interface82809
|
Node: OSPF6 area86514
|
||||||
Node: Redistribute routes to OSPF683686
|
Node: OSPF6 interface86692
|
||||||
Node: Showing OSPF6 information84002
|
Node: Redistribute routes to OSPF687569
|
||||||
Node: BGP84822
|
Node: Showing OSPF6 information87885
|
||||||
Node: Starting BGP85712
|
Node: BGP88705
|
||||||
Node: BGP router86289
|
Node: Starting BGP89595
|
||||||
Node: BGP distance87533
|
Node: BGP router90172
|
||||||
Node: BGP decision process87971
|
Node: BGP distance91416
|
||||||
Node: BGP network88241
|
Node: BGP decision process91854
|
||||||
Node: BGP route88431
|
Node: BGP network92124
|
||||||
Node: Route Aggregation88987
|
Node: BGP route92314
|
||||||
Node: Redistribute to BGP89556
|
Node: Route Aggregation92870
|
||||||
Node: BGP Peer90083
|
Node: Redistribute to BGP93439
|
||||||
Node: Defining Peer90270
|
Node: BGP Peer93966
|
||||||
Node: BGP Peer commands90883
|
Node: Defining Peer94153
|
||||||
Node: Peer filtering93287
|
Node: BGP Peer commands94766
|
||||||
Node: BGP Peer Group93795
|
Node: Peer filtering97170
|
||||||
Node: BGP Address Family94108
|
Node: BGP Peer Group97678
|
||||||
Node: Autonomous System94262
|
Node: BGP Address Family97991
|
||||||
Node: AS Path Regular Expression95099
|
Node: Autonomous System98145
|
||||||
Node: Display BGP Routes by AS Path96346
|
Node: AS Path Regular Expression98982
|
||||||
Node: AS Path Access List96786
|
Node: Display BGP Routes by AS Path100229
|
||||||
Node: Using AS Path in Route Map97253
|
Node: AS Path Access List100669
|
||||||
Node: Private AS Numbers97534
|
Node: Using AS Path in Route Map101136
|
||||||
Node: BGP Communities Attribute97692
|
Node: Private AS Numbers101417
|
||||||
Node: BGP Community Lists100159
|
Node: BGP Communities Attribute101575
|
||||||
Node: Numbered BGP Community Lists102813
|
Node: BGP Community Lists104042
|
||||||
Node: BGP Community in Route Map104400
|
Node: Numbered BGP Community Lists106696
|
||||||
Node: Display BGP Routes by Community106343
|
Node: BGP Community in Route Map108283
|
||||||
Node: Using BGP Communities Attribute107512
|
Node: Display BGP Routes by Community110226
|
||||||
Node: BGP Extended Communities Attribute111080
|
Node: Using BGP Communities Attribute111395
|
||||||
Node: BGP Extended Community Lists112852
|
Node: BGP Extended Communities Attribute114963
|
||||||
Node: BGP Extended Communities in Route Map114727
|
Node: BGP Extended Community Lists116735
|
||||||
Node: Displaying BGP routes115186
|
Node: BGP Extended Communities in Route Map118610
|
||||||
Node: Show IP BGP115423
|
Node: Displaying BGP routes119069
|
||||||
Node: More Show IP BGP116123
|
Node: Show IP BGP119306
|
||||||
Node: Capability Negotiation117274
|
Node: More Show IP BGP120006
|
||||||
Node: Route Reflector120578
|
Node: Capability Negotiation121157
|
||||||
Node: Route Server120857
|
Node: Route Reflector124461
|
||||||
Node: Multiple instance121923
|
Node: Route Server124740
|
||||||
Node: BGP instance and view123734
|
Node: Multiple instance125806
|
||||||
Node: Routing policy125114
|
Node: BGP instance and view127617
|
||||||
Node: Viewing the view125882
|
Node: Routing policy128997
|
||||||
Node: How to set up a 6-Bone connection126167
|
Node: Viewing the view129765
|
||||||
Node: Dump BGP packets and table127539
|
Node: How to set up a 6-Bone connection130050
|
||||||
Node: Configuring Quagga as a Route Server128086
|
Node: Dump BGP packets and table131422
|
||||||
Node: Description of the Route Server model129047
|
Node: Configuring Quagga as a Route Server131969
|
||||||
Ref: fig:normal-processing130624
|
Node: Description of the Route Server model132930
|
||||||
Ref: fig:full-mesh130774
|
Ref: fig:normal-processing134507
|
||||||
Ref: fig:route-server130870
|
Ref: fig:full-mesh134657
|
||||||
Ref: filter-delegation131284
|
Ref: fig:route-server134753
|
||||||
Ref: Route Server tasks132468
|
Ref: filter-delegation135167
|
||||||
Ref: Route-server path filter process132839
|
Ref: Route Server tasks136351
|
||||||
Ref: fig:rs-processing135153
|
Ref: Route-server path filter process136722
|
||||||
Node: Commands for configuring a Route Server135270
|
Ref: fig:rs-processing139036
|
||||||
Node: Example of Route Server Configuration138297
|
Node: Commands for configuring a Route Server139153
|
||||||
Node: Configuration of the BGP routers without Route Server139218
|
Node: Example of Route Server Configuration142180
|
||||||
Node: Configuration of the BGP routers with Route Server142101
|
Node: Configuration of the BGP routers without Route Server143101
|
||||||
Node: Configuration of the Route Server itself143402
|
Node: Configuration of the BGP routers with Route Server145984
|
||||||
Node: Further considerations about Import and Export route-maps148401
|
Node: Configuration of the Route Server itself147285
|
||||||
Node: VTY shell151445
|
Node: Further considerations about Import and Export route-maps152284
|
||||||
Node: VTY shell username152114
|
Node: VTY shell155328
|
||||||
Node: VTY shell integrated configuration152746
|
Node: VTY shell username155997
|
||||||
Node: Filtering154124
|
Node: VTY shell integrated configuration156629
|
||||||
Node: IP Access List154477
|
Node: Filtering158007
|
||||||
Node: IP Prefix List154863
|
Node: IP Access List158360
|
||||||
Node: ip prefix-list description157882
|
Node: IP Prefix List158746
|
||||||
Node: ip prefix-list sequential number control158409
|
Node: ip prefix-list description161765
|
||||||
Node: Showing ip prefix-list158951
|
Node: ip prefix-list sequential number control162292
|
||||||
Node: Clear counter of ip prefix-list160059
|
Node: Showing ip prefix-list162834
|
||||||
Node: Route Map160498
|
Node: Clear counter of ip prefix-list163942
|
||||||
Node: Route Map Command161003
|
Node: Route Map164381
|
||||||
Node: Route Map Match Command161200
|
Node: Route Map Command164886
|
||||||
Node: Route Map Set Command161824
|
Node: Route Map Match Command165083
|
||||||
Node: IPv6 Support162701
|
Node: Route Map Set Command165707
|
||||||
Node: Router Advertisement163273
|
Node: IPv6 Support166584
|
||||||
Node: Kernel Interface167074
|
Node: Router Advertisement167156
|
||||||
Node: SNMP Support169031
|
Node: Kernel Interface170957
|
||||||
Node: Getting and installing an SNMP agent169603
|
Node: SNMP Support172914
|
||||||
Node: SMUX configuration170176
|
Node: Getting and installing an SNMP agent173486
|
||||||
Node: MIB and command reference172312
|
Node: SMUX configuration174059
|
||||||
Node: Zebra Protocol173699
|
Node: MIB and command reference176195
|
||||||
Node: Packet Binary Dump Format175613
|
Node: Zebra Protocol177582
|
||||||
Node: Command Index187223
|
Node: Packet Binary Dump Format179496
|
||||||
Node: VTY Key Index241352
|
Node: Command Index191106
|
||||||
|
Node: VTY Key Index247299
|
||||||
|
|
||||||
End Tag Table
|
End Tag Table
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
||||||
|
|
||||||
|
* isis_main.c: (main) The 2nd argument to openzlog has been removed.
|
||||||
|
|
||||||
2004-12-03 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
2004-12-03 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
||||||
|
|
||||||
* isis_main.c: (sigint,sigterm) Use zlog_notice for termination message.
|
* isis_main.c: (sigint,sigterm) Use zlog_notice for termination message.
|
||||||
|
@ -218,7 +218,7 @@ main (int argc, char **argv, char **envp)
|
|||||||
/* Get the programname without the preceding path. */
|
/* Get the programname without the preceding path. */
|
||||||
progname = ((p = strrchr (argv[0], '/')) ? ++p : argv[0]);
|
progname = ((p = strrchr (argv[0], '/')) ? ++p : argv[0]);
|
||||||
|
|
||||||
zlog_default = openzlog (progname, ZLOG_NOLOG, ZLOG_ISIS,
|
zlog_default = openzlog (progname, ZLOG_ISIS,
|
||||||
LOG_CONS | LOG_NDELAY | LOG_PID, LOG_DAEMON);
|
LOG_CONS | LOG_NDELAY | LOG_PID, LOG_DAEMON);
|
||||||
|
|
||||||
/* for reload */
|
/* for reload */
|
||||||
|
@ -1,3 +1,72 @@
|
|||||||
|
2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2004-12-03 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
2004-12-03 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
||||||
|
|
||||||
* log.h: Document appropriate use of syslog logging priorities
|
* log.h: Document appropriate use of syslog logging priorities
|
||||||
|
632
lib/command.c
632
lib/command.c
@ -1,4 +1,7 @@
|
|||||||
/* Command interpreter routine for virtual terminal [aka TeletYpe]
|
/*
|
||||||
|
$Id: command.c,v 1.28 2004/12/07 15:39:32 ajs Exp $
|
||||||
|
|
||||||
|
Command interpreter routine for virtual terminal [aka TeletYpe]
|
||||||
Copyright (C) 1997, 98, 99 Kunihiro Ishiguro
|
Copyright (C) 1997, 98, 99 Kunihiro Ishiguro
|
||||||
|
|
||||||
This file is part of GNU Zebra.
|
This file is part of GNU Zebra.
|
||||||
@ -75,6 +78,70 @@ Hello, this is " QUAGGA_PROGNAME " (version " QUAGGA_VERSION ").\r\n\
|
|||||||
" QUAGGA_COPYRIGHT "\r\n\
|
" QUAGGA_COPYRIGHT "\r\n\
|
||||||
\r\n";
|
\r\n";
|
||||||
|
|
||||||
|
|
||||||
|
static struct facility_map {
|
||||||
|
int facility;
|
||||||
|
const char *name;
|
||||||
|
size_t match;
|
||||||
|
} syslog_facilities[] =
|
||||||
|
{
|
||||||
|
{ LOG_KERN, "kern", 1 },
|
||||||
|
{ LOG_USER, "user", 2 },
|
||||||
|
{ LOG_MAIL, "mail", 1 },
|
||||||
|
{ LOG_DAEMON, "daemon", 1 },
|
||||||
|
{ LOG_AUTH, "auth", 1 },
|
||||||
|
{ LOG_SYSLOG, "syslog", 1 },
|
||||||
|
{ LOG_LPR, "lpr", 2 },
|
||||||
|
{ LOG_NEWS, "news", 1 },
|
||||||
|
{ LOG_UUCP, "uucp", 2 },
|
||||||
|
{ LOG_CRON, "cron", 1 },
|
||||||
|
#ifdef LOG_FTP
|
||||||
|
{ LOG_FTP, "ftp", 1 },
|
||||||
|
#endif
|
||||||
|
{ LOG_LOCAL0, "local0", 6 },
|
||||||
|
{ LOG_LOCAL1, "local1", 6 },
|
||||||
|
{ LOG_LOCAL2, "local2", 6 },
|
||||||
|
{ LOG_LOCAL3, "local3", 6 },
|
||||||
|
{ LOG_LOCAL4, "local4", 6 },
|
||||||
|
{ LOG_LOCAL5, "local5", 6 },
|
||||||
|
{ LOG_LOCAL6, "local6", 6 },
|
||||||
|
{ LOG_LOCAL7, "local7", 6 },
|
||||||
|
{ 0, NULL, 0 },
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
facility_name(int facility)
|
||||||
|
{
|
||||||
|
struct facility_map *fm;
|
||||||
|
|
||||||
|
for (fm = syslog_facilities; fm->name; fm++)
|
||||||
|
if (fm->facility == facility)
|
||||||
|
return fm->name;
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
facility_match(const char *str)
|
||||||
|
{
|
||||||
|
struct facility_map *fm;
|
||||||
|
|
||||||
|
for (fm = syslog_facilities; fm->name; fm++)
|
||||||
|
if (!strncmp(str,fm->name,fm->match))
|
||||||
|
return fm->facility;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
level_match(const char *s)
|
||||||
|
{
|
||||||
|
int level ;
|
||||||
|
|
||||||
|
for ( level = 0 ; zlog_priority [level] != NULL ; level ++ )
|
||||||
|
if (!strncmp (s, zlog_priority[level], 2))
|
||||||
|
return level;
|
||||||
|
return ZLOG_DISABLED;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
print_version (const char *progname)
|
print_version (const char *progname)
|
||||||
{
|
{
|
||||||
@ -128,7 +195,7 @@ install_node (struct cmd_node *node,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Compare two command's string. Used in sort_node (). */
|
/* Compare two command's string. Used in sort_node (). */
|
||||||
int
|
static int
|
||||||
cmp_node (const void *p, const void *q)
|
cmp_node (const void *p, const void *q)
|
||||||
{
|
{
|
||||||
struct cmd_element *a = *(struct cmd_element **)p;
|
struct cmd_element *a = *(struct cmd_element **)p;
|
||||||
@ -137,7 +204,7 @@ cmp_node (const void *p, const void *q)
|
|||||||
return strcmp (a->string, b->string);
|
return strcmp (a->string, b->string);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
cmp_desc (const void *p, const void *q)
|
cmp_desc (const void *p, const void *q)
|
||||||
{
|
{
|
||||||
struct desc *a = *(struct desc **)p;
|
struct desc *a = *(struct desc **)p;
|
||||||
@ -241,7 +308,7 @@ cmd_free_strvec (vector v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Fetch next description. Used in cmd_make_descvec(). */
|
/* Fetch next description. Used in cmd_make_descvec(). */
|
||||||
char *
|
static char *
|
||||||
cmd_desc_str (const char **string)
|
cmd_desc_str (const char **string)
|
||||||
{
|
{
|
||||||
const char *cp, *start;
|
const char *cp, *start;
|
||||||
@ -277,7 +344,7 @@ cmd_desc_str (const char **string)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* New string vector. */
|
/* New string vector. */
|
||||||
vector
|
static vector
|
||||||
cmd_make_descvec (const char *string, const char *descstr)
|
cmd_make_descvec (const char *string, const char *descstr)
|
||||||
{
|
{
|
||||||
int multiple = 0;
|
int multiple = 0;
|
||||||
@ -370,7 +437,7 @@ cmd_make_descvec (const char *string, const char *descstr)
|
|||||||
|
|
||||||
/* Count mandantory string vector size. This is to determine inputed
|
/* Count mandantory string vector size. This is to determine inputed
|
||||||
command has enough command length. */
|
command has enough command length. */
|
||||||
int
|
static int
|
||||||
cmd_cmdsize (vector strvec)
|
cmd_cmdsize (vector strvec)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@ -430,7 +497,7 @@ install_element (enum node_type ntype, struct cmd_element *cmd)
|
|||||||
static unsigned char itoa64[] =
|
static unsigned char itoa64[] =
|
||||||
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||||
|
|
||||||
void
|
static void
|
||||||
to64(char *s, long v, int n)
|
to64(char *s, long v, int n)
|
||||||
{
|
{
|
||||||
while (--n >= 0)
|
while (--n >= 0)
|
||||||
@ -440,7 +507,8 @@ to64(char *s, long v, int n)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char *zencrypt (const char *passwd)
|
static char *
|
||||||
|
zencrypt (const char *passwd)
|
||||||
{
|
{
|
||||||
char salt[6];
|
char salt[6];
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
@ -455,73 +523,8 @@ char *zencrypt (const char *passwd)
|
|||||||
return crypt (passwd, salt);
|
return crypt (passwd, salt);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
|
||||||
syslog_facility_print (int facility)
|
|
||||||
{
|
|
||||||
switch (facility)
|
|
||||||
{
|
|
||||||
case LOG_KERN:
|
|
||||||
return "kern";
|
|
||||||
break;
|
|
||||||
case LOG_USER:
|
|
||||||
return "user";
|
|
||||||
break;
|
|
||||||
case LOG_MAIL:
|
|
||||||
return "mail";
|
|
||||||
break;
|
|
||||||
case LOG_DAEMON:
|
|
||||||
return "daemon";
|
|
||||||
break;
|
|
||||||
case LOG_AUTH:
|
|
||||||
return "auth";
|
|
||||||
break;
|
|
||||||
case LOG_SYSLOG:
|
|
||||||
return "syslog";
|
|
||||||
break;
|
|
||||||
case LOG_LPR:
|
|
||||||
return "lpr";
|
|
||||||
break;
|
|
||||||
case LOG_NEWS:
|
|
||||||
return "news";
|
|
||||||
break;
|
|
||||||
case LOG_UUCP:
|
|
||||||
return "uucp";
|
|
||||||
break;
|
|
||||||
case LOG_CRON:
|
|
||||||
return "cron";
|
|
||||||
break;
|
|
||||||
case LOG_LOCAL0:
|
|
||||||
return "local0";
|
|
||||||
break;
|
|
||||||
case LOG_LOCAL1:
|
|
||||||
return "local1";
|
|
||||||
break;
|
|
||||||
case LOG_LOCAL2:
|
|
||||||
return "local2";
|
|
||||||
break;
|
|
||||||
case LOG_LOCAL3:
|
|
||||||
return "local3";
|
|
||||||
break;
|
|
||||||
case LOG_LOCAL4:
|
|
||||||
return "local4";
|
|
||||||
break;
|
|
||||||
case LOG_LOCAL5:
|
|
||||||
return "local5";
|
|
||||||
break;
|
|
||||||
case LOG_LOCAL6:
|
|
||||||
return "local6";
|
|
||||||
break;
|
|
||||||
case LOG_LOCAL7:
|
|
||||||
return "local7";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This function write configuration of this host. */
|
/* This function write configuration of this host. */
|
||||||
int
|
static int
|
||||||
config_write_host (struct vty *vty)
|
config_write_host (struct vty *vty)
|
||||||
{
|
{
|
||||||
if (host.name)
|
if (host.name)
|
||||||
@ -542,21 +545,46 @@ config_write_host (struct vty *vty)
|
|||||||
vty_out (vty, "enable password %s%s", host.enable, VTY_NEWLINE);
|
vty_out (vty, "enable password %s%s", host.enable, VTY_NEWLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (host.logfile)
|
if (zlog_default->default_lvl != LOG_DEBUG)
|
||||||
vty_out (vty, "log file %s%s", host.logfile, VTY_NEWLINE);
|
vty_out (vty, "log trap %s%s",
|
||||||
|
zlog_priority[zlog_default->default_lvl], VTY_NEWLINE);
|
||||||
|
|
||||||
if (zlog_default->flags & ZLOG_STDOUT)
|
if (host.logfile && (zlog_default->maxlvl[ZLOG_DEST_FILE] != ZLOG_DISABLED))
|
||||||
vty_out (vty, "log stdout%s", VTY_NEWLINE);
|
|
||||||
|
|
||||||
if (zlog_default->flags & ZLOG_SYSLOG)
|
|
||||||
{
|
{
|
||||||
vty_out (vty, "log syslog");
|
vty_out (vty, "log file %s", host.logfile);
|
||||||
if (zlog_default->facility != LOG_DAEMON)
|
if (zlog_default->maxlvl[ZLOG_DEST_FILE] != zlog_default->default_lvl)
|
||||||
vty_out (vty, " facility %s", syslog_facility_print (zlog_default->facility));
|
vty_out (vty, " %s",
|
||||||
|
zlog_priority[zlog_default->maxlvl[ZLOG_DEST_FILE]]);
|
||||||
vty_out (vty, "%s", VTY_NEWLINE);
|
vty_out (vty, "%s", VTY_NEWLINE);
|
||||||
}
|
}
|
||||||
if (zlog_default->maskpri != LOG_DEBUG)
|
|
||||||
vty_out (vty, "log trap %s%s", zlog_priority[zlog_default->maskpri], VTY_NEWLINE);
|
if (zlog_default->maxlvl[ZLOG_DEST_STDOUT] != ZLOG_DISABLED)
|
||||||
|
{
|
||||||
|
vty_out (vty, "log stdout");
|
||||||
|
if (zlog_default->maxlvl[ZLOG_DEST_STDOUT] != zlog_default->default_lvl)
|
||||||
|
vty_out (vty, " %s",
|
||||||
|
zlog_priority[zlog_default->maxlvl[ZLOG_DEST_STDOUT]]);
|
||||||
|
vty_out (vty, "%s", VTY_NEWLINE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (zlog_default->maxlvl[ZLOG_DEST_MONITOR] == ZLOG_DISABLED)
|
||||||
|
vty_out(vty,"no log monitor%s",VTY_NEWLINE);
|
||||||
|
else if (zlog_default->maxlvl[ZLOG_DEST_MONITOR] != zlog_default->default_lvl)
|
||||||
|
vty_out(vty,"log monitor %s%s",
|
||||||
|
zlog_priority[zlog_default->maxlvl[ZLOG_DEST_MONITOR]],VTY_NEWLINE);
|
||||||
|
|
||||||
|
if (zlog_default->maxlvl[ZLOG_DEST_SYSLOG] != ZLOG_DISABLED)
|
||||||
|
{
|
||||||
|
vty_out (vty, "log syslog");
|
||||||
|
if (zlog_default->maxlvl[ZLOG_DEST_SYSLOG] != zlog_default->default_lvl)
|
||||||
|
vty_out (vty, " %s",
|
||||||
|
zlog_priority[zlog_default->maxlvl[ZLOG_DEST_SYSLOG]]);
|
||||||
|
vty_out (vty, "%s", VTY_NEWLINE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (zlog_default->facility != LOG_DAEMON)
|
||||||
|
vty_out (vty, "log facility %s%s",
|
||||||
|
facility_name(zlog_default->facility), VTY_NEWLINE);
|
||||||
|
|
||||||
if (zlog_default->record_priority == 1)
|
if (zlog_default->record_priority == 1)
|
||||||
vty_out (vty, "log record-priority%s", VTY_NEWLINE);
|
vty_out (vty, "log record-priority%s", VTY_NEWLINE);
|
||||||
@ -578,15 +606,17 @@ config_write_host (struct vty *vty)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Utility function for getting command vector. */
|
/* Utility function for getting command vector. */
|
||||||
vector
|
static vector
|
||||||
cmd_node_vector (vector v, enum node_type ntype)
|
cmd_node_vector (vector v, enum node_type ntype)
|
||||||
{
|
{
|
||||||
struct cmd_node *cnode = vector_slot (v, ntype);
|
struct cmd_node *cnode = vector_slot (v, ntype);
|
||||||
return cnode->cmd_vector;
|
return cnode->cmd_vector;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Filter command vector by symbol */
|
#if 0
|
||||||
int
|
/* Filter command vector by symbol. This function is not actually used;
|
||||||
|
* should it be deleted? */
|
||||||
|
static int
|
||||||
cmd_filter_by_symbol (char *command, char *symbol)
|
cmd_filter_by_symbol (char *command, char *symbol)
|
||||||
{
|
{
|
||||||
int i, lim;
|
int i, lim;
|
||||||
@ -629,6 +659,7 @@ cmd_filter_by_symbol (char *command, char *symbol)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Completion match types. */
|
/* Completion match types. */
|
||||||
enum match_type
|
enum match_type
|
||||||
@ -645,7 +676,7 @@ enum match_type
|
|||||||
exact_match
|
exact_match
|
||||||
};
|
};
|
||||||
|
|
||||||
enum match_type
|
static enum match_type
|
||||||
cmd_ipv4_match (const char *str)
|
cmd_ipv4_match (const char *str)
|
||||||
{
|
{
|
||||||
const char *sp;
|
const char *sp;
|
||||||
@ -702,7 +733,7 @@ cmd_ipv4_match (const char *str)
|
|||||||
return exact_match;
|
return exact_match;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum match_type
|
static enum match_type
|
||||||
cmd_ipv4_prefix_match (const char *str)
|
cmd_ipv4_prefix_match (const char *str)
|
||||||
{
|
{
|
||||||
const char *sp;
|
const char *sp;
|
||||||
@ -793,7 +824,7 @@ cmd_ipv4_prefix_match (const char *str)
|
|||||||
|
|
||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
|
|
||||||
enum match_type
|
static enum match_type
|
||||||
cmd_ipv6_match (const char *str)
|
cmd_ipv6_match (const char *str)
|
||||||
{
|
{
|
||||||
int state = STATE_START;
|
int state = STATE_START;
|
||||||
@ -899,7 +930,7 @@ cmd_ipv6_match (const char *str)
|
|||||||
return exact_match;
|
return exact_match;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum match_type
|
static enum match_type
|
||||||
cmd_ipv6_prefix_match (const char *str)
|
cmd_ipv6_prefix_match (const char *str)
|
||||||
{
|
{
|
||||||
int state = STATE_START;
|
int state = STATE_START;
|
||||||
@ -1034,7 +1065,7 @@ cmd_ipv6_prefix_match (const char *str)
|
|||||||
|
|
||||||
#define DECIMAL_STRLEN_MAX 10
|
#define DECIMAL_STRLEN_MAX 10
|
||||||
|
|
||||||
int
|
static int
|
||||||
cmd_range_match (const char *range, const char *str)
|
cmd_range_match (const char *range, const char *str)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
@ -1080,7 +1111,7 @@ cmd_range_match (const char *range, const char *str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Make completion match and return match type flag. */
|
/* Make completion match and return match type flag. */
|
||||||
enum match_type
|
static enum match_type
|
||||||
cmd_filter_by_completion (char *command, vector v, unsigned int index)
|
cmd_filter_by_completion (char *command, vector v, unsigned int index)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@ -1195,7 +1226,7 @@ cmd_filter_by_completion (char *command, vector v, unsigned int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Filter vector by command character with index. */
|
/* Filter vector by command character with index. */
|
||||||
enum match_type
|
static enum match_type
|
||||||
cmd_filter_by_string (char *command, vector v, unsigned int index)
|
cmd_filter_by_string (char *command, vector v, unsigned int index)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@ -1303,7 +1334,7 @@ cmd_filter_by_string (char *command, vector v, unsigned int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check ambiguous match */
|
/* Check ambiguous match */
|
||||||
int
|
static int
|
||||||
is_cmd_ambiguous (char *command, vector v, int index, enum match_type type)
|
is_cmd_ambiguous (char *command, vector v, int index, enum match_type type)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@ -1400,7 +1431,7 @@ is_cmd_ambiguous (char *command, vector v, int index, enum match_type type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If src matches dst return dst string, otherwise return NULL */
|
/* If src matches dst return dst string, otherwise return NULL */
|
||||||
const char *
|
static const char *
|
||||||
cmd_entry_function (const char *src, const char *dst)
|
cmd_entry_function (const char *src, const char *dst)
|
||||||
{
|
{
|
||||||
/* Skip variable arguments. */
|
/* Skip variable arguments. */
|
||||||
@ -1422,7 +1453,7 @@ cmd_entry_function (const char *src, const char *dst)
|
|||||||
/* If src matches dst return dst string, otherwise return NULL */
|
/* If src matches dst return dst string, otherwise return NULL */
|
||||||
/* This version will return the dst string always if it is
|
/* This version will return the dst string always if it is
|
||||||
CMD_VARIABLE for '?' key processing */
|
CMD_VARIABLE for '?' key processing */
|
||||||
const char *
|
static const char *
|
||||||
cmd_entry_function_desc (const char *src, const char *dst)
|
cmd_entry_function_desc (const char *src, const char *dst)
|
||||||
{
|
{
|
||||||
if (CMD_VARARG (dst))
|
if (CMD_VARARG (dst))
|
||||||
@ -1486,7 +1517,7 @@ cmd_entry_function_desc (const char *src, const char *dst)
|
|||||||
|
|
||||||
/* Check same string element existence. If it isn't there return
|
/* Check same string element existence. If it isn't there return
|
||||||
1. */
|
1. */
|
||||||
int
|
static int
|
||||||
cmd_unique_string (vector v, const char *str)
|
cmd_unique_string (vector v, const char *str)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@ -1501,7 +1532,7 @@ cmd_unique_string (vector v, const char *str)
|
|||||||
|
|
||||||
/* Compare string to description vector. If there is same string
|
/* Compare string to description vector. If there is same string
|
||||||
return 1 else return 0. */
|
return 1 else return 0. */
|
||||||
int
|
static int
|
||||||
desc_unique_string (vector v, const char *str)
|
desc_unique_string (vector v, const char *str)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@ -1514,7 +1545,7 @@ desc_unique_string (vector v, const char *str)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
cmd_try_do_shortcut (enum node_type node, char* first_word) {
|
cmd_try_do_shortcut (enum node_type node, char* first_word) {
|
||||||
if ( first_word != NULL &&
|
if ( first_word != NULL &&
|
||||||
node != AUTH_NODE &&
|
node != AUTH_NODE &&
|
||||||
@ -1527,7 +1558,7 @@ cmd_try_do_shortcut (enum node_type node, char* first_word) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* '?' describe command support. */
|
/* '?' describe command support. */
|
||||||
vector
|
static vector
|
||||||
cmd_describe_command_real (vector vline, struct vty *vty, int *status)
|
cmd_describe_command_real (vector vline, struct vty *vty, int *status)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@ -1690,7 +1721,7 @@ cmd_describe_command (vector vline, struct vty *vty, int *status)
|
|||||||
|
|
||||||
|
|
||||||
/* Check LCD of matched command. */
|
/* Check LCD of matched command. */
|
||||||
int
|
static int
|
||||||
cmd_lcd (char **matched)
|
cmd_lcd (char **matched)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -1723,7 +1754,7 @@ cmd_lcd (char **matched)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Command line completion support. */
|
/* Command line completion support. */
|
||||||
char **
|
static char **
|
||||||
cmd_complete_command_real (vector vline, struct vty *vty, int *status)
|
cmd_complete_command_real (vector vline, struct vty *vty, int *status)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@ -1905,7 +1936,8 @@ cmd_complete_command (vector vline, struct vty *vty, int *status)
|
|||||||
|
|
||||||
/* return parent node */
|
/* return parent node */
|
||||||
/* MUST eventually converge on CONFIG_NODE */
|
/* MUST eventually converge on CONFIG_NODE */
|
||||||
enum node_type node_parent ( enum node_type node )
|
static enum node_type
|
||||||
|
node_parent ( enum node_type node )
|
||||||
{
|
{
|
||||||
enum node_type ret;
|
enum node_type ret;
|
||||||
|
|
||||||
@ -1930,7 +1962,7 @@ enum node_type node_parent ( enum node_type node )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Execute command by argument vline vector. */
|
/* Execute command by argument vline vector. */
|
||||||
int
|
static int
|
||||||
cmd_execute_command_real (vector vline, struct vty *vty, struct cmd_element **cmd)
|
cmd_execute_command_real (vector vline, struct vty *vty, struct cmd_element **cmd)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@ -2959,40 +2991,158 @@ DEFUN (no_service_terminal_length, no_service_terminal_length_cmd,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFUN (config_logmsg,
|
||||||
|
config_logmsg_cmd,
|
||||||
|
"logmsg "LOG_LEVELS" .MESSAGE",
|
||||||
|
"Send a message to enabled logging destinations\n"
|
||||||
|
LOG_LEVEL_DESC
|
||||||
|
"The message to send\n")
|
||||||
|
{
|
||||||
|
int level;
|
||||||
|
char *message;
|
||||||
|
|
||||||
|
if ((level = level_match(argv[0])) == ZLOG_DISABLED)
|
||||||
|
return CMD_ERR_NO_MATCH;
|
||||||
|
|
||||||
|
zlog(NULL, level, (message = argv_concat(argv, argc, 1)));
|
||||||
|
XFREE(MTYPE_TMP, message);
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUN (show_logging,
|
||||||
|
show_logging_cmd,
|
||||||
|
"show logging",
|
||||||
|
SHOW_STR
|
||||||
|
"Show current logging configuration\n")
|
||||||
|
{
|
||||||
|
struct zlog *zl = zlog_default;
|
||||||
|
|
||||||
|
vty_out (vty, "Syslog logging: ");
|
||||||
|
if (zl->maxlvl[ZLOG_DEST_SYSLOG] == ZLOG_DISABLED)
|
||||||
|
vty_out (vty, "disabled");
|
||||||
|
else
|
||||||
|
vty_out (vty, "level %s, facility %s, ident %s",
|
||||||
|
zlog_priority[zl->maxlvl[ZLOG_DEST_SYSLOG]],
|
||||||
|
facility_name(zl->facility), zl->ident);
|
||||||
|
vty_out (vty, "%s", VTY_NEWLINE);
|
||||||
|
|
||||||
|
vty_out (vty, "Stdout logging: ");
|
||||||
|
if (zl->maxlvl[ZLOG_DEST_STDOUT] == ZLOG_DISABLED)
|
||||||
|
vty_out (vty, "disabled");
|
||||||
|
else
|
||||||
|
vty_out (vty, "level %s",
|
||||||
|
zlog_priority[zl->maxlvl[ZLOG_DEST_STDOUT]]);
|
||||||
|
vty_out (vty, "%s", VTY_NEWLINE);
|
||||||
|
|
||||||
|
vty_out (vty, "Monitor logging: ");
|
||||||
|
if (zl->maxlvl[ZLOG_DEST_MONITOR] == ZLOG_DISABLED)
|
||||||
|
vty_out (vty, "disabled");
|
||||||
|
else
|
||||||
|
vty_out (vty, "level %s",
|
||||||
|
zlog_priority[zl->maxlvl[ZLOG_DEST_MONITOR]]);
|
||||||
|
vty_out (vty, "%s", VTY_NEWLINE);
|
||||||
|
|
||||||
|
vty_out (vty, "File logging: ");
|
||||||
|
if ((zl->maxlvl[ZLOG_DEST_FILE] == ZLOG_DISABLED) ||
|
||||||
|
!zl->fp)
|
||||||
|
vty_out (vty, "disabled");
|
||||||
|
else
|
||||||
|
vty_out (vty, "level %s, filename %s",
|
||||||
|
zlog_priority[zl->maxlvl[ZLOG_DEST_FILE]],
|
||||||
|
zl->filename);
|
||||||
|
vty_out (vty, "%s", VTY_NEWLINE);
|
||||||
|
|
||||||
|
vty_out (vty, "Protocol name: %s%s",
|
||||||
|
zlog_proto_names[zl->protocol], VTY_NEWLINE);
|
||||||
|
vty_out (vty, "Record priority: %s%s",
|
||||||
|
(zl->record_priority ? "enabled" : "disabled"), VTY_NEWLINE);
|
||||||
|
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
DEFUN (config_log_stdout,
|
DEFUN (config_log_stdout,
|
||||||
config_log_stdout_cmd,
|
config_log_stdout_cmd,
|
||||||
"log stdout",
|
"log stdout",
|
||||||
"Logging control\n"
|
"Logging control\n"
|
||||||
"Logging goes to stdout\n")
|
"Set stdout logging level\n")
|
||||||
{
|
{
|
||||||
zlog_set_flag (NULL, ZLOG_STDOUT);
|
zlog_set_level (NULL, ZLOG_DEST_STDOUT, zlog_default->default_lvl);
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUN (config_log_stdout_level,
|
||||||
|
config_log_stdout_level_cmd,
|
||||||
|
"log stdout "LOG_LEVELS,
|
||||||
|
"Logging control\n"
|
||||||
|
"Set stdout logging level\n"
|
||||||
|
LOG_LEVEL_DESC)
|
||||||
|
{
|
||||||
|
int level;
|
||||||
|
|
||||||
|
if ((level = level_match(argv[0])) == ZLOG_DISABLED)
|
||||||
|
return CMD_ERR_NO_MATCH;
|
||||||
|
zlog_set_level (NULL, ZLOG_DEST_STDOUT, level);
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (no_config_log_stdout,
|
DEFUN (no_config_log_stdout,
|
||||||
no_config_log_stdout_cmd,
|
no_config_log_stdout_cmd,
|
||||||
"no log stdout",
|
"no log stdout [LEVEL]",
|
||||||
NO_STR
|
NO_STR
|
||||||
"Logging control\n"
|
"Logging control\n"
|
||||||
"Cancel logging to stdout\n")
|
"Cancel logging to stdout\n"
|
||||||
|
"Logging level\n")
|
||||||
{
|
{
|
||||||
zlog_reset_flag (NULL, ZLOG_STDOUT);
|
zlog_set_level (NULL, ZLOG_DEST_STDOUT, ZLOG_DISABLED);
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (config_log_file,
|
DEFUN (config_log_monitor,
|
||||||
config_log_file_cmd,
|
config_log_monitor_cmd,
|
||||||
"log file FILENAME",
|
"log monitor",
|
||||||
"Logging control\n"
|
"Logging control\n"
|
||||||
"Logging to file\n"
|
"Set terminal line (monitor) logging level\n")
|
||||||
"Logging filename\n")
|
{
|
||||||
|
zlog_set_level (NULL, ZLOG_DEST_MONITOR, zlog_default->default_lvl);
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUN (config_log_monitor_level,
|
||||||
|
config_log_monitor_level_cmd,
|
||||||
|
"log monitor "LOG_LEVELS,
|
||||||
|
"Logging control\n"
|
||||||
|
"Set terminal line (monitor) logging level\n"
|
||||||
|
LOG_LEVEL_DESC)
|
||||||
|
{
|
||||||
|
int level;
|
||||||
|
|
||||||
|
if ((level = level_match(argv[0])) == ZLOG_DISABLED)
|
||||||
|
return CMD_ERR_NO_MATCH;
|
||||||
|
zlog_set_level (NULL, ZLOG_DEST_MONITOR, level);
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUN (no_config_log_monitor,
|
||||||
|
no_config_log_monitor_cmd,
|
||||||
|
"no log monitor [LEVEL]",
|
||||||
|
NO_STR
|
||||||
|
"Logging control\n"
|
||||||
|
"Disable terminal line (monitor) logging\n"
|
||||||
|
"Logging level\n")
|
||||||
|
{
|
||||||
|
zlog_set_level (NULL, ZLOG_DEST_MONITOR, ZLOG_DISABLED);
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
set_log_file(struct vty *vty, const char *fname, int loglevel)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
char *p = NULL;
|
char *p = NULL;
|
||||||
const char *fullpath;
|
const char *fullpath;
|
||||||
|
|
||||||
/* Path detection. */
|
/* Path detection. */
|
||||||
if (! IS_DIRECTORY_SEP (*argv[0]))
|
if (! IS_DIRECTORY_SEP (*fname))
|
||||||
{
|
{
|
||||||
char cwd[MAXPATHLEN+1];
|
char cwd[MAXPATHLEN+1];
|
||||||
cwd[MAXPATHLEN] = '\0';
|
cwd[MAXPATHLEN] = '\0';
|
||||||
@ -3003,37 +3153,62 @@ DEFUN (config_log_file,
|
|||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (p = XMALLOC (MTYPE_TMP, strlen (cwd) + strlen (argv[0]) + 2))
|
if ( (p = XMALLOC (MTYPE_TMP, strlen (cwd) + strlen (fname) + 2))
|
||||||
== NULL)
|
== NULL)
|
||||||
{
|
{
|
||||||
zlog_err ("config_log_file: Unable to alloc mem!");
|
zlog_err ("config_log_file: Unable to alloc mem!");
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
sprintf (p, "%s/%s", cwd, argv[0]);
|
sprintf (p, "%s/%s", cwd, fname);
|
||||||
fullpath = p;
|
fullpath = p;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fullpath = argv[0];
|
fullpath = fname;
|
||||||
|
|
||||||
ret = zlog_set_file (NULL, fullpath);
|
ret = zlog_set_file (NULL, fullpath, loglevel);
|
||||||
|
|
||||||
if (p)
|
if (p)
|
||||||
XFREE (MTYPE_TMP, p);
|
XFREE (MTYPE_TMP, p);
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
vty_out (vty, "can't open logfile %s\n", argv[0]);
|
vty_out (vty, "can't open logfile %s\n", fname);
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (host.logfile)
|
if (host.logfile)
|
||||||
XFREE (MTYPE_TMP, host.logfile);
|
XFREE (MTYPE_TMP, host.logfile);
|
||||||
|
|
||||||
host.logfile = XSTRDUP (MTYPE_TMP, argv[0]);
|
host.logfile = XSTRDUP (MTYPE_TMP, fname);
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFUN (config_log_file,
|
||||||
|
config_log_file_cmd,
|
||||||
|
"log file FILENAME",
|
||||||
|
"Logging control\n"
|
||||||
|
"Logging to file\n"
|
||||||
|
"Logging filename\n")
|
||||||
|
{
|
||||||
|
return set_log_file(vty, argv[0], zlog_default->default_lvl);
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUN (config_log_file_level,
|
||||||
|
config_log_file_level_cmd,
|
||||||
|
"log file FILENAME "LOG_LEVELS,
|
||||||
|
"Logging control\n"
|
||||||
|
"Logging to file\n"
|
||||||
|
"Logging filename\n"
|
||||||
|
LOG_LEVEL_DESC)
|
||||||
|
{
|
||||||
|
int level;
|
||||||
|
|
||||||
|
if ((level = level_match(argv[1])) == ZLOG_DISABLED)
|
||||||
|
return CMD_ERR_NO_MATCH;
|
||||||
|
return set_log_file(vty, argv[0], level);
|
||||||
|
}
|
||||||
|
|
||||||
DEFUN (no_config_log_file,
|
DEFUN (no_config_log_file,
|
||||||
no_config_log_file_cmd,
|
no_config_log_file_cmd,
|
||||||
"no log file [FILENAME]",
|
"no log file [FILENAME]",
|
||||||
@ -3052,154 +3227,135 @@ DEFUN (no_config_log_file,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ALIAS (no_config_log_file,
|
||||||
|
no_config_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")
|
||||||
|
|
||||||
DEFUN (config_log_syslog,
|
DEFUN (config_log_syslog,
|
||||||
config_log_syslog_cmd,
|
config_log_syslog_cmd,
|
||||||
"log syslog",
|
"log syslog",
|
||||||
"Logging control\n"
|
"Logging control\n"
|
||||||
"Logging goes to syslog\n")
|
"Set syslog logging level\n")
|
||||||
{
|
{
|
||||||
zlog_set_flag (NULL, ZLOG_SYSLOG);
|
zlog_set_level (NULL, ZLOG_DEST_SYSLOG, zlog_default->default_lvl);
|
||||||
zlog_default->facility = LOG_DAEMON;
|
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (config_log_syslog_facility,
|
DEFUN (config_log_syslog_level,
|
||||||
config_log_syslog_facility_cmd,
|
config_log_syslog_level_cmd,
|
||||||
"log syslog facility (kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7)",
|
"log syslog "LOG_LEVELS,
|
||||||
"Logging control\n"
|
"Logging control\n"
|
||||||
"Logging goes to syslog\n"
|
"Set syslog logging level\n"
|
||||||
"Facility parameter for syslog messages\n"
|
LOG_LEVEL_DESC)
|
||||||
"Kernel\n"
|
|
||||||
"User process\n"
|
|
||||||
"Mail system\n"
|
|
||||||
"System daemons\n"
|
|
||||||
"Authorization system\n"
|
|
||||||
"Syslog itself\n"
|
|
||||||
"Line printer system\n"
|
|
||||||
"USENET news\n"
|
|
||||||
"Unix-to-Unix copy system\n"
|
|
||||||
"Cron/at facility\n"
|
|
||||||
"Local use\n"
|
|
||||||
"Local use\n"
|
|
||||||
"Local use\n"
|
|
||||||
"Local use\n"
|
|
||||||
"Local use\n"
|
|
||||||
"Local use\n"
|
|
||||||
"Local use\n"
|
|
||||||
"Local use\n")
|
|
||||||
{
|
{
|
||||||
int facility = LOG_DAEMON;
|
int level;
|
||||||
|
|
||||||
zlog_set_flag (NULL, ZLOG_SYSLOG);
|
if ((level = level_match(argv[0])) == ZLOG_DISABLED)
|
||||||
|
return CMD_ERR_NO_MATCH;
|
||||||
|
zlog_set_level (NULL, ZLOG_DEST_SYSLOG, level);
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
if (strncmp (argv[0], "kern", 1) == 0)
|
DEFUN_DEPRECATED (config_log_syslog_facility,
|
||||||
facility = LOG_KERN;
|
config_log_syslog_facility_cmd,
|
||||||
else if (strncmp (argv[0], "user", 2) == 0)
|
"log syslog facility "LOG_FACILITIES,
|
||||||
facility = LOG_USER;
|
"Logging control\n"
|
||||||
else if (strncmp (argv[0], "mail", 1) == 0)
|
"Logging goes to syslog\n"
|
||||||
facility = LOG_MAIL;
|
"(Deprecated) Facility parameter for syslog messages\n"
|
||||||
else if (strncmp (argv[0], "daemon", 1) == 0)
|
LOG_FACILITY_DESC)
|
||||||
facility = LOG_DAEMON;
|
{
|
||||||
else if (strncmp (argv[0], "auth", 1) == 0)
|
int facility;
|
||||||
facility = LOG_AUTH;
|
|
||||||
else if (strncmp (argv[0], "syslog", 1) == 0)
|
|
||||||
facility = LOG_SYSLOG;
|
|
||||||
else if (strncmp (argv[0], "lpr", 2) == 0)
|
|
||||||
facility = LOG_LPR;
|
|
||||||
else if (strncmp (argv[0], "news", 1) == 0)
|
|
||||||
facility = LOG_NEWS;
|
|
||||||
else if (strncmp (argv[0], "uucp", 2) == 0)
|
|
||||||
facility = LOG_UUCP;
|
|
||||||
else if (strncmp (argv[0], "cron", 1) == 0)
|
|
||||||
facility = LOG_CRON;
|
|
||||||
else if (strncmp (argv[0], "local0", 6) == 0)
|
|
||||||
facility = LOG_LOCAL0;
|
|
||||||
else if (strncmp (argv[0], "local1", 6) == 0)
|
|
||||||
facility = LOG_LOCAL1;
|
|
||||||
else if (strncmp (argv[0], "local2", 6) == 0)
|
|
||||||
facility = LOG_LOCAL2;
|
|
||||||
else if (strncmp (argv[0], "local3", 6) == 0)
|
|
||||||
facility = LOG_LOCAL3;
|
|
||||||
else if (strncmp (argv[0], "local4", 6) == 0)
|
|
||||||
facility = LOG_LOCAL4;
|
|
||||||
else if (strncmp (argv[0], "local5", 6) == 0)
|
|
||||||
facility = LOG_LOCAL5;
|
|
||||||
else if (strncmp (argv[0], "local6", 6) == 0)
|
|
||||||
facility = LOG_LOCAL6;
|
|
||||||
else if (strncmp (argv[0], "local7", 6) == 0)
|
|
||||||
facility = LOG_LOCAL7;
|
|
||||||
|
|
||||||
|
if ((facility = facility_match(argv[0])) < 0)
|
||||||
|
return CMD_ERR_NO_MATCH;
|
||||||
|
|
||||||
|
zlog_set_level (NULL, ZLOG_DEST_SYSLOG, zlog_default->default_lvl);
|
||||||
zlog_default->facility = facility;
|
zlog_default->facility = facility;
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (no_config_log_syslog,
|
DEFUN (no_config_log_syslog,
|
||||||
no_config_log_syslog_cmd,
|
no_config_log_syslog_cmd,
|
||||||
"no log syslog",
|
"no log syslog [LEVEL]",
|
||||||
NO_STR
|
NO_STR
|
||||||
"Logging control\n"
|
"Logging control\n"
|
||||||
"Cancel logging to syslog\n")
|
"Cancel logging to syslog\n"
|
||||||
|
"Logging level\n")
|
||||||
{
|
{
|
||||||
zlog_reset_flag (NULL, ZLOG_SYSLOG);
|
zlog_set_level (NULL, ZLOG_DEST_SYSLOG, ZLOG_DISABLED);
|
||||||
zlog_default->facility = LOG_DAEMON;
|
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALIAS (no_config_log_syslog,
|
ALIAS (no_config_log_syslog,
|
||||||
no_config_log_syslog_facility_cmd,
|
no_config_log_syslog_facility_cmd,
|
||||||
"no log syslog facility (kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7)",
|
"no log syslog facility "LOG_FACILITIES,
|
||||||
NO_STR
|
NO_STR
|
||||||
"Logging control\n"
|
"Logging control\n"
|
||||||
"Logging goes to syslog\n"
|
"Logging goes to syslog\n"
|
||||||
"Facility parameter for syslog messages\n"
|
"Facility parameter for syslog messages\n"
|
||||||
"Kernel\n"
|
LOG_FACILITY_DESC)
|
||||||
"User process\n"
|
|
||||||
"Mail system\n"
|
|
||||||
"System daemons\n"
|
|
||||||
"Authorization system\n"
|
|
||||||
"Syslog itself\n"
|
|
||||||
"Line printer system\n"
|
|
||||||
"USENET news\n"
|
|
||||||
"Unix-to-Unix copy system\n"
|
|
||||||
"Cron/at facility\n"
|
|
||||||
"Local use\n"
|
|
||||||
"Local use\n"
|
|
||||||
"Local use\n"
|
|
||||||
"Local use\n"
|
|
||||||
"Local use\n"
|
|
||||||
"Local use\n"
|
|
||||||
"Local use\n"
|
|
||||||
"Local use\n")
|
|
||||||
|
|
||||||
DEFUN (config_log_trap,
|
DEFUN (config_log_facility,
|
||||||
config_log_trap_cmd,
|
config_log_facility_cmd,
|
||||||
"log trap (emergencies|alerts|critical|errors|warnings|notifications|informational|debugging)",
|
"log facility "LOG_FACILITIES,
|
||||||
"Logging control\n"
|
"Logging control\n"
|
||||||
"Limit logging to specifed level\n")
|
"Facility parameter for syslog messages\n"
|
||||||
|
LOG_FACILITY_DESC)
|
||||||
{
|
{
|
||||||
int new_level ;
|
int facility;
|
||||||
|
|
||||||
for ( new_level = 0 ; zlog_priority [new_level] != NULL ; new_level ++ )
|
if ((facility = facility_match(argv[0])) < 0)
|
||||||
{
|
return CMD_ERR_NO_MATCH;
|
||||||
if ( strcmp ( argv[0], zlog_priority [new_level] ) == 0 )
|
zlog_default->facility = facility;
|
||||||
/* found new logging level */
|
return CMD_SUCCESS;
|
||||||
{
|
|
||||||
zlog_default->maskpri = new_level;
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return CMD_ERR_NO_MATCH;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (no_config_log_trap,
|
DEFUN (no_config_log_facility,
|
||||||
no_config_log_trap_cmd,
|
no_config_log_facility_cmd,
|
||||||
"no log trap",
|
"no log facility [FACILITY]",
|
||||||
NO_STR
|
NO_STR
|
||||||
"Logging control\n"
|
"Logging control\n"
|
||||||
"Permit all logging information\n")
|
"Reset syslog facility to default (daemon)\n"
|
||||||
|
"Syslog facility\n")
|
||||||
{
|
{
|
||||||
zlog_default->maskpri = LOG_DEBUG;
|
zlog_default->facility = LOG_DAEMON;
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUN_DEPRECATED (config_log_trap,
|
||||||
|
config_log_trap_cmd,
|
||||||
|
"log trap "LOG_LEVELS,
|
||||||
|
"Logging control\n"
|
||||||
|
"(Deprecated) Set logging level and default for all destinations\n"
|
||||||
|
LOG_LEVEL_DESC)
|
||||||
|
{
|
||||||
|
int new_level ;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if ((new_level = level_match(argv[0])) == ZLOG_DISABLED)
|
||||||
|
return CMD_ERR_NO_MATCH;
|
||||||
|
|
||||||
|
zlog_default->default_lvl = new_level;
|
||||||
|
for (i = 0; i < ZLOG_NUM_DESTS; i++)
|
||||||
|
if (zlog_default->maxlvl[i] != ZLOG_DISABLED)
|
||||||
|
zlog_default->maxlvl[i] = new_level;
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUN_DEPRECATED (no_config_log_trap,
|
||||||
|
no_config_log_trap_cmd,
|
||||||
|
"no log trap [LEVEL]",
|
||||||
|
NO_STR
|
||||||
|
"Logging control\n"
|
||||||
|
"Permit all logging information\n"
|
||||||
|
"Logging level\n")
|
||||||
|
{
|
||||||
|
zlog_default->default_lvl = LOG_DEBUG;
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3304,6 +3460,7 @@ cmd_init (int terminal)
|
|||||||
install_element (VIEW_NODE, &config_enable_cmd);
|
install_element (VIEW_NODE, &config_enable_cmd);
|
||||||
install_element (VIEW_NODE, &config_terminal_length_cmd);
|
install_element (VIEW_NODE, &config_terminal_length_cmd);
|
||||||
install_element (VIEW_NODE, &config_terminal_no_length_cmd);
|
install_element (VIEW_NODE, &config_terminal_no_length_cmd);
|
||||||
|
install_element (VIEW_NODE, &show_logging_cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (terminal)
|
if (terminal)
|
||||||
@ -3320,6 +3477,8 @@ cmd_init (int terminal)
|
|||||||
{
|
{
|
||||||
install_element (ENABLE_NODE, &config_terminal_length_cmd);
|
install_element (ENABLE_NODE, &config_terminal_length_cmd);
|
||||||
install_element (ENABLE_NODE, &config_terminal_no_length_cmd);
|
install_element (ENABLE_NODE, &config_terminal_no_length_cmd);
|
||||||
|
install_element (ENABLE_NODE, &show_logging_cmd);
|
||||||
|
install_element (ENABLE_NODE, &config_logmsg_cmd);
|
||||||
|
|
||||||
install_default (CONFIG_NODE);
|
install_default (CONFIG_NODE);
|
||||||
}
|
}
|
||||||
@ -3336,13 +3495,22 @@ cmd_init (int terminal)
|
|||||||
install_element (CONFIG_NODE, &no_enable_password_cmd);
|
install_element (CONFIG_NODE, &no_enable_password_cmd);
|
||||||
|
|
||||||
install_element (CONFIG_NODE, &config_log_stdout_cmd);
|
install_element (CONFIG_NODE, &config_log_stdout_cmd);
|
||||||
|
install_element (CONFIG_NODE, &config_log_stdout_level_cmd);
|
||||||
install_element (CONFIG_NODE, &no_config_log_stdout_cmd);
|
install_element (CONFIG_NODE, &no_config_log_stdout_cmd);
|
||||||
|
install_element (CONFIG_NODE, &config_log_monitor_cmd);
|
||||||
|
install_element (CONFIG_NODE, &config_log_monitor_level_cmd);
|
||||||
|
install_element (CONFIG_NODE, &no_config_log_monitor_cmd);
|
||||||
install_element (CONFIG_NODE, &config_log_file_cmd);
|
install_element (CONFIG_NODE, &config_log_file_cmd);
|
||||||
|
install_element (CONFIG_NODE, &config_log_file_level_cmd);
|
||||||
install_element (CONFIG_NODE, &no_config_log_file_cmd);
|
install_element (CONFIG_NODE, &no_config_log_file_cmd);
|
||||||
|
install_element (CONFIG_NODE, &no_config_log_file_level_cmd);
|
||||||
install_element (CONFIG_NODE, &config_log_syslog_cmd);
|
install_element (CONFIG_NODE, &config_log_syslog_cmd);
|
||||||
|
install_element (CONFIG_NODE, &config_log_syslog_level_cmd);
|
||||||
install_element (CONFIG_NODE, &config_log_syslog_facility_cmd);
|
install_element (CONFIG_NODE, &config_log_syslog_facility_cmd);
|
||||||
install_element (CONFIG_NODE, &no_config_log_syslog_cmd);
|
install_element (CONFIG_NODE, &no_config_log_syslog_cmd);
|
||||||
install_element (CONFIG_NODE, &no_config_log_syslog_facility_cmd);
|
install_element (CONFIG_NODE, &no_config_log_syslog_facility_cmd);
|
||||||
|
install_element (CONFIG_NODE, &config_log_facility_cmd);
|
||||||
|
install_element (CONFIG_NODE, &no_config_log_facility_cmd);
|
||||||
install_element (CONFIG_NODE, &config_log_trap_cmd);
|
install_element (CONFIG_NODE, &config_log_trap_cmd);
|
||||||
install_element (CONFIG_NODE, &no_config_log_trap_cmd);
|
install_element (CONFIG_NODE, &no_config_log_trap_cmd);
|
||||||
install_element (CONFIG_NODE, &config_log_record_priority_cmd);
|
install_element (CONFIG_NODE, &config_log_record_priority_cmd);
|
||||||
|
@ -177,10 +177,10 @@ struct desc
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define DEFUN_CMD_FUNC_DECL(funcname) \
|
#define DEFUN_CMD_FUNC_DECL(funcname) \
|
||||||
int funcname (struct cmd_element *, struct vty *, int, const char *[]); \
|
static int funcname (struct cmd_element *, struct vty *, int, const char *[]); \
|
||||||
|
|
||||||
#define DEFUN_CMD_FUNC_TEXT(funcname) \
|
#define DEFUN_CMD_FUNC_TEXT(funcname) \
|
||||||
int funcname \
|
static int funcname \
|
||||||
(struct cmd_element *self, struct vty *vty, int argc, const char *argv[])
|
(struct cmd_element *self, struct vty *vty, int argc, const char *argv[])
|
||||||
|
|
||||||
/* DEFUN for vty command interafce. Little bit hacky ;-). */
|
/* DEFUN for vty command interafce. Little bit hacky ;-). */
|
||||||
@ -214,12 +214,24 @@ struct desc
|
|||||||
DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, daemon) \
|
DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, daemon) \
|
||||||
DEFUN_CMD_FUNC_TEXT(funcname)
|
DEFUN_CMD_FUNC_TEXT(funcname)
|
||||||
|
|
||||||
|
/* DEFUN + DEFSH with attributes */
|
||||||
|
#define DEFUNSH_ATTR(daemon, funcname, cmdname, cmdstr, helpstr, attr) \
|
||||||
|
DEFUN_CMD_FUNC_DECL(funcname) \
|
||||||
|
DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attr, daemon) \
|
||||||
|
DEFUN_CMD_FUNC_TEXT(funcname)
|
||||||
|
|
||||||
|
#define DEFUNSH_HIDDEN(daemon, funcname, cmdname, cmdstr, helpstr) \
|
||||||
|
DEFUNSH_ATTR (daemon, funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN)
|
||||||
|
|
||||||
|
#define DEFUNSH_DEPRECATED(daemon, funcname, cmdname, cmdstr, helpstr) \
|
||||||
|
DEFUNSH_ATTR (daemon, funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED)
|
||||||
|
|
||||||
/* ALIAS macro which define existing command's alias. */
|
/* ALIAS macro which define existing command's alias. */
|
||||||
#define ALIAS(funcname, cmdname, cmdstr, helpstr) \
|
#define ALIAS(funcname, cmdname, cmdstr, helpstr) \
|
||||||
DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, 0)
|
DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, 0)
|
||||||
|
|
||||||
#define ALIAS_ATTR(funcname, cmdname, cmdstr, helpstr, attr) \
|
#define ALIAS_ATTR(funcname, cmdname, cmdstr, helpstr, attr) \
|
||||||
DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attr, daemon) \
|
DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attr, 0)
|
||||||
|
|
||||||
#define ALIAS_HIDDEN(funcname, cmdname, cmdstr, helpstr) \
|
#define ALIAS_HIDDEN(funcname, cmdname, cmdstr, helpstr) \
|
||||||
DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN, 0)
|
DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN, 0)
|
||||||
@ -227,6 +239,15 @@ struct desc
|
|||||||
#define ALIAS_DEPRECATED(funcname, cmdname, cmdstr, helpstr) \
|
#define ALIAS_DEPRECATED(funcname, cmdname, cmdstr, helpstr) \
|
||||||
DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED, 0)
|
DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED, 0)
|
||||||
|
|
||||||
|
#define ALIAS_SH(daemon, funcname, cmdname, cmdstr, helpstr) \
|
||||||
|
DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, daemon)
|
||||||
|
|
||||||
|
#define ALIAS_SH_HIDDEN(daemon, funcname, cmdname, cmdstr, helpstr) \
|
||||||
|
DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN, daemon)
|
||||||
|
|
||||||
|
#define ALIAS_SH_DEPRECATED(daemon, funcname, cmdname, cmdstr, helpstr) \
|
||||||
|
DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED, daemon)
|
||||||
|
|
||||||
#endif /* VTYSH_EXTRACT_PL */
|
#endif /* VTYSH_EXTRACT_PL */
|
||||||
|
|
||||||
/* Some macroes */
|
/* Some macroes */
|
||||||
@ -319,8 +340,6 @@ extern struct cmd_element config_exit_cmd;
|
|||||||
extern struct cmd_element config_quit_cmd;
|
extern struct cmd_element config_quit_cmd;
|
||||||
extern struct cmd_element config_help_cmd;
|
extern struct cmd_element config_help_cmd;
|
||||||
extern struct cmd_element config_list_cmd;
|
extern struct cmd_element config_list_cmd;
|
||||||
int config_exit (struct cmd_element *, struct vty *, int, const char *[]);
|
|
||||||
int config_help (struct cmd_element *, struct vty *, int, const char *[]);
|
|
||||||
char *host_config_file ();
|
char *host_config_file ();
|
||||||
void host_config_set (char *);
|
void host_config_set (char *);
|
||||||
|
|
||||||
|
167
lib/log.c
167
lib/log.c
@ -1,4 +1,7 @@
|
|||||||
/* Logging of zebra
|
/*
|
||||||
|
* $Id: log.c,v 1.17 2004/12/07 15:39:32 ajs Exp $
|
||||||
|
*
|
||||||
|
* Logging of zebra
|
||||||
* Copyright (C) 1997, 1998, 1999 Kunihiro Ishiguro
|
* Copyright (C) 1997, 1998, 1999 Kunihiro Ishiguro
|
||||||
*
|
*
|
||||||
* This file is part of GNU Zebra.
|
* This file is part of GNU Zebra.
|
||||||
@ -104,12 +107,8 @@ vzlog (struct zlog *zl, int priority, const char *format, va_list args)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* only log this information if it has not been masked out */
|
|
||||||
if ( priority > zl->maskpri )
|
|
||||||
return ;
|
|
||||||
|
|
||||||
/* Syslog output */
|
/* Syslog output */
|
||||||
if (zl->flags & ZLOG_SYSLOG)
|
if (priority <= zl->maxlvl[ZLOG_DEST_SYSLOG])
|
||||||
{
|
{
|
||||||
va_list ac;
|
va_list ac;
|
||||||
va_copy(ac, args);
|
va_copy(ac, args);
|
||||||
@ -118,7 +117,7 @@ vzlog (struct zlog *zl, int priority, const char *format, va_list args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* File output. */
|
/* File output. */
|
||||||
if (zl->flags & ZLOG_FILE)
|
if ((priority <= zl->maxlvl[ZLOG_DEST_FILE]) && zl->fp)
|
||||||
{
|
{
|
||||||
va_list ac;
|
va_list ac;
|
||||||
time_print (zl->fp);
|
time_print (zl->fp);
|
||||||
@ -133,7 +132,7 @@ vzlog (struct zlog *zl, int priority, const char *format, va_list args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* stdout output. */
|
/* stdout output. */
|
||||||
if (zl->flags & ZLOG_STDOUT)
|
if (priority <= zl->maxlvl[ZLOG_DEST_STDOUT])
|
||||||
{
|
{
|
||||||
va_list ac;
|
va_list ac;
|
||||||
time_print (stdout);
|
time_print (stdout);
|
||||||
@ -147,23 +146,10 @@ vzlog (struct zlog *zl, int priority, const char *format, va_list args)
|
|||||||
fflush (stdout);
|
fflush (stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* stderr output. */
|
|
||||||
if (zl->flags & ZLOG_STDERR)
|
|
||||||
{
|
|
||||||
va_list ac;
|
|
||||||
time_print (stderr);
|
|
||||||
if (zl->record_priority)
|
|
||||||
fprintf (stderr, "%s: ", zlog_priority[priority]);
|
|
||||||
fprintf (stderr, "%s: ", zlog_proto_names[zl->protocol]);
|
|
||||||
va_copy(ac, args);
|
|
||||||
vfprintf (stderr, format, ac);
|
|
||||||
va_end(ac);
|
|
||||||
fprintf (stderr, "\n");
|
|
||||||
fflush (stderr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Terminal monitor. */
|
/* Terminal monitor. */
|
||||||
vty_log (zlog_proto_names[zl->protocol], format, args);
|
if (priority <= zl->maxlvl[ZLOG_DEST_MONITOR])
|
||||||
|
vty_log ((zl->record_priority ? zlog_priority[priority] : NULL),
|
||||||
|
zlog_proto_names[zl->protocol], format, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
@ -297,26 +283,29 @@ zlog_signal(int signo, const char *action)
|
|||||||
if (s < buf+sizeof(buf))
|
if (s < buf+sizeof(buf))
|
||||||
*s++ = '\n';
|
*s++ = '\n';
|
||||||
|
|
||||||
|
/* N.B. implicit priority is most severe */
|
||||||
|
#define PRI LOG_EMERG
|
||||||
|
|
||||||
#define DUMP(FP) write(fileno(FP),buf,s-buf);
|
#define DUMP(FP) write(fileno(FP),buf,s-buf);
|
||||||
if (!zlog_default)
|
if (!zlog_default)
|
||||||
DUMP(stderr)
|
DUMP(stderr)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((zlog_default->flags & ZLOG_FILE) && zlog_default->fp)
|
if ((PRI <= zlog_default->maxlvl[ZLOG_DEST_FILE]) && zlog_default->fp)
|
||||||
DUMP(zlog_default->fp)
|
DUMP(zlog_default->fp)
|
||||||
if (zlog_default->flags & ZLOG_STDOUT)
|
if (PRI <= zlog_default->maxlvl[ZLOG_DEST_STDOUT])
|
||||||
DUMP(stdout)
|
DUMP(stdout)
|
||||||
if (zlog_default->flags & ZLOG_STDERR)
|
/* Remove trailing '\n' for monitor and syslog */
|
||||||
DUMP(stderr)
|
*--s = '\0';
|
||||||
if (zlog_default->flags & ZLOG_SYSLOG)
|
if (PRI <= zlog_default->maxlvl[ZLOG_DEST_MONITOR])
|
||||||
{
|
vty_log_fixed(buf,s-buf);
|
||||||
*--s = '\0';
|
if (PRI <= zlog_default->maxlvl[ZLOG_DEST_SYSLOG])
|
||||||
syslog_sigsafe(LOG_ERR|zlog_default->facility,msgstart,s-msgstart);
|
syslog_sigsafe(PRI|zlog_default->facility,msgstart,s-msgstart);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#undef DUMP
|
#undef DUMP
|
||||||
|
|
||||||
zlog_backtrace_sigsafe(LOG_ERR);
|
zlog_backtrace_sigsafe(PRI);
|
||||||
|
#undef PRI
|
||||||
#undef LOC
|
#undef LOC
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,10 +321,6 @@ zlog_backtrace_sigsafe(int priority)
|
|||||||
char *s;
|
char *s;
|
||||||
#define LOC s,buf+sizeof(buf)-s
|
#define LOC s,buf+sizeof(buf)-s
|
||||||
|
|
||||||
/* only log this information if it has not been masked out */
|
|
||||||
if (zlog_default && (priority > zlog_default->maskpri))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (((size = backtrace(array,sizeof(array)/sizeof(array[0]))) <= 0) ||
|
if (((size = backtrace(array,sizeof(array)/sizeof(array[0]))) <= 0) ||
|
||||||
((size_t)size > sizeof(array)/sizeof(array[0])))
|
((size_t)size > sizeof(array)/sizeof(array[0])))
|
||||||
return;
|
return;
|
||||||
@ -353,29 +338,34 @@ zlog_backtrace_sigsafe(int priority)
|
|||||||
DUMP(stderr)
|
DUMP(stderr)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((zlog_default->flags & ZLOG_FILE) && zlog_default->fp)
|
if ((priority <= zlog_default->maxlvl[ZLOG_DEST_FILE]) &&
|
||||||
|
zlog_default->fp)
|
||||||
DUMP(zlog_default->fp)
|
DUMP(zlog_default->fp)
|
||||||
if (zlog_default->flags & ZLOG_STDOUT)
|
if (priority <= zlog_default->maxlvl[ZLOG_DEST_STDOUT])
|
||||||
DUMP(stdout)
|
DUMP(stdout)
|
||||||
if (zlog_default->flags & ZLOG_STDERR)
|
/* Remove trailing '\n' for monitor and syslog */
|
||||||
DUMP(stderr)
|
*--s = '\0';
|
||||||
if (zlog_default->flags & ZLOG_SYSLOG)
|
if (priority <= zlog_default->maxlvl[ZLOG_DEST_MONITOR])
|
||||||
{
|
vty_log_fixed(buf,s-buf);
|
||||||
int i;
|
if (priority <= zlog_default->maxlvl[ZLOG_DEST_SYSLOG])
|
||||||
*--s = '\0';
|
syslog_sigsafe(priority|zlog_default->facility,buf,s-buf);
|
||||||
syslog_sigsafe(priority|zlog_default->facility,buf,s-buf);
|
{
|
||||||
/* Just print the function addresses. */
|
int i;
|
||||||
for (i = 0; i < size; i++)
|
/* Just print the function addresses. */
|
||||||
{
|
for (i = 0; i < size; i++)
|
||||||
s = buf;
|
{
|
||||||
s = str_append(LOC,"[bt ");
|
s = buf;
|
||||||
s = num_append(LOC,i);
|
s = str_append(LOC,"[bt ");
|
||||||
s = str_append(LOC,"] 0x");
|
s = num_append(LOC,i);
|
||||||
s = hex_append(LOC,(u_long)(array[i]));
|
s = str_append(LOC,"] 0x");
|
||||||
*s = '\0';
|
s = hex_append(LOC,(u_long)(array[i]));
|
||||||
|
*s = '\0';
|
||||||
|
if (priority <= zlog_default->maxlvl[ZLOG_DEST_MONITOR])
|
||||||
|
vty_log_fixed(buf,s-buf);
|
||||||
|
if (priority <= zlog_default->maxlvl[ZLOG_DEST_SYSLOG])
|
||||||
syslog_sigsafe(priority|zlog_default->facility,buf,s-buf);
|
syslog_sigsafe(priority|zlog_default->facility,buf,s-buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#undef DUMP
|
#undef DUMP
|
||||||
#undef LOC
|
#undef LOC
|
||||||
@ -476,29 +466,32 @@ _zlog_assert_failed (const char *assertion, const char *file,
|
|||||||
{
|
{
|
||||||
zlog_err("Assertion `%s' failed in file %s, line %u, function %s",
|
zlog_err("Assertion `%s' failed in file %s, line %u, function %s",
|
||||||
assertion,file,line,(function ? function : "?"));
|
assertion,file,line,(function ? function : "?"));
|
||||||
zlog_backtrace(LOG_ERR);
|
zlog_backtrace(LOG_EMERG);
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Open log stream */
|
/* Open log stream */
|
||||||
struct zlog *
|
struct zlog *
|
||||||
openzlog (const char *progname, int flags, zlog_proto_t protocol,
|
openzlog (const char *progname, zlog_proto_t protocol,
|
||||||
int syslog_flags, int syslog_facility)
|
int syslog_flags, int syslog_facility)
|
||||||
{
|
{
|
||||||
struct zlog *zl;
|
struct zlog *zl;
|
||||||
|
u_int i;
|
||||||
|
|
||||||
zl = XMALLOC(MTYPE_ZLOG, sizeof (struct zlog));
|
zl = XCALLOC(MTYPE_ZLOG, sizeof (struct zlog));
|
||||||
memset (zl, 0, sizeof (struct zlog));
|
|
||||||
|
|
||||||
zl->ident = progname;
|
zl->ident = progname;
|
||||||
zl->flags = flags;
|
|
||||||
zl->protocol = protocol;
|
zl->protocol = protocol;
|
||||||
zl->facility = syslog_facility;
|
zl->facility = syslog_facility;
|
||||||
zl->maskpri = LOG_DEBUG;
|
|
||||||
zl->record_priority = 0;
|
|
||||||
zl->syslog_options = syslog_flags;
|
zl->syslog_options = syslog_flags;
|
||||||
|
|
||||||
|
/* Set default logging levels. */
|
||||||
|
for (i = 0; i < sizeof(zl->maxlvl)/sizeof(zl->maxlvl[0]); i++)
|
||||||
|
zl->maxlvl[i] = ZLOG_DISABLED;
|
||||||
|
zl->maxlvl[ZLOG_DEST_MONITOR] = LOG_DEBUG;
|
||||||
|
zl->default_lvl = LOG_DEBUG;
|
||||||
|
|
||||||
openlog (progname, syslog_flags, zl->facility);
|
openlog (progname, syslog_flags, zl->facility);
|
||||||
|
|
||||||
return zl;
|
return zl;
|
||||||
@ -515,25 +508,16 @@ closezlog (struct zlog *zl)
|
|||||||
|
|
||||||
/* Called from command.c. */
|
/* Called from command.c. */
|
||||||
void
|
void
|
||||||
zlog_set_flag (struct zlog *zl, int flags)
|
zlog_set_level (struct zlog *zl, zlog_dest_t dest, int log_level)
|
||||||
{
|
{
|
||||||
if (zl == NULL)
|
if (zl == NULL)
|
||||||
zl = zlog_default;
|
zl = zlog_default;
|
||||||
|
|
||||||
zl->flags |= flags;
|
zl->maxlvl[dest] = log_level;
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
zlog_reset_flag (struct zlog *zl, int flags)
|
|
||||||
{
|
|
||||||
if (zl == NULL)
|
|
||||||
zl = zlog_default;
|
|
||||||
|
|
||||||
zl->flags &= ~flags;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
zlog_set_file (struct zlog *zl, const char *filename)
|
zlog_set_file (struct zlog *zl, const char *filename, int log_level)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
mode_t oldumask;
|
mode_t oldumask;
|
||||||
@ -548,16 +532,13 @@ zlog_set_file (struct zlog *zl, const char *filename)
|
|||||||
/* Open file. */
|
/* Open file. */
|
||||||
oldumask = umask (0777 & ~LOGFILE_MASK);
|
oldumask = umask (0777 & ~LOGFILE_MASK);
|
||||||
fp = fopen (filename, "a");
|
fp = fopen (filename, "a");
|
||||||
if (fp == NULL)
|
|
||||||
{
|
|
||||||
umask(oldumask);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
umask(oldumask);
|
umask(oldumask);
|
||||||
|
if (fp == NULL)
|
||||||
|
return 0;
|
||||||
|
|
||||||
/* Set flags. */
|
/* Set flags. */
|
||||||
zl->filename = strdup (filename);
|
zl->filename = strdup (filename);
|
||||||
zl->flags |= ZLOG_FILE;
|
zl->maxlvl[ZLOG_DEST_FILE] = log_level;
|
||||||
zl->fp = fp;
|
zl->fp = fp;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -570,11 +551,10 @@ zlog_reset_file (struct zlog *zl)
|
|||||||
if (zl == NULL)
|
if (zl == NULL)
|
||||||
zl = zlog_default;
|
zl = zlog_default;
|
||||||
|
|
||||||
zl->flags &= ~ZLOG_FILE;
|
|
||||||
|
|
||||||
if (zl->fp)
|
if (zl->fp)
|
||||||
fclose (zl->fp);
|
fclose (zl->fp);
|
||||||
zl->fp = NULL;
|
zl->fp = NULL;
|
||||||
|
zl->maxlvl[ZLOG_DEST_FILE] = ZLOG_DISABLED;
|
||||||
|
|
||||||
if (zl->filename)
|
if (zl->filename)
|
||||||
free (zl->filename);
|
free (zl->filename);
|
||||||
@ -587,7 +567,7 @@ zlog_reset_file (struct zlog *zl)
|
|||||||
int
|
int
|
||||||
zlog_rotate (struct zlog *zl)
|
zlog_rotate (struct zlog *zl)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
int level;
|
||||||
|
|
||||||
if (zl == NULL)
|
if (zl == NULL)
|
||||||
zl = zlog_default;
|
zl = zlog_default;
|
||||||
@ -595,20 +575,25 @@ zlog_rotate (struct zlog *zl)
|
|||||||
if (zl->fp)
|
if (zl->fp)
|
||||||
fclose (zl->fp);
|
fclose (zl->fp);
|
||||||
zl->fp = NULL;
|
zl->fp = NULL;
|
||||||
|
level = zl->maxlvl[ZLOG_DEST_FILE];
|
||||||
|
zl->maxlvl[ZLOG_DEST_FILE] = ZLOG_DISABLED;
|
||||||
|
|
||||||
if (zl->filename)
|
if (zl->filename)
|
||||||
{
|
{
|
||||||
mode_t oldumask;
|
mode_t oldumask;
|
||||||
|
int save_errno;
|
||||||
|
|
||||||
oldumask = umask (0777 & ~LOGFILE_MASK);
|
oldumask = umask (0777 & ~LOGFILE_MASK);
|
||||||
fp = fopen (zl->filename, "a");
|
zl->fp = fopen (zl->filename, "a");
|
||||||
if (fp == NULL)
|
save_errno = errno;
|
||||||
|
umask(oldumask);
|
||||||
|
if (zl->fp == NULL)
|
||||||
{
|
{
|
||||||
umask(oldumask);
|
zlog_err("Log rotate failed: cannot open file %s for append: %s",
|
||||||
|
zl->filename, safe_strerror(save_errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
umask(oldumask);
|
zl->maxlvl[ZLOG_DEST_FILE] = level;
|
||||||
zl->fp = fp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
82
lib/log.h
82
lib/log.h
@ -1,4 +1,7 @@
|
|||||||
/* Zebra logging funcions.
|
/*
|
||||||
|
* $Id: log.h,v 1.14 2004/12/07 15:39:32 ajs Exp $
|
||||||
|
*
|
||||||
|
* Zebra logging funcions.
|
||||||
* Copyright (C) 1997, 1998, 1999 Kunihiro Ishiguro
|
* Copyright (C) 1997, 1998, 1999 Kunihiro Ishiguro
|
||||||
*
|
*
|
||||||
* This file is part of GNU Zebra.
|
* This file is part of GNU Zebra.
|
||||||
@ -40,12 +43,6 @@
|
|||||||
* please use LOG_ERR instead.
|
* please use LOG_ERR instead.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define ZLOG_NOLOG 0x00
|
|
||||||
#define ZLOG_FILE 0x01
|
|
||||||
#define ZLOG_SYSLOG 0x02
|
|
||||||
#define ZLOG_STDOUT 0x04
|
|
||||||
#define ZLOG_STDERR 0x08
|
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
ZLOG_NONE,
|
ZLOG_NONE,
|
||||||
@ -60,14 +57,28 @@ typedef enum
|
|||||||
ZLOG_MASC
|
ZLOG_MASC
|
||||||
} zlog_proto_t;
|
} zlog_proto_t;
|
||||||
|
|
||||||
|
/* If maxlvl is set to ZLOG_DISABLED, then no messages will be sent
|
||||||
|
to that logging destination. */
|
||||||
|
#define ZLOG_DISABLED (LOG_EMERG-1)
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
ZLOG_DEST_SYSLOG = 0,
|
||||||
|
ZLOG_DEST_STDOUT,
|
||||||
|
ZLOG_DEST_MONITOR,
|
||||||
|
ZLOG_DEST_FILE
|
||||||
|
} zlog_dest_t;
|
||||||
|
#define ZLOG_NUM_DESTS (ZLOG_DEST_FILE+1)
|
||||||
|
|
||||||
struct zlog
|
struct zlog
|
||||||
{
|
{
|
||||||
const char *ident; /* daemon name (first arg to openlog) */
|
const char *ident; /* daemon name (first arg to openlog) */
|
||||||
zlog_proto_t protocol;
|
zlog_proto_t protocol;
|
||||||
int flags; /* mask indicating which destinations to log to */
|
int maxlvl[ZLOG_NUM_DESTS]; /* maximum priority to send to associated
|
||||||
|
logging destination */
|
||||||
|
int default_lvl; /* maxlvl to use if none is specified */
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char *filename;
|
char *filename;
|
||||||
int maskpri; /* discard messages with priority > maskpri */
|
|
||||||
int facility; /* as per syslog facility */
|
int facility; /* as per syslog facility */
|
||||||
int record_priority; /* should messages logged through stdio include the
|
int record_priority; /* should messages logged through stdio include the
|
||||||
priority of the message? */
|
priority of the message? */
|
||||||
@ -85,7 +96,8 @@ struct message
|
|||||||
extern struct zlog *zlog_default;
|
extern struct zlog *zlog_default;
|
||||||
|
|
||||||
/* Open zlog function */
|
/* Open zlog function */
|
||||||
struct zlog *openzlog (const char *, int, zlog_proto_t, int, int);
|
struct zlog *openzlog (const char *progname, zlog_proto_t protocol,
|
||||||
|
int syslog_options, int syslog_facility);
|
||||||
|
|
||||||
/* Close zlog function. */
|
/* Close zlog function. */
|
||||||
void closezlog (struct zlog *zl);
|
void closezlog (struct zlog *zl);
|
||||||
@ -114,12 +126,15 @@ void plog_info (struct zlog *, const char *format, ...);
|
|||||||
void plog_notice (struct zlog *, const char *format, ...);
|
void plog_notice (struct zlog *, const char *format, ...);
|
||||||
void plog_debug (struct zlog *, const char *format, ...);
|
void plog_debug (struct zlog *, const char *format, ...);
|
||||||
|
|
||||||
/* Set zlog flags. */
|
/* Set logging level for the given destination. If the log_level
|
||||||
void zlog_set_flag (struct zlog *zl, int flags);
|
argument is ZLOG_DISABLED, then the destination is disabled.
|
||||||
void zlog_reset_flag (struct zlog *zl, int flags);
|
This function should not be used for file logging (use zlog_set_file
|
||||||
|
or zlog_reset_file instead). */
|
||||||
|
void zlog_set_level (struct zlog *zl, zlog_dest_t, int log_level);
|
||||||
|
|
||||||
/* Set zlog filename. */
|
/* Set logging to the given filename at the specified level. */
|
||||||
int zlog_set_file (struct zlog *zl, const char *filename);
|
int zlog_set_file (struct zlog *zl, const char *filename, int log_level);
|
||||||
|
/* Disable file logging. */
|
||||||
int zlog_reset_file (struct zlog *zl);
|
int zlog_reset_file (struct zlog *zl);
|
||||||
|
|
||||||
/* Rotate log. */
|
/* Rotate log. */
|
||||||
@ -132,6 +147,7 @@ const char *lookup (struct message *, int);
|
|||||||
const char *mes_lookup (struct message *meslist, int max, int index);
|
const char *mes_lookup (struct message *meslist, int max, int index);
|
||||||
|
|
||||||
extern const char *zlog_priority[];
|
extern const char *zlog_priority[];
|
||||||
|
extern const char *zlog_proto_names[];
|
||||||
|
|
||||||
/* Safe version of strerror -- never returns NULL. */
|
/* Safe version of strerror -- never returns NULL. */
|
||||||
extern const char *safe_strerror(int errnum);
|
extern const char *safe_strerror(int errnum);
|
||||||
@ -147,4 +163,40 @@ extern void zlog_backtrace(int priority);
|
|||||||
up the state of zlog file pointers. */
|
up the state of zlog file pointers. */
|
||||||
extern void zlog_backtrace_sigsafe(int priority);
|
extern void zlog_backtrace_sigsafe(int priority);
|
||||||
|
|
||||||
|
/* Defines for use in command construction: */
|
||||||
|
|
||||||
|
#define LOG_LEVELS "(emergencies|alerts|critical|errors|warnings|notifications|informational|debugging)"
|
||||||
|
|
||||||
|
#define LOG_LEVEL_DESC \
|
||||||
|
"System is unusable\n" \
|
||||||
|
"Immediate action needed\n" \
|
||||||
|
"Critical conditions\n" \
|
||||||
|
"Error conditions\n" \
|
||||||
|
"Warning conditions\n" \
|
||||||
|
"Normal but significant conditions\n" \
|
||||||
|
"Informational messages\n" \
|
||||||
|
"Debugging messages\n"
|
||||||
|
|
||||||
|
#define LOG_FACILITIES "(kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7)"
|
||||||
|
|
||||||
|
#define LOG_FACILITY_DESC \
|
||||||
|
"Kernel\n" \
|
||||||
|
"User process\n" \
|
||||||
|
"Mail system\n" \
|
||||||
|
"System daemons\n" \
|
||||||
|
"Authorization system\n" \
|
||||||
|
"Syslog itself\n" \
|
||||||
|
"Line printer system\n" \
|
||||||
|
"USENET news\n" \
|
||||||
|
"Unix-to-Unix copy system\n" \
|
||||||
|
"Cron/at facility\n" \
|
||||||
|
"Local use\n" \
|
||||||
|
"Local use\n" \
|
||||||
|
"Local use\n" \
|
||||||
|
"Local use\n" \
|
||||||
|
"Local use\n" \
|
||||||
|
"Local use\n" \
|
||||||
|
"Local use\n" \
|
||||||
|
"Local use\n"
|
||||||
|
|
||||||
#endif /* _ZEBRA_LOG_H */
|
#endif /* _ZEBRA_LOG_H */
|
||||||
|
36
lib/vty.c
36
lib/vty.c
@ -148,14 +148,17 @@ vty_out (struct vty *vty, const char *format, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
vty_log_out (struct vty *vty, const char *proto_str, const char *format,
|
vty_log_out (struct vty *vty, const char *level, const char *proto_str,
|
||||||
va_list va)
|
const char *format, va_list va)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
snprintf (buf, sizeof buf, "%s: ", proto_str);
|
if (level)
|
||||||
write (vty->fd, buf, strlen (proto_str) + 2);
|
snprintf (buf, sizeof buf, "%s: %s: ", level, proto_str);
|
||||||
|
else
|
||||||
|
snprintf (buf, sizeof buf, "%s: ", proto_str);
|
||||||
|
write (vty->fd, buf, strlen (buf));
|
||||||
|
|
||||||
len = vsnprintf (buf, sizeof buf, format, va);
|
len = vsnprintf (buf, sizeof buf, format, va);
|
||||||
if (len < 0)
|
if (len < 0)
|
||||||
@ -602,7 +605,7 @@ static void
|
|||||||
vty_down_level (struct vty *vty)
|
vty_down_level (struct vty *vty)
|
||||||
{
|
{
|
||||||
vty_out (vty, "%s", VTY_NEWLINE);
|
vty_out (vty, "%s", VTY_NEWLINE);
|
||||||
config_exit (NULL, vty, 0, NULL);
|
(*config_exit_cmd.func)(NULL, vty, 0, NULL);
|
||||||
vty_prompt (vty);
|
vty_prompt (vty);
|
||||||
vty->cp = 0;
|
vty->cp = 0;
|
||||||
}
|
}
|
||||||
@ -2273,7 +2276,8 @@ vty_read_config (char *config_file,
|
|||||||
|
|
||||||
/* Small utility function which output log to the VTY. */
|
/* Small utility function which output log to the VTY. */
|
||||||
void
|
void
|
||||||
vty_log (const char *proto_str, const char *format, va_list va)
|
vty_log (const char *level, const char *proto_str,
|
||||||
|
const char *format, va_list va)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
struct vty *vty;
|
struct vty *vty;
|
||||||
@ -2284,11 +2288,29 @@ vty_log (const char *proto_str, const char *format, va_list va)
|
|||||||
{
|
{
|
||||||
va_list ac;
|
va_list ac;
|
||||||
va_copy(ac, va);
|
va_copy(ac, va);
|
||||||
vty_log_out (vty, proto_str, format, ac);
|
vty_log_out (vty, level, proto_str, format, ac);
|
||||||
va_end(ac);
|
va_end(ac);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Async-signal-safe version of vty_log for fixed strings. */
|
||||||
|
void
|
||||||
|
vty_log_fixed (const char *buf, size_t len)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
for (i = 0; i < vector_max (vtyvec); i++)
|
||||||
|
{
|
||||||
|
struct vty *vty;
|
||||||
|
if ((vty = vector_slot (vtyvec, i)) != NULL)
|
||||||
|
if (vty->monitor)
|
||||||
|
{
|
||||||
|
write(vty->fd, buf, len);
|
||||||
|
write(vty->fd, "\r\n", 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
vty_config_lock (struct vty *vty)
|
vty_config_lock (struct vty *vty)
|
||||||
{
|
{
|
||||||
|
@ -180,11 +180,15 @@ void vty_time_print (struct vty *, int);
|
|||||||
void vty_serv_sock (const char *, unsigned short, const char *);
|
void vty_serv_sock (const char *, unsigned short, const char *);
|
||||||
void vty_close (struct vty *);
|
void vty_close (struct vty *);
|
||||||
char *vty_get_cwd (void);
|
char *vty_get_cwd (void);
|
||||||
void vty_log (const char *, const char *, va_list);
|
void vty_log (const char *level, const char *proto, const char *fmt, va_list);
|
||||||
int vty_config_lock (struct vty *);
|
int vty_config_lock (struct vty *);
|
||||||
int vty_config_unlock (struct vty *);
|
int vty_config_unlock (struct vty *);
|
||||||
int vty_shell (struct vty *);
|
int vty_shell (struct vty *);
|
||||||
int vty_shell_serv (struct vty *);
|
int vty_shell_serv (struct vty *);
|
||||||
void vty_hello (struct vty *);
|
void vty_hello (struct vty *);
|
||||||
|
|
||||||
|
/* Send a fixed-size message to all vty terminal monitors; this should be
|
||||||
|
an async-signal-safe function. */
|
||||||
|
extern void vty_log_fixed (const char *buf, size_t len);
|
||||||
|
|
||||||
#endif /* _ZEBRA_VTY_H */
|
#endif /* _ZEBRA_VTY_H */
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2004-12-03 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
2004-12-03 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
||||||
|
|
||||||
* ospf6_main.c: (sigint,sigterm) Use zlog_notice for termination
|
* ospf6_main.c: (sigint,sigterm) Use zlog_notice for termination
|
||||||
|
@ -184,7 +184,6 @@ main (int argc, char *argv[], char *envp[])
|
|||||||
int vty_port = 0;
|
int vty_port = 0;
|
||||||
char *config_file = NULL;
|
char *config_file = NULL;
|
||||||
struct thread thread;
|
struct thread thread;
|
||||||
int flag;
|
|
||||||
|
|
||||||
/* Set umask before anything for security */
|
/* Set umask before anything for security */
|
||||||
umask (0027);
|
umask (0027);
|
||||||
@ -250,12 +249,7 @@ main (int argc, char *argv[], char *envp[])
|
|||||||
master = thread_master_create ();
|
master = thread_master_create ();
|
||||||
|
|
||||||
/* Initializations. */
|
/* Initializations. */
|
||||||
if (! daemon_mode)
|
zlog_default = openzlog (progname, ZLOG_OSPF6,
|
||||||
flag = ZLOG_STDOUT;
|
|
||||||
else
|
|
||||||
flag = 0;
|
|
||||||
|
|
||||||
zlog_default = openzlog (progname, flag, ZLOG_OSPF6,
|
|
||||||
LOG_CONS|LOG_NDELAY|LOG_PID,
|
LOG_CONS|LOG_NDELAY|LOG_PID,
|
||||||
LOG_DAEMON);
|
LOG_DAEMON);
|
||||||
zprivs_init (&ospf6d_privs);
|
zprivs_init (&ospf6d_privs);
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
||||||
|
|
||||||
|
* ospf_main.c: (main) The 2nd argument to openzlog has been removed.
|
||||||
|
|
||||||
2004-12-03 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
2004-12-03 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
||||||
|
|
||||||
* ospf_packet.c: (ospf_db_desc) Reduce priority on a debug message
|
* ospf_packet.c: (ospf_db_desc) Reduce priority on a debug message
|
||||||
|
@ -201,7 +201,7 @@ main (int argc, char **argv)
|
|||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
zlog_default = openzlog (progname, ZLOG_NOLOG, ZLOG_OSPF,
|
zlog_default = openzlog (progname, ZLOG_OSPF,
|
||||||
LOG_CONS|LOG_NDELAY|LOG_PID, LOG_DAEMON);
|
LOG_CONS|LOG_NDELAY|LOG_PID, LOG_DAEMON);
|
||||||
|
|
||||||
/* OSPF master init. */
|
/* OSPF master init. */
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
||||||
|
|
||||||
|
* rip_main.c: (main) The 2nd argument to openzlog has been removed.
|
||||||
|
|
||||||
2004-12-03 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
2004-12-03 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
||||||
|
|
||||||
* rip_main.c: (sigint) Use zlog_notice for termination message.
|
* rip_main.c: (sigint) Use zlog_notice for termination message.
|
||||||
|
@ -195,7 +195,7 @@ main (int argc, char **argv)
|
|||||||
progname = ((p = strrchr (argv[0], '/')) ? ++p : argv[0]);
|
progname = ((p = strrchr (argv[0], '/')) ? ++p : argv[0]);
|
||||||
|
|
||||||
/* First of all we need logging init. */
|
/* First of all we need logging init. */
|
||||||
zlog_default = openzlog (progname, ZLOG_NOLOG, ZLOG_RIP,
|
zlog_default = openzlog (progname, ZLOG_RIP,
|
||||||
LOG_CONS|LOG_NDELAY|LOG_PID, LOG_DAEMON);
|
LOG_CONS|LOG_NDELAY|LOG_PID, LOG_DAEMON);
|
||||||
|
|
||||||
/* Command line option parse. */
|
/* Command line option parse. */
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
||||||
|
|
||||||
|
* ripng_main.c: (main) The 2nd argument to openzlog has been removed.
|
||||||
|
|
||||||
2004-12-03 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
2004-12-03 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
||||||
|
|
||||||
* ripng_main.c: (sighup) Remove spurious terminating message.
|
* ripng_main.c: (sighup) Remove spurious terminating message.
|
||||||
|
@ -197,7 +197,7 @@ main (int argc, char **argv)
|
|||||||
/* get program name */
|
/* get program name */
|
||||||
progname = ((p = strrchr (argv[0], '/')) ? ++p : argv[0]);
|
progname = ((p = strrchr (argv[0], '/')) ? ++p : argv[0]);
|
||||||
|
|
||||||
zlog_default = openzlog(progname, ZLOG_NOLOG, ZLOG_RIPNG,
|
zlog_default = openzlog(progname, ZLOG_RIPNG,
|
||||||
LOG_CONS|LOG_NDELAY|LOG_PID, LOG_DAEMON);
|
LOG_CONS|LOG_NDELAY|LOG_PID, LOG_DAEMON);
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
|
@ -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>
|
2004-11-11 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
||||||
|
|
||||||
* vtysh.c: (vtysh_client_execute) Fix flaws in detecting trailing
|
* vtysh.c: (vtysh_client_execute) Fix flaws in detecting trailing
|
||||||
|
175
vtysh/vtysh.c
175
vtysh/vtysh.c
@ -52,7 +52,7 @@ int vtysh_writeconfig_integrated = 0;
|
|||||||
|
|
||||||
extern char config_default[];
|
extern char config_default[];
|
||||||
|
|
||||||
void
|
static void
|
||||||
vclient_close (struct vtysh_client *vclient)
|
vclient_close (struct vtysh_client *vclient)
|
||||||
{
|
{
|
||||||
if (vclient->fd > 0)
|
if (vclient->fd > 0)
|
||||||
@ -63,7 +63,7 @@ vclient_close (struct vtysh_client *vclient)
|
|||||||
/* Following filled with debug code to trace a problematic condition
|
/* Following filled with debug code to trace a problematic condition
|
||||||
* under load - it SHOULD handle it. */
|
* under load - it SHOULD handle it. */
|
||||||
#define ERR_WHERE_STRING "vtysh(): vtysh_client_config(): "
|
#define ERR_WHERE_STRING "vtysh(): vtysh_client_config(): "
|
||||||
int
|
static int
|
||||||
vtysh_client_config (struct vtysh_client *vclient, char *line)
|
vtysh_client_config (struct vtysh_client *vclient, char *line)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@ -161,7 +161,7 @@ vtysh_client_config (struct vtysh_client *vclient, char *line)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
vtysh_client_execute (struct vtysh_client *vclient, const char *line, FILE *fp)
|
vtysh_client_execute (struct vtysh_client *vclient, const char *line, FILE *fp)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@ -247,7 +247,7 @@ vtysh_pager_init ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Command execution over the vty interface. */
|
/* Command execution over the vty interface. */
|
||||||
void
|
static void
|
||||||
vtysh_execute_func (const char *line, int pager)
|
vtysh_execute_func (const char *line, int pager)
|
||||||
{
|
{
|
||||||
int ret, cmd_stat;
|
int ret, cmd_stat;
|
||||||
@ -604,7 +604,7 @@ vtysh_rl_describe ()
|
|||||||
* correct places only. */
|
* correct places only. */
|
||||||
int complete_status;
|
int complete_status;
|
||||||
|
|
||||||
char *
|
static char *
|
||||||
command_generator (const char *text, int state)
|
command_generator (const char *text, int state)
|
||||||
{
|
{
|
||||||
vector vline;
|
vector vline;
|
||||||
@ -635,7 +635,7 @@ command_generator (const char *text, int state)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char **
|
static char **
|
||||||
new_completion (char *text, int start, int end)
|
new_completion (char *text, int start, int end)
|
||||||
{
|
{
|
||||||
char **matches;
|
char **matches;
|
||||||
@ -652,7 +652,9 @@ new_completion (char *text, int start, int end)
|
|||||||
return matches;
|
return matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
char **
|
#if 0
|
||||||
|
/* This function is not actually being used. */
|
||||||
|
static char **
|
||||||
vtysh_completion (char *text, int start, int end)
|
vtysh_completion (char *text, int start, int end)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@ -676,6 +678,7 @@ vtysh_completion (char *text, int start, int end)
|
|||||||
|
|
||||||
return (char **) matched;
|
return (char **) matched;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Vty node structures. */
|
/* Vty node structures. */
|
||||||
struct cmd_node bgp_node =
|
struct cmd_node bgp_node =
|
||||||
@ -1015,7 +1018,7 @@ DEFUNSH (VTYSH_ALL,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
vtysh_exit (struct vty *vty)
|
vtysh_exit (struct vty *vty)
|
||||||
{
|
{
|
||||||
switch (vty->node)
|
switch (vty->node)
|
||||||
@ -1265,7 +1268,18 @@ DEFUNSH (VTYSH_ALL,
|
|||||||
vtysh_log_stdout_cmd,
|
vtysh_log_stdout_cmd,
|
||||||
"log stdout",
|
"log stdout",
|
||||||
"Logging control\n"
|
"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;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -1273,10 +1287,11 @@ DEFUNSH (VTYSH_ALL,
|
|||||||
DEFUNSH (VTYSH_ALL,
|
DEFUNSH (VTYSH_ALL,
|
||||||
no_vtysh_log_stdout,
|
no_vtysh_log_stdout,
|
||||||
no_vtysh_log_stdout_cmd,
|
no_vtysh_log_stdout_cmd,
|
||||||
"no log stdout",
|
"no log stdout [LEVEL]",
|
||||||
NO_STR
|
NO_STR
|
||||||
"Logging control\n"
|
"Logging control\n"
|
||||||
"Logging goes to stdout\n")
|
"Cancel logging to stdout\n"
|
||||||
|
"Logging level\n")
|
||||||
{
|
{
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -1292,6 +1307,18 @@ DEFUNSH (VTYSH_ALL,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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,
|
DEFUNSH (VTYSH_ALL,
|
||||||
no_vtysh_log_file,
|
no_vtysh_log_file,
|
||||||
no_vtysh_log_file_cmd,
|
no_vtysh_log_file_cmd,
|
||||||
@ -1304,12 +1331,66 @@ DEFUNSH (VTYSH_ALL,
|
|||||||
return CMD_SUCCESS;
|
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,
|
DEFUNSH (VTYSH_ALL,
|
||||||
vtysh_log_syslog,
|
vtysh_log_syslog,
|
||||||
vtysh_log_syslog_cmd,
|
vtysh_log_syslog_cmd,
|
||||||
"log syslog",
|
"log syslog",
|
||||||
"Logging control\n"
|
"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;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -1317,32 +1398,60 @@ DEFUNSH (VTYSH_ALL,
|
|||||||
DEFUNSH (VTYSH_ALL,
|
DEFUNSH (VTYSH_ALL,
|
||||||
no_vtysh_log_syslog,
|
no_vtysh_log_syslog,
|
||||||
no_vtysh_log_syslog_cmd,
|
no_vtysh_log_syslog_cmd,
|
||||||
"no log syslog",
|
"no log syslog [LEVEL]",
|
||||||
NO_STR
|
NO_STR
|
||||||
"Logging control\n"
|
"Logging control\n"
|
||||||
"Cancel logging to syslog\n")
|
"Cancel logging to syslog\n"
|
||||||
|
"Logging level\n")
|
||||||
{
|
{
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUNSH (VTYSH_ALL,
|
DEFUNSH (VTYSH_ALL,
|
||||||
vtysh_log_trap,
|
vtysh_log_facility,
|
||||||
vtysh_log_trap_cmd,
|
vtysh_log_facility_cmd,
|
||||||
"log trap (emergencies|alerts|critical|errors|warnings|\
|
"log facility "LOG_FACILITIES,
|
||||||
notifications|informational|debugging)",
|
|
||||||
"Logging control\n"
|
"Logging control\n"
|
||||||
"Limit logging to specifed level\n")
|
"Facility parameter for syslog messages\n"
|
||||||
|
LOG_FACILITY_DESC)
|
||||||
|
|
||||||
{
|
{
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUNSH (VTYSH_ALL,
|
DEFUNSH (VTYSH_ALL,
|
||||||
no_vtysh_log_trap,
|
no_vtysh_log_facility,
|
||||||
no_vtysh_log_trap_cmd,
|
no_vtysh_log_facility_cmd,
|
||||||
"no log trap",
|
"no log facility [FACILITY]",
|
||||||
NO_STR
|
NO_STR
|
||||||
"Logging control\n"
|
"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;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -1521,7 +1630,8 @@ DEFUN (no_vtysh_integrated_config,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int write_config_integrated(void)
|
static int
|
||||||
|
write_config_integrated(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
char line[] = "write terminal\n";
|
char line[] = "write terminal\n";
|
||||||
@ -1702,7 +1812,7 @@ DEFUN (vtysh_show_daemons,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Execute command in child process. */
|
/* Execute command in child process. */
|
||||||
int
|
static int
|
||||||
execute_command (const char *command, int argc, const char *arg1,
|
execute_command (const char *command, int argc, const char *arg1,
|
||||||
const char *arg2)
|
const char *arg2)
|
||||||
{
|
{
|
||||||
@ -1867,14 +1977,14 @@ DEFUN (vtysh_start_zsh,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
vtysh_install_default (enum node_type node)
|
vtysh_install_default (enum node_type node)
|
||||||
{
|
{
|
||||||
install_element (node, &config_list_cmd);
|
install_element (node, &config_list_cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Making connection to protocol daemon. */
|
/* Making connection to protocol daemon. */
|
||||||
int
|
static int
|
||||||
vtysh_connect (struct vtysh_client *vclient, const char *path)
|
vtysh_connect (struct vtysh_client *vclient, const char *path)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@ -1957,7 +2067,7 @@ vtysh_connect_all()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* To disable readline's filename completion. */
|
/* To disable readline's filename completion. */
|
||||||
char *
|
static char *
|
||||||
vtysh_completion_entry_function (const char *ignore, int invoking_key)
|
vtysh_completion_entry_function (const char *ignore, int invoking_key)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -2190,13 +2300,22 @@ vtysh_init_vty ()
|
|||||||
install_element (ENABLE_NODE, &vtysh_start_zsh_cmd);
|
install_element (ENABLE_NODE, &vtysh_start_zsh_cmd);
|
||||||
|
|
||||||
install_element (CONFIG_NODE, &vtysh_log_stdout_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, &no_vtysh_log_stdout_cmd);
|
||||||
install_element (CONFIG_NODE, &vtysh_log_file_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_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_cmd);
|
||||||
|
install_element (CONFIG_NODE, &vtysh_log_syslog_level_cmd);
|
||||||
install_element (CONFIG_NODE, &no_vtysh_log_syslog_cmd);
|
install_element (CONFIG_NODE, &no_vtysh_log_syslog_cmd);
|
||||||
install_element (CONFIG_NODE, &vtysh_log_trap_cmd);
|
install_element (CONFIG_NODE, &vtysh_log_trap_cmd);
|
||||||
install_element (CONFIG_NODE, &no_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, &vtysh_log_record_priority_cmd);
|
||||||
install_element (CONFIG_NODE, &no_vtysh_log_record_priority_cmd);
|
install_element (CONFIG_NODE, &no_vtysh_log_record_priority_cmd);
|
||||||
|
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2004-12-03 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
2004-12-03 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
||||||
|
|
||||||
* main.c: (sigint) Use zlog_notice for termination message.
|
* main.c: (sigint) Use zlog_notice for termination message.
|
||||||
|
@ -322,7 +322,7 @@ void irdp_finish()
|
|||||||
struct zebra_if *zi;
|
struct zebra_if *zi;
|
||||||
struct irdp_interface *irdp;
|
struct irdp_interface *irdp;
|
||||||
|
|
||||||
zlog_warn("IRDP: Received shutdown notification.");
|
zlog_info("IRDP: Received shutdown notification.");
|
||||||
|
|
||||||
for (node = listhead (iflist); node; node = nextnode (node))
|
for (node = listhead (iflist); node; node = nextnode (node))
|
||||||
{
|
{
|
||||||
|
@ -224,7 +224,7 @@ main (int argc, char **argv)
|
|||||||
/* preserve my name */
|
/* preserve my name */
|
||||||
progname = ((p = strrchr (argv[0], '/')) ? ++p : argv[0]);
|
progname = ((p = strrchr (argv[0], '/')) ? ++p : argv[0]);
|
||||||
|
|
||||||
zlog_default = openzlog (progname, ZLOG_STDOUT, ZLOG_ZEBRA,
|
zlog_default = openzlog (progname, ZLOG_ZEBRA,
|
||||||
LOG_CONS|LOG_NDELAY|LOG_PID, LOG_DAEMON);
|
LOG_CONS|LOG_NDELAY|LOG_PID, LOG_DAEMON);
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
|
Loading…
Reference in New Issue
Block a user