2002-12-13 21:15:29 +01:00
|
|
|
/* Virtual terminal interface shell.
|
|
|
|
* Copyright (C) 2000 Kunihiro Ishiguro
|
|
|
|
*
|
|
|
|
* This file is part of GNU Zebra.
|
|
|
|
*
|
|
|
|
* GNU Zebra is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation; either version 2, or (at your option) any
|
|
|
|
* later version.
|
|
|
|
*
|
|
|
|
* GNU Zebra is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with GNU Zebra; see the file COPYING. If not, write to the Free
|
|
|
|
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
* 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <zebra.h>
|
|
|
|
|
|
|
|
#include <sys/un.h>
|
|
|
|
#include <setjmp.h>
|
|
|
|
#include <sys/wait.h>
|
|
|
|
#include <sys/resource.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
|
|
|
#include <readline/readline.h>
|
|
|
|
#include <readline/history.h>
|
|
|
|
|
|
|
|
#include "command.h"
|
|
|
|
#include "memory.h"
|
|
|
|
#include "vtysh/vtysh.h"
|
2004-11-20 03:06:59 +01:00
|
|
|
#include "log.h"
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* Struct VTY. */
|
|
|
|
struct vty *vty;
|
|
|
|
|
|
|
|
/* VTY shell pager name. */
|
|
|
|
char *vtysh_pager_name = NULL;
|
|
|
|
|
|
|
|
/* VTY shell client structure. */
|
|
|
|
struct vtysh_client
|
|
|
|
{
|
|
|
|
int fd;
|
|
|
|
} vtysh_client[VTYSH_INDEX_MAX];
|
2004-08-25 14:22:00 +02:00
|
|
|
|
2004-10-03 22:11:32 +02:00
|
|
|
/* Using integrated config from Quagga.conf. Default is no. */
|
|
|
|
int vtysh_writeconfig_integrated = 0;
|
|
|
|
|
|
|
|
extern char config_default[];
|
|
|
|
|
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.
2004-12-07 16:39:31 +01:00
|
|
|
static void
|
2002-12-13 21:15:29 +01:00
|
|
|
vclient_close (struct vtysh_client *vclient)
|
|
|
|
{
|
|
|
|
if (vclient->fd > 0)
|
|
|
|
close (vclient->fd);
|
|
|
|
vclient->fd = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Following filled with debug code to trace a problematic condition
|
2004-08-26 15:08:30 +02:00
|
|
|
* under load - it SHOULD handle it. */
|
2002-12-13 21:15:29 +01:00
|
|
|
#define ERR_WHERE_STRING "vtysh(): vtysh_client_config(): "
|
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.
2004-12-07 16:39:31 +01:00
|
|
|
static int
|
2002-12-13 21:15:29 +01:00
|
|
|
vtysh_client_config (struct vtysh_client *vclient, char *line)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
char *buf;
|
|
|
|
size_t bufsz;
|
|
|
|
char *pbuf;
|
|
|
|
size_t left;
|
|
|
|
char *eoln;
|
|
|
|
int nbytes;
|
|
|
|
int i;
|
|
|
|
int readln;
|
|
|
|
|
|
|
|
if (vclient->fd < 0)
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
|
|
|
ret = write (vclient->fd, line, strlen (line) + 1);
|
|
|
|
if (ret <= 0)
|
|
|
|
{
|
|
|
|
vclient_close (vclient);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-08-26 15:08:30 +02:00
|
|
|
/* Allow enough room for buffer to read more than a few pages from socket. */
|
2003-01-23 19:05:42 +01:00
|
|
|
bufsz = 5 * getpagesize() + 1;
|
2002-12-13 21:15:29 +01:00
|
|
|
buf = XMALLOC(MTYPE_TMP, bufsz);
|
|
|
|
memset(buf, 0, bufsz);
|
|
|
|
pbuf = buf;
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
if (pbuf >= ((buf + bufsz) -1))
|
|
|
|
{
|
|
|
|
fprintf (stderr, ERR_WHERE_STRING \
|
|
|
|
"warning - pbuf beyond buffer end.\n");
|
|
|
|
return CMD_WARNING;
|
|
|
|
}
|
|
|
|
|
|
|
|
readln = (buf + bufsz) - pbuf - 1;
|
|
|
|
nbytes = read (vclient->fd, pbuf, readln);
|
|
|
|
|
|
|
|
if (nbytes <= 0)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (errno == EINTR)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
fprintf(stderr, ERR_WHERE_STRING "(%u)", errno);
|
|
|
|
perror("");
|
|
|
|
|
|
|
|
if (errno == EAGAIN || errno == EIO)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
vclient_close (vclient);
|
|
|
|
XFREE(MTYPE_TMP, buf);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
pbuf[nbytes] = '\0';
|
|
|
|
|
|
|
|
if (nbytes >= 4)
|
|
|
|
{
|
|
|
|
i = nbytes - 4;
|
|
|
|
if (pbuf[i] == '\0' && pbuf[i + 1] == '\0' && pbuf[i + 2] == '\0')
|
|
|
|
{
|
|
|
|
ret = pbuf[i + 3];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pbuf += nbytes;
|
|
|
|
|
|
|
|
/* See if a line exists in buffer, if so parse and consume it, and
|
2004-08-26 15:08:30 +02:00
|
|
|
* reset read position. */
|
2002-12-13 21:15:29 +01:00
|
|
|
if ((eoln = strrchr(buf, '\n')) == NULL)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (eoln >= ((buf + bufsz) - 1))
|
|
|
|
{
|
|
|
|
fprintf (stderr, ERR_WHERE_STRING \
|
|
|
|
"warning - eoln beyond buffer end.\n");
|
|
|
|
}
|
|
|
|
vtysh_config_parse(buf);
|
|
|
|
|
|
|
|
eoln++;
|
|
|
|
left = (size_t)(buf + bufsz - eoln);
|
|
|
|
memmove(buf, eoln, left);
|
|
|
|
buf[bufsz-1] = '\0';
|
|
|
|
pbuf = buf + strlen(buf);
|
|
|
|
}
|
|
|
|
|
2004-08-26 15:08:30 +02:00
|
|
|
/* Parse anything left in the buffer. */
|
2004-10-03 22:11:32 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
vtysh_config_parse (buf);
|
|
|
|
|
|
|
|
XFREE(MTYPE_TMP, buf);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
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.
2004-12-07 16:39:31 +01:00
|
|
|
static int
|
2004-10-07 23:40:25 +02:00
|
|
|
vtysh_client_execute (struct vtysh_client *vclient, const char *line, FILE *fp)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
char buf[1001];
|
|
|
|
int nbytes;
|
2004-09-17 08:52:16 +02:00
|
|
|
int i;
|
|
|
|
int numnulls = 0;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
if (vclient->fd < 0)
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
|
|
|
ret = write (vclient->fd, line, strlen (line) + 1);
|
|
|
|
if (ret <= 0)
|
|
|
|
{
|
|
|
|
vclient_close (vclient);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
nbytes = read (vclient->fd, buf, sizeof(buf)-1);
|
|
|
|
|
|
|
|
if (nbytes <= 0 && errno != EINTR)
|
|
|
|
{
|
|
|
|
vclient_close (vclient);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nbytes > 0)
|
|
|
|
{
|
2004-11-11 15:03:39 +01:00
|
|
|
if ((numnulls == 3) && (nbytes == 1))
|
|
|
|
return buf[0];
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
buf[nbytes] = '\0';
|
2004-11-11 15:03:39 +01:00
|
|
|
fputs (buf, fp);
|
2002-12-13 21:15:29 +01:00
|
|
|
fflush (fp);
|
2004-09-17 08:52:16 +02:00
|
|
|
|
2004-10-11 20:21:55 +02:00
|
|
|
/* check for trailling \0\0\0<ret code>,
|
|
|
|
* even if split across reads
|
|
|
|
* (see lib/vty.c::vtysh_read)
|
|
|
|
*/
|
2004-09-17 08:52:16 +02:00
|
|
|
if (nbytes >= 4)
|
|
|
|
{
|
|
|
|
i = nbytes-4;
|
|
|
|
numnulls = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
i = 0;
|
|
|
|
|
2004-10-11 20:21:55 +02:00
|
|
|
while (i < nbytes && numnulls < 3)
|
2004-09-17 08:52:16 +02:00
|
|
|
{
|
|
|
|
if (buf[i++] == '\0')
|
|
|
|
numnulls++;
|
|
|
|
else
|
2004-11-11 15:03:39 +01:00
|
|
|
numnulls = 0;
|
2004-09-17 08:52:16 +02:00
|
|
|
}
|
|
|
|
|
2004-11-11 15:03:39 +01:00
|
|
|
/* got 3 or more trailing NULs? */
|
|
|
|
if ((numnulls >= 3) && (i < nbytes))
|
2004-10-11 20:21:55 +02:00
|
|
|
return (buf[nbytes-1]);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
vtysh_exit_ripd_only ()
|
|
|
|
{
|
|
|
|
vtysh_client_execute (&vtysh_client[VTYSH_INDEX_RIP], "exit", stdout);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
vtysh_pager_init ()
|
|
|
|
{
|
2004-08-27 16:23:28 +02:00
|
|
|
char *pager_defined;
|
|
|
|
|
|
|
|
pager_defined = getenv ("VTYSH_PAGER");
|
|
|
|
|
|
|
|
if (pager_defined)
|
|
|
|
vtysh_pager_name = strdup (pager_defined);
|
|
|
|
else
|
2004-08-27 15:56:39 +02:00
|
|
|
vtysh_pager_name = strdup ("more");
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Command execution over the vty interface. */
|
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.
2004-12-07 16:39:31 +01:00
|
|
|
static void
|
2004-10-07 23:40:25 +02:00
|
|
|
vtysh_execute_func (const char *line, int pager)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
int ret, cmd_stat;
|
|
|
|
vector vline;
|
|
|
|
struct cmd_element *cmd;
|
|
|
|
FILE *fp = NULL;
|
2003-05-01 16:29:48 +02:00
|
|
|
int closepager=0;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2004-08-26 15:08:30 +02:00
|
|
|
/* Split readline string up into the vector. */
|
2002-12-13 21:15:29 +01:00
|
|
|
vline = cmd_make_strvec (line);
|
|
|
|
|
|
|
|
if (vline == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
ret = cmd_execute_command (vline, vty, &cmd);
|
|
|
|
|
|
|
|
cmd_free_strvec (vline);
|
|
|
|
|
|
|
|
switch (ret)
|
|
|
|
{
|
|
|
|
case CMD_WARNING:
|
|
|
|
if (vty->type == VTY_FILE)
|
2002-12-13 21:49:00 +01:00
|
|
|
fprintf (stdout,"Warning...\n");
|
2002-12-13 21:15:29 +01:00
|
|
|
break;
|
|
|
|
case CMD_ERR_AMBIGUOUS:
|
2002-12-13 21:49:00 +01:00
|
|
|
fprintf (stdout,"%% Ambiguous command.\n");
|
2002-12-13 21:15:29 +01:00
|
|
|
break;
|
|
|
|
case CMD_ERR_NO_MATCH:
|
2002-12-13 21:49:00 +01:00
|
|
|
fprintf (stdout,"%% Unknown command.\n");
|
2002-12-13 21:15:29 +01:00
|
|
|
break;
|
|
|
|
case CMD_ERR_INCOMPLETE:
|
2002-12-13 21:49:00 +01:00
|
|
|
fprintf (stdout,"%% Command incomplete.\n");
|
2002-12-13 21:15:29 +01:00
|
|
|
break;
|
|
|
|
case CMD_SUCCESS_DAEMON:
|
|
|
|
{
|
2004-10-20 21:07:48 +02:00
|
|
|
/* FIXME: Don't open pager for exit commands. popen() causes problems
|
|
|
|
* if exited from vtysh at all. This hack shouldn't cause any problem
|
|
|
|
* but is really ugly. */
|
|
|
|
if (pager && vtysh_pager_name && (strncmp(line, "exit", 4) != 0))
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2002-12-13 21:49:00 +01:00
|
|
|
fp = popen (vtysh_pager_name, "w");
|
2002-12-13 21:15:29 +01:00
|
|
|
if (fp == NULL)
|
|
|
|
{
|
2003-05-01 16:29:48 +02:00
|
|
|
perror ("popen failed for pager");
|
|
|
|
fp = stdout;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2003-05-01 16:29:48 +02:00
|
|
|
else
|
|
|
|
closepager=1;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
fp = stdout;
|
|
|
|
|
|
|
|
if (! strcmp(cmd->string,"configure terminal"))
|
|
|
|
{
|
|
|
|
cmd_stat = vtysh_client_execute (&vtysh_client[VTYSH_INDEX_ZEBRA],
|
|
|
|
line, fp);
|
|
|
|
if (cmd_stat != CMD_WARNING)
|
|
|
|
cmd_stat = vtysh_client_execute (&vtysh_client[VTYSH_INDEX_RIP],
|
|
|
|
line, fp);
|
|
|
|
if (cmd_stat != CMD_WARNING)
|
2004-08-26 15:08:30 +02:00
|
|
|
cmd_stat = vtysh_client_execute (&vtysh_client[VTYSH_INDEX_RIPNG],
|
|
|
|
line, fp);
|
2002-12-13 21:15:29 +01:00
|
|
|
if (cmd_stat != CMD_WARNING)
|
|
|
|
cmd_stat = vtysh_client_execute (&vtysh_client[VTYSH_INDEX_OSPF],
|
|
|
|
line, fp);
|
|
|
|
if (cmd_stat != CMD_WARNING)
|
2004-08-26 15:08:30 +02:00
|
|
|
cmd_stat = vtysh_client_execute (&vtysh_client[VTYSH_INDEX_OSPF6],
|
|
|
|
line, fp);
|
2002-12-13 21:15:29 +01:00
|
|
|
if (cmd_stat != CMD_WARNING)
|
|
|
|
cmd_stat = vtysh_client_execute (&vtysh_client[VTYSH_INDEX_BGP],
|
|
|
|
line, fp);
|
2004-08-25 14:22:00 +02:00
|
|
|
if (cmd_stat != CMD_WARNING)
|
2004-08-26 15:08:30 +02:00
|
|
|
cmd_stat = vtysh_client_execute (&vtysh_client[VTYSH_INDEX_ISIS],
|
|
|
|
line, fp);
|
2002-12-13 21:15:29 +01:00
|
|
|
if (cmd_stat)
|
|
|
|
{
|
2004-08-25 14:22:00 +02:00
|
|
|
line = "end";
|
|
|
|
vline = cmd_make_strvec (line);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2004-08-25 14:22:00 +02:00
|
|
|
if (vline == NULL)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2003-05-01 16:29:48 +02:00
|
|
|
if (pager && vtysh_pager_name && fp && closepager)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
if (pclose (fp) == -1)
|
|
|
|
{
|
2003-05-01 16:29:48 +02:00
|
|
|
perror ("pclose failed for pager");
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
fp = NULL;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-08-25 14:22:00 +02:00
|
|
|
ret = cmd_execute_command (vline, vty, &cmd);
|
|
|
|
cmd_free_strvec (vline);
|
|
|
|
if (ret != CMD_SUCCESS_DAEMON)
|
|
|
|
break;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
if (cmd->func)
|
|
|
|
{
|
|
|
|
(*cmd->func) (cmd, vty, 0, NULL);
|
|
|
|
break;
|
2004-08-25 14:22:00 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (cmd->daemon & VTYSH_ZEBRA)
|
|
|
|
if (vtysh_client_execute (&vtysh_client[VTYSH_INDEX_ZEBRA], line, fp)
|
|
|
|
!= CMD_SUCCESS)
|
|
|
|
break;
|
|
|
|
if (cmd->daemon & VTYSH_RIPD)
|
|
|
|
if (vtysh_client_execute (&vtysh_client[VTYSH_INDEX_RIP], line, fp)
|
|
|
|
!= CMD_SUCCESS)
|
|
|
|
break;
|
|
|
|
if (cmd->daemon & VTYSH_RIPNGD)
|
|
|
|
if (vtysh_client_execute (&vtysh_client[VTYSH_INDEX_RIPNG], line, fp)
|
|
|
|
!= CMD_SUCCESS)
|
|
|
|
break;
|
|
|
|
if (cmd->daemon & VTYSH_OSPFD)
|
|
|
|
if (vtysh_client_execute (&vtysh_client[VTYSH_INDEX_OSPF], line, fp)
|
|
|
|
!= CMD_SUCCESS)
|
|
|
|
break;
|
|
|
|
if (cmd->daemon & VTYSH_OSPF6D)
|
|
|
|
if (vtysh_client_execute (&vtysh_client[VTYSH_INDEX_OSPF6], line, fp)
|
|
|
|
!= CMD_SUCCESS)
|
|
|
|
break;
|
|
|
|
if (cmd->daemon & VTYSH_BGPD)
|
|
|
|
if (vtysh_client_execute (&vtysh_client[VTYSH_INDEX_BGP], line, fp)
|
|
|
|
!= CMD_SUCCESS)
|
|
|
|
break;
|
2004-08-25 14:22:00 +02:00
|
|
|
if (cmd->daemon & VTYSH_ISISD)
|
|
|
|
if (vtysh_client_execute (&vtysh_client[VTYSH_INDEX_ISIS], line, fp)
|
|
|
|
!= CMD_SUCCESS)
|
|
|
|
break;
|
2002-12-13 21:15:29 +01:00
|
|
|
if (cmd->func)
|
|
|
|
(*cmd->func) (cmd, vty, 0, NULL);
|
|
|
|
}
|
|
|
|
}
|
2003-05-01 16:29:48 +02:00
|
|
|
if (pager && vtysh_pager_name && fp && closepager)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
if (pclose (fp) == -1)
|
|
|
|
{
|
2003-05-01 16:29:48 +02:00
|
|
|
perror ("pclose failed for pager");
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
fp = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-10-07 23:40:25 +02:00
|
|
|
vtysh_execute_no_pager (const char *line)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
vtysh_execute_func (line, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-10-07 23:40:25 +02:00
|
|
|
vtysh_execute (const char *line)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
vtysh_execute_func (line, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Configration make from file. */
|
|
|
|
int
|
|
|
|
vtysh_config_from_file (struct vty *vty, FILE *fp)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
vector vline;
|
|
|
|
struct cmd_element *cmd;
|
|
|
|
|
|
|
|
while (fgets (vty->buf, VTY_BUFSIZ, fp))
|
|
|
|
{
|
|
|
|
if (vty->buf[0] == '!' || vty->buf[1] == '#')
|
|
|
|
continue;
|
|
|
|
|
|
|
|
vline = cmd_make_strvec (vty->buf);
|
|
|
|
|
2004-08-26 15:08:30 +02:00
|
|
|
/* In case of comment line. */
|
2002-12-13 21:15:29 +01:00
|
|
|
if (vline == NULL)
|
|
|
|
continue;
|
|
|
|
|
2004-08-26 15:08:30 +02:00
|
|
|
/* Execute configuration command : this is strict match. */
|
2002-12-13 21:15:29 +01:00
|
|
|
ret = cmd_execute_command_strict (vline, vty, &cmd);
|
|
|
|
|
2004-08-26 15:08:30 +02:00
|
|
|
/* Try again with setting node to CONFIG_NODE. */
|
2002-12-13 21:15:29 +01:00
|
|
|
if (ret != CMD_SUCCESS
|
|
|
|
&& ret != CMD_SUCCESS_DAEMON
|
|
|
|
&& ret != CMD_WARNING)
|
|
|
|
{
|
|
|
|
if (vty->node == KEYCHAIN_KEY_NODE)
|
|
|
|
{
|
|
|
|
vty->node = KEYCHAIN_NODE;
|
|
|
|
vtysh_exit_ripd_only ();
|
|
|
|
ret = cmd_execute_command_strict (vline, vty, &cmd);
|
|
|
|
|
|
|
|
if (ret != CMD_SUCCESS
|
|
|
|
&& ret != CMD_SUCCESS_DAEMON
|
|
|
|
&& ret != CMD_WARNING)
|
|
|
|
{
|
|
|
|
vtysh_exit_ripd_only ();
|
|
|
|
vty->node = CONFIG_NODE;
|
|
|
|
ret = cmd_execute_command_strict (vline, vty, &cmd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
vtysh_execute ("end");
|
|
|
|
vtysh_execute ("configure terminal");
|
|
|
|
vty->node = CONFIG_NODE;
|
|
|
|
ret = cmd_execute_command_strict (vline, vty, &cmd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd_free_strvec (vline);
|
|
|
|
|
|
|
|
switch (ret)
|
|
|
|
{
|
|
|
|
case CMD_WARNING:
|
|
|
|
if (vty->type == VTY_FILE)
|
2002-12-13 21:49:00 +01:00
|
|
|
fprintf (stdout,"Warning...\n");
|
2002-12-13 21:15:29 +01:00
|
|
|
break;
|
|
|
|
case CMD_ERR_AMBIGUOUS:
|
2002-12-13 21:49:00 +01:00
|
|
|
fprintf (stdout,"%% Ambiguous command.\n");
|
2002-12-13 21:15:29 +01:00
|
|
|
break;
|
|
|
|
case CMD_ERR_NO_MATCH:
|
2002-12-13 21:49:00 +01:00
|
|
|
fprintf (stdout,"%% Unknown command: %s", vty->buf);
|
2002-12-13 21:15:29 +01:00
|
|
|
break;
|
|
|
|
case CMD_ERR_INCOMPLETE:
|
2002-12-13 21:49:00 +01:00
|
|
|
fprintf (stdout,"%% Command incomplete.\n");
|
2002-12-13 21:15:29 +01:00
|
|
|
break;
|
|
|
|
case CMD_SUCCESS_DAEMON:
|
|
|
|
{
|
|
|
|
if (cmd->daemon & VTYSH_ZEBRA)
|
|
|
|
if (vtysh_client_execute (&vtysh_client[VTYSH_INDEX_ZEBRA],
|
|
|
|
vty->buf, stdout) != CMD_SUCCESS)
|
|
|
|
break;
|
|
|
|
if (cmd->daemon & VTYSH_RIPD)
|
|
|
|
if (vtysh_client_execute (&vtysh_client[VTYSH_INDEX_RIP],
|
|
|
|
vty->buf, stdout) != CMD_SUCCESS)
|
|
|
|
break;
|
|
|
|
if (cmd->daemon & VTYSH_RIPNGD)
|
|
|
|
if (vtysh_client_execute (&vtysh_client[VTYSH_INDEX_RIPNG],
|
|
|
|
vty->buf, stdout) != CMD_SUCCESS)
|
|
|
|
break;
|
|
|
|
if (cmd->daemon & VTYSH_OSPFD)
|
|
|
|
if (vtysh_client_execute (&vtysh_client[VTYSH_INDEX_OSPF],
|
|
|
|
vty->buf, stdout) != CMD_SUCCESS)
|
|
|
|
break;
|
|
|
|
if (cmd->daemon & VTYSH_OSPF6D)
|
|
|
|
if (vtysh_client_execute (&vtysh_client[VTYSH_INDEX_OSPF6],
|
|
|
|
vty->buf, stdout) != CMD_SUCCESS)
|
|
|
|
break;
|
|
|
|
if (cmd->daemon & VTYSH_BGPD)
|
|
|
|
if (vtysh_client_execute (&vtysh_client[VTYSH_INDEX_BGP],
|
|
|
|
vty->buf, stdout) != CMD_SUCCESS)
|
|
|
|
break;
|
2004-08-25 14:22:00 +02:00
|
|
|
if (cmd->daemon & VTYSH_ISISD)
|
|
|
|
if (vtysh_client_execute (&vtysh_client[VTYSH_INDEX_ISIS],
|
|
|
|
vty->buf, stdout) != CMD_SUCCESS)
|
|
|
|
break;
|
2002-12-13 21:15:29 +01:00
|
|
|
if (cmd->func)
|
|
|
|
(*cmd->func) (cmd, vty, 0, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We don't care about the point of the cursor when '?' is typed. */
|
|
|
|
int
|
|
|
|
vtysh_rl_describe ()
|
|
|
|
{
|
|
|
|
int ret;
|
2004-10-07 23:40:25 +02:00
|
|
|
unsigned int i;
|
2002-12-13 21:15:29 +01:00
|
|
|
vector vline;
|
|
|
|
vector describe;
|
|
|
|
int width;
|
|
|
|
struct desc *desc;
|
|
|
|
|
|
|
|
vline = cmd_make_strvec (rl_line_buffer);
|
|
|
|
|
|
|
|
/* In case of '> ?'. */
|
|
|
|
if (vline == NULL)
|
|
|
|
{
|
|
|
|
vline = vector_init (1);
|
|
|
|
vector_set (vline, '\0');
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (rl_end && isspace ((int) rl_line_buffer[rl_end - 1]))
|
|
|
|
vector_set (vline, '\0');
|
|
|
|
|
|
|
|
describe = cmd_describe_command (vline, vty, &ret);
|
|
|
|
|
2002-12-13 21:49:00 +01:00
|
|
|
fprintf (stdout,"\n");
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* Ambiguous and no match error. */
|
|
|
|
switch (ret)
|
|
|
|
{
|
|
|
|
case CMD_ERR_AMBIGUOUS:
|
|
|
|
cmd_free_strvec (vline);
|
2002-12-13 21:49:00 +01:00
|
|
|
fprintf (stdout,"%% Ambiguous command.\n");
|
2002-12-13 21:15:29 +01:00
|
|
|
rl_on_new_line ();
|
|
|
|
return 0;
|
|
|
|
break;
|
|
|
|
case CMD_ERR_NO_MATCH:
|
|
|
|
cmd_free_strvec (vline);
|
2002-12-13 21:49:00 +01:00
|
|
|
fprintf (stdout,"%% There is no matched command.\n");
|
2002-12-13 21:15:29 +01:00
|
|
|
rl_on_new_line ();
|
|
|
|
return 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get width of command string. */
|
|
|
|
width = 0;
|
|
|
|
for (i = 0; i < vector_max (describe); i++)
|
|
|
|
if ((desc = vector_slot (describe, i)) != NULL)
|
|
|
|
{
|
|
|
|
int len;
|
|
|
|
|
|
|
|
if (desc->cmd[0] == '\0')
|
|
|
|
continue;
|
|
|
|
|
|
|
|
len = strlen (desc->cmd);
|
|
|
|
if (desc->cmd[0] == '.')
|
|
|
|
len--;
|
|
|
|
|
|
|
|
if (width < len)
|
|
|
|
width = len;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < vector_max (describe); i++)
|
|
|
|
if ((desc = vector_slot (describe, i)) != NULL)
|
|
|
|
{
|
|
|
|
if (desc->cmd[0] == '\0')
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (! desc->str)
|
2002-12-13 21:49:00 +01:00
|
|
|
fprintf (stdout," %-s\n",
|
2004-08-25 14:22:00 +02:00
|
|
|
desc->cmd[0] == '.' ? desc->cmd + 1 : desc->cmd);
|
2002-12-13 21:15:29 +01:00
|
|
|
else
|
2002-12-13 21:49:00 +01:00
|
|
|
fprintf (stdout," %-*s %s\n",
|
2004-08-25 14:22:00 +02:00
|
|
|
width,
|
|
|
|
desc->cmd[0] == '.' ? desc->cmd + 1 : desc->cmd,
|
|
|
|
desc->str);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
cmd_free_strvec (vline);
|
|
|
|
vector_free (describe);
|
|
|
|
|
|
|
|
rl_on_new_line();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-08-26 15:08:30 +02:00
|
|
|
/* Result of cmd_complete_command() call will be stored here
|
|
|
|
* and used in new_completion() in order to put the space in
|
|
|
|
* correct places only. */
|
2002-12-13 21:15:29 +01:00
|
|
|
int complete_status;
|
|
|
|
|
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.
2004-12-07 16:39:31 +01:00
|
|
|
static char *
|
2003-04-19 01:55:29 +02:00
|
|
|
command_generator (const char *text, int state)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
vector vline;
|
|
|
|
static char **matched = NULL;
|
|
|
|
static int index = 0;
|
|
|
|
|
|
|
|
/* First call. */
|
|
|
|
if (! state)
|
|
|
|
{
|
|
|
|
index = 0;
|
|
|
|
|
|
|
|
if (vty->node == AUTH_NODE || vty->node == AUTH_ENABLE_NODE)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
vline = cmd_make_strvec (rl_line_buffer);
|
|
|
|
if (vline == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if (rl_end && isspace ((int) rl_line_buffer[rl_end - 1]))
|
|
|
|
vector_set (vline, '\0');
|
|
|
|
|
|
|
|
matched = cmd_complete_command (vline, vty, &complete_status);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (matched && matched[index])
|
|
|
|
return matched[index++];
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
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.
2004-12-07 16:39:31 +01:00
|
|
|
static char **
|
2002-12-13 21:15:29 +01:00
|
|
|
new_completion (char *text, int start, int end)
|
|
|
|
{
|
|
|
|
char **matches;
|
|
|
|
|
2003-04-19 01:55:29 +02:00
|
|
|
matches = rl_completion_matches (text, command_generator);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
if (matches)
|
|
|
|
{
|
|
|
|
rl_point = rl_end;
|
|
|
|
if (complete_status == CMD_COMPLETE_FULL_MATCH)
|
|
|
|
rl_pending_input = ' ';
|
|
|
|
}
|
|
|
|
|
|
|
|
return matches;
|
|
|
|
}
|
|
|
|
|
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.
2004-12-07 16:39:31 +01:00
|
|
|
#if 0
|
|
|
|
/* This function is not actually being used. */
|
|
|
|
static char **
|
2002-12-13 21:15:29 +01:00
|
|
|
vtysh_completion (char *text, int start, int end)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
vector vline;
|
|
|
|
char **matched = NULL;
|
|
|
|
|
|
|
|
if (vty->node == AUTH_NODE || vty->node == AUTH_ENABLE_NODE)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
vline = cmd_make_strvec (rl_line_buffer);
|
|
|
|
if (vline == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
/* In case of 'help \t'. */
|
|
|
|
if (rl_end && isspace ((int) rl_line_buffer[rl_end - 1]))
|
|
|
|
vector_set (vline, '\0');
|
|
|
|
|
|
|
|
matched = cmd_complete_command (vline, vty, &ret);
|
|
|
|
|
|
|
|
cmd_free_strvec (vline);
|
|
|
|
|
|
|
|
return (char **) matched;
|
|
|
|
}
|
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.
2004-12-07 16:39:31 +01:00
|
|
|
#endif
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2004-08-26 15:08:30 +02:00
|
|
|
/* Vty node structures. */
|
2002-12-13 21:15:29 +01:00
|
|
|
struct cmd_node bgp_node =
|
|
|
|
{
|
|
|
|
BGP_NODE,
|
|
|
|
"%s(config-router)# ",
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cmd_node rip_node =
|
|
|
|
{
|
|
|
|
RIP_NODE,
|
|
|
|
"%s(config-router)# ",
|
|
|
|
};
|
|
|
|
|
2003-12-23 11:39:08 +01:00
|
|
|
struct cmd_node isis_node =
|
|
|
|
{
|
|
|
|
ISIS_NODE,
|
|
|
|
"%s(config-router)# ",
|
|
|
|
};
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
struct cmd_node interface_node =
|
|
|
|
{
|
|
|
|
INTERFACE_NODE,
|
|
|
|
"%s(config-if)# ",
|
|
|
|
};
|
|
|
|
|
2004-08-26 15:08:30 +02:00
|
|
|
struct cmd_node rmap_node =
|
|
|
|
{
|
|
|
|
RMAP_NODE,
|
|
|
|
"%s(config-route-map)# "
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cmd_node zebra_node =
|
|
|
|
{
|
|
|
|
ZEBRA_NODE,
|
|
|
|
"%s(config-router)# "
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cmd_node bgp_vpnv4_node =
|
|
|
|
{
|
|
|
|
BGP_VPNV4_NODE,
|
|
|
|
"%s(config-router-af)# "
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cmd_node bgp_ipv4_node =
|
|
|
|
{
|
|
|
|
BGP_IPV4_NODE,
|
|
|
|
"%s(config-router-af)# "
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cmd_node bgp_ipv4m_node =
|
|
|
|
{
|
|
|
|
BGP_IPV4M_NODE,
|
|
|
|
"%s(config-router-af)# "
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cmd_node bgp_ipv6_node =
|
|
|
|
{
|
|
|
|
BGP_IPV6_NODE,
|
|
|
|
"%s(config-router-af)# "
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cmd_node ospf_node =
|
|
|
|
{
|
|
|
|
OSPF_NODE,
|
|
|
|
"%s(config-router)# "
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cmd_node ripng_node =
|
|
|
|
{
|
|
|
|
RIPNG_NODE,
|
|
|
|
"%s(config-router)# "
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cmd_node ospf6_node =
|
|
|
|
{
|
|
|
|
OSPF6_NODE,
|
|
|
|
"%s(config-ospf6)# "
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cmd_node keychain_node =
|
|
|
|
{
|
|
|
|
KEYCHAIN_NODE,
|
|
|
|
"%s(config-keychain)# "
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cmd_node keychain_key_node =
|
|
|
|
{
|
|
|
|
KEYCHAIN_KEY_NODE,
|
|
|
|
"%s(config-keychain-key)# "
|
|
|
|
};
|
|
|
|
|
2004-10-03 22:11:32 +02:00
|
|
|
/* Defined in lib/vty.c */
|
|
|
|
extern struct cmd_node vty_node;
|
|
|
|
|
2004-08-26 15:08:30 +02:00
|
|
|
/* When '^Z' is received from vty, move down to the enable mode. */
|
|
|
|
int
|
|
|
|
vtysh_end ()
|
|
|
|
{
|
|
|
|
switch (vty->node)
|
|
|
|
{
|
|
|
|
case VIEW_NODE:
|
|
|
|
case ENABLE_NODE:
|
|
|
|
/* Nothing to do. */
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
vty->node = ENABLE_NODE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_ALL,
|
|
|
|
vtysh_end_all,
|
|
|
|
vtysh_end_all_cmd,
|
|
|
|
"end",
|
2004-10-03 22:11:32 +02:00
|
|
|
"End current mode and change to enable mode\n")
|
2004-08-26 15:08:30 +02:00
|
|
|
{
|
2004-09-26 18:25:07 +02:00
|
|
|
return vtysh_end ();
|
2004-08-26 15:08:30 +02:00
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
DEFUNSH (VTYSH_BGPD,
|
|
|
|
router_bgp,
|
|
|
|
router_bgp_cmd,
|
|
|
|
"router bgp <1-65535>",
|
|
|
|
ROUTER_STR
|
|
|
|
BGP_STR
|
|
|
|
AS_STR)
|
|
|
|
{
|
|
|
|
vty->node = BGP_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_BGPD,
|
|
|
|
address_family_vpnv4,
|
|
|
|
address_family_vpnv4_cmd,
|
|
|
|
"address-family vpnv4",
|
|
|
|
"Enter Address Family command mode\n"
|
|
|
|
"Address family\n")
|
|
|
|
{
|
|
|
|
vty->node = BGP_VPNV4_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_BGPD,
|
|
|
|
address_family_vpnv4_unicast,
|
|
|
|
address_family_vpnv4_unicast_cmd,
|
|
|
|
"address-family vpnv4 unicast",
|
|
|
|
"Enter Address Family command mode\n"
|
|
|
|
"Address family\n"
|
|
|
|
"Address Family Modifier\n")
|
|
|
|
{
|
|
|
|
vty->node = BGP_VPNV4_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_BGPD,
|
|
|
|
address_family_ipv4_unicast,
|
|
|
|
address_family_ipv4_unicast_cmd,
|
|
|
|
"address-family ipv4 unicast",
|
|
|
|
"Enter Address Family command mode\n"
|
|
|
|
"Address family\n"
|
|
|
|
"Address Family Modifier\n")
|
|
|
|
{
|
|
|
|
vty->node = BGP_IPV4_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_BGPD,
|
|
|
|
address_family_ipv4_multicast,
|
|
|
|
address_family_ipv4_multicast_cmd,
|
|
|
|
"address-family ipv4 multicast",
|
|
|
|
"Enter Address Family command mode\n"
|
|
|
|
"Address family\n"
|
|
|
|
"Address Family Modifier\n")
|
|
|
|
{
|
|
|
|
vty->node = BGP_IPV4M_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_BGPD,
|
|
|
|
address_family_ipv6,
|
|
|
|
address_family_ipv6_cmd,
|
|
|
|
"address-family ipv6",
|
|
|
|
"Enter Address Family command mode\n"
|
|
|
|
"Address family\n")
|
|
|
|
{
|
|
|
|
vty->node = BGP_IPV6_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_BGPD,
|
|
|
|
address_family_ipv6_unicast,
|
|
|
|
address_family_ipv6_unicast_cmd,
|
|
|
|
"address-family ipv6 unicast",
|
|
|
|
"Enter Address Family command mode\n"
|
|
|
|
"Address family\n"
|
|
|
|
"Address Family Modifier\n")
|
|
|
|
{
|
|
|
|
vty->node = BGP_IPV6_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_RIPD,
|
|
|
|
key_chain,
|
|
|
|
key_chain_cmd,
|
|
|
|
"key chain WORD",
|
|
|
|
"Authentication key management\n"
|
|
|
|
"Key-chain management\n"
|
|
|
|
"Key-chain name\n")
|
|
|
|
{
|
|
|
|
vty->node = KEYCHAIN_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_RIPD,
|
|
|
|
key,
|
|
|
|
key_cmd,
|
|
|
|
"key <0-2147483647>",
|
|
|
|
"Configure a key\n"
|
|
|
|
"Key identifier number\n")
|
|
|
|
{
|
|
|
|
vty->node = KEYCHAIN_KEY_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_RIPD,
|
|
|
|
router_rip,
|
|
|
|
router_rip_cmd,
|
|
|
|
"router rip",
|
|
|
|
ROUTER_STR
|
|
|
|
"RIP")
|
|
|
|
{
|
|
|
|
vty->node = RIP_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_RIPNGD,
|
|
|
|
router_ripng,
|
|
|
|
router_ripng_cmd,
|
|
|
|
"router ripng",
|
|
|
|
ROUTER_STR
|
|
|
|
"RIPng")
|
|
|
|
{
|
|
|
|
vty->node = RIPNG_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_OSPFD,
|
|
|
|
router_ospf,
|
|
|
|
router_ospf_cmd,
|
|
|
|
"router ospf",
|
|
|
|
"Enable a routing process\n"
|
|
|
|
"Start OSPF configuration\n")
|
|
|
|
{
|
|
|
|
vty->node = OSPF_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_OSPF6D,
|
|
|
|
router_ospf6,
|
|
|
|
router_ospf6_cmd,
|
|
|
|
"router ospf6",
|
|
|
|
OSPF6_ROUTER_STR
|
|
|
|
OSPF6_STR)
|
|
|
|
{
|
|
|
|
vty->node = OSPF6_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2003-12-23 11:39:08 +01:00
|
|
|
DEFUNSH (VTYSH_ISISD,
|
2004-08-25 14:22:00 +02:00
|
|
|
router_isis,
|
|
|
|
router_isis_cmd,
|
|
|
|
"router isis WORD",
|
|
|
|
ROUTER_STR
|
|
|
|
"ISO IS-IS\n"
|
|
|
|
"ISO Routing area tag")
|
2003-12-23 11:39:08 +01:00
|
|
|
{
|
|
|
|
vty->node = ISIS_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
DEFUNSH (VTYSH_RMAP,
|
|
|
|
route_map,
|
|
|
|
route_map_cmd,
|
|
|
|
"route-map WORD (deny|permit) <1-65535>",
|
|
|
|
"Create route-map or enter route-map command mode\n"
|
|
|
|
"Route map tag\n"
|
|
|
|
"Route map denies set operations\n"
|
|
|
|
"Route map permits set operations\n"
|
|
|
|
"Sequence to insert to/delete from existing route-map entry\n")
|
|
|
|
{
|
|
|
|
vty->node = RMAP_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-10-03 22:11:32 +02:00
|
|
|
DEFUNSH (VTYSH_ALL,
|
|
|
|
vtysh_line_vty,
|
|
|
|
vtysh_line_vty_cmd,
|
|
|
|
"line vty",
|
|
|
|
"Configure a terminal line\n"
|
|
|
|
"Virtual terminal\n")
|
|
|
|
{
|
|
|
|
vty->node = VTY_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
DEFUNSH (VTYSH_ALL,
|
|
|
|
vtysh_enable,
|
|
|
|
vtysh_enable_cmd,
|
|
|
|
"enable",
|
|
|
|
"Turn on privileged mode command\n")
|
|
|
|
{
|
|
|
|
vty->node = ENABLE_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_ALL,
|
|
|
|
vtysh_disable,
|
|
|
|
vtysh_disable_cmd,
|
|
|
|
"disable",
|
|
|
|
"Turn off privileged mode command\n")
|
|
|
|
{
|
|
|
|
if (vty->node == ENABLE_NODE)
|
|
|
|
vty->node = VIEW_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_ALL,
|
|
|
|
vtysh_config_terminal,
|
|
|
|
vtysh_config_terminal_cmd,
|
|
|
|
"configure terminal",
|
|
|
|
"Configuration from vty interface\n"
|
|
|
|
"Configuration terminal\n")
|
|
|
|
{
|
|
|
|
vty->node = CONFIG_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
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.
2004-12-07 16:39:31 +01:00
|
|
|
static int
|
2002-12-13 21:15:29 +01:00
|
|
|
vtysh_exit (struct vty *vty)
|
|
|
|
{
|
|
|
|
switch (vty->node)
|
|
|
|
{
|
|
|
|
case VIEW_NODE:
|
|
|
|
case ENABLE_NODE:
|
|
|
|
exit (0);
|
|
|
|
break;
|
|
|
|
case CONFIG_NODE:
|
|
|
|
vty->node = ENABLE_NODE;
|
|
|
|
break;
|
|
|
|
case INTERFACE_NODE:
|
|
|
|
case ZEBRA_NODE:
|
|
|
|
case BGP_NODE:
|
|
|
|
case RIP_NODE:
|
|
|
|
case RIPNG_NODE:
|
|
|
|
case OSPF_NODE:
|
|
|
|
case OSPF6_NODE:
|
2003-12-23 11:39:08 +01:00
|
|
|
case ISIS_NODE:
|
2002-12-13 21:15:29 +01:00
|
|
|
case MASC_NODE:
|
|
|
|
case RMAP_NODE:
|
|
|
|
case VTY_NODE:
|
|
|
|
case KEYCHAIN_NODE:
|
2004-05-10 01:16:40 +02:00
|
|
|
vtysh_execute("end");
|
|
|
|
vtysh_execute("configure terminal");
|
2002-12-13 21:15:29 +01:00
|
|
|
vty->node = CONFIG_NODE;
|
|
|
|
break;
|
|
|
|
case BGP_VPNV4_NODE:
|
|
|
|
case BGP_IPV4_NODE:
|
|
|
|
case BGP_IPV4M_NODE:
|
|
|
|
case BGP_IPV6_NODE:
|
|
|
|
vty->node = BGP_NODE;
|
|
|
|
break;
|
|
|
|
case KEYCHAIN_KEY_NODE:
|
|
|
|
vty->node = KEYCHAIN_NODE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_ALL,
|
|
|
|
vtysh_exit_all,
|
|
|
|
vtysh_exit_all_cmd,
|
|
|
|
"exit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
|
|
|
{
|
|
|
|
return vtysh_exit (vty);
|
|
|
|
}
|
|
|
|
|
|
|
|
ALIAS (vtysh_exit_all,
|
|
|
|
vtysh_quit_all_cmd,
|
|
|
|
"quit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_BGPD,
|
|
|
|
exit_address_family,
|
|
|
|
exit_address_family_cmd,
|
|
|
|
"exit-address-family",
|
|
|
|
"Exit from Address Family configuration mode\n")
|
|
|
|
{
|
|
|
|
if (vty->node == BGP_IPV4_NODE
|
|
|
|
|| vty->node == BGP_IPV4M_NODE
|
|
|
|
|| vty->node == BGP_VPNV4_NODE
|
|
|
|
|| vty->node == BGP_IPV6_NODE)
|
|
|
|
vty->node = BGP_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_ZEBRA,
|
|
|
|
vtysh_exit_zebra,
|
|
|
|
vtysh_exit_zebra_cmd,
|
|
|
|
"exit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
|
|
|
{
|
|
|
|
return vtysh_exit (vty);
|
|
|
|
}
|
|
|
|
|
|
|
|
ALIAS (vtysh_exit_zebra,
|
|
|
|
vtysh_quit_zebra_cmd,
|
|
|
|
"quit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_RIPD,
|
|
|
|
vtysh_exit_ripd,
|
|
|
|
vtysh_exit_ripd_cmd,
|
|
|
|
"exit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
|
|
|
{
|
|
|
|
return vtysh_exit (vty);
|
|
|
|
}
|
|
|
|
|
|
|
|
ALIAS (vtysh_exit_ripd,
|
|
|
|
vtysh_quit_ripd_cmd,
|
|
|
|
"quit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
DEFUNSH (VTYSH_RIPNGD,
|
2004-08-25 14:22:00 +02:00
|
|
|
vtysh_exit_ripngd,
|
|
|
|
vtysh_exit_ripngd_cmd,
|
|
|
|
"exit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2003-03-25 06:07:42 +01:00
|
|
|
{
|
|
|
|
return vtysh_exit (vty);
|
|
|
|
}
|
|
|
|
|
|
|
|
ALIAS (vtysh_exit_ripngd,
|
|
|
|
vtysh_quit_ripngd_cmd,
|
|
|
|
"quit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
DEFUNSH (VTYSH_RMAP,
|
|
|
|
vtysh_exit_rmap,
|
|
|
|
vtysh_exit_rmap_cmd,
|
|
|
|
"exit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
|
|
|
{
|
|
|
|
return vtysh_exit (vty);
|
|
|
|
}
|
|
|
|
|
|
|
|
ALIAS (vtysh_exit_rmap,
|
|
|
|
vtysh_quit_rmap_cmd,
|
|
|
|
"quit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_BGPD,
|
|
|
|
vtysh_exit_bgpd,
|
|
|
|
vtysh_exit_bgpd_cmd,
|
|
|
|
"exit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
|
|
|
{
|
|
|
|
return vtysh_exit (vty);
|
|
|
|
}
|
|
|
|
|
|
|
|
ALIAS (vtysh_exit_bgpd,
|
|
|
|
vtysh_quit_bgpd_cmd,
|
|
|
|
"quit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_OSPFD,
|
|
|
|
vtysh_exit_ospfd,
|
|
|
|
vtysh_exit_ospfd_cmd,
|
|
|
|
"exit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
|
|
|
{
|
|
|
|
return vtysh_exit (vty);
|
|
|
|
}
|
|
|
|
|
|
|
|
ALIAS (vtysh_exit_ospfd,
|
|
|
|
vtysh_quit_ospfd_cmd,
|
|
|
|
"quit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
DEFUNSH (VTYSH_OSPF6D,
|
2004-08-25 14:22:00 +02:00
|
|
|
vtysh_exit_ospf6d,
|
|
|
|
vtysh_exit_ospf6d_cmd,
|
|
|
|
"exit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2003-03-25 06:07:42 +01:00
|
|
|
{
|
|
|
|
return vtysh_exit (vty);
|
|
|
|
}
|
|
|
|
|
|
|
|
ALIAS (vtysh_exit_ospf6d,
|
|
|
|
vtysh_quit_ospf6d_cmd,
|
|
|
|
"quit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
|
|
|
|
2003-12-23 11:39:08 +01:00
|
|
|
DEFUNSH (VTYSH_ISISD,
|
2004-08-25 14:22:00 +02:00
|
|
|
vtysh_exit_isisd,
|
|
|
|
vtysh_exit_isisd_cmd,
|
|
|
|
"exit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2003-12-23 11:39:08 +01:00
|
|
|
{
|
|
|
|
return vtysh_exit (vty);
|
|
|
|
}
|
|
|
|
|
|
|
|
ALIAS (vtysh_exit_isisd,
|
|
|
|
vtysh_quit_isisd_cmd,
|
|
|
|
"quit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
|
|
|
|
2004-10-03 22:11:32 +02:00
|
|
|
DEFUNSH (VTYSH_ALL,
|
|
|
|
vtysh_exit_line_vty,
|
|
|
|
vtysh_exit_line_vty_cmd,
|
|
|
|
"exit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
|
|
|
{
|
|
|
|
return vtysh_exit (vty);
|
|
|
|
}
|
|
|
|
|
|
|
|
ALIAS (vtysh_exit_line_vty,
|
|
|
|
vtysh_quit_line_vty_cmd,
|
|
|
|
"quit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
|
|
|
|
2004-08-26 15:08:30 +02:00
|
|
|
DEFUNSH (VTYSH_INTERFACE,
|
2002-12-13 21:15:29 +01:00
|
|
|
vtysh_interface,
|
|
|
|
vtysh_interface_cmd,
|
|
|
|
"interface IFNAME",
|
|
|
|
"Select an interface to configure\n"
|
|
|
|
"Interface's name\n")
|
|
|
|
{
|
|
|
|
vty->node = INTERFACE_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-08-26 15:08:30 +02:00
|
|
|
/* TODO Implement "no interface command in isisd. */
|
2003-05-23 11:25:20 +02:00
|
|
|
DEFSH (VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D,
|
|
|
|
vtysh_no_interface_cmd,
|
|
|
|
"no interface IFNAME",
|
|
|
|
NO_STR
|
|
|
|
"Delete a pseudo interface's configuration\n"
|
|
|
|
"Interface's name\n")
|
|
|
|
|
2004-08-26 15:08:30 +02:00
|
|
|
/* TODO Implement interface description commands in ripngd, ospf6d
|
|
|
|
* and isisd. */
|
2003-03-01 16:44:10 +01:00
|
|
|
DEFSH (VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_OSPFD,
|
|
|
|
interface_desc_cmd,
|
|
|
|
"description .LINE",
|
|
|
|
"Interface specific description\n"
|
|
|
|
"Characters describing this interface\n")
|
2003-03-28 03:25:45 +01:00
|
|
|
|
|
|
|
DEFSH (VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_OSPFD,
|
|
|
|
no_interface_desc_cmd,
|
|
|
|
"no description",
|
|
|
|
NO_STR
|
|
|
|
"Interface specific description\n")
|
2003-03-01 16:44:10 +01:00
|
|
|
|
2004-08-26 15:08:30 +02:00
|
|
|
DEFUNSH (VTYSH_INTERFACE,
|
2002-12-13 21:15:29 +01:00
|
|
|
vtysh_exit_interface,
|
|
|
|
vtysh_exit_interface_cmd,
|
|
|
|
"exit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
|
|
|
{
|
|
|
|
return vtysh_exit (vty);
|
|
|
|
}
|
|
|
|
|
|
|
|
ALIAS (vtysh_exit_interface,
|
|
|
|
vtysh_quit_interface_cmd,
|
|
|
|
"quit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
|
|
|
|
2004-08-26 15:08:30 +02:00
|
|
|
/* Logging commands. */
|
|
|
|
DEFUNSH (VTYSH_ALL,
|
|
|
|
vtysh_log_stdout,
|
|
|
|
vtysh_log_stdout_cmd,
|
|
|
|
"log stdout",
|
|
|
|
"Logging control\n"
|
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.
2004-12-07 16:39:31 +01:00
|
|
|
"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)
|
2004-08-26 15:08:30 +02:00
|
|
|
{
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_ALL,
|
|
|
|
no_vtysh_log_stdout,
|
|
|
|
no_vtysh_log_stdout_cmd,
|
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.
2004-12-07 16:39:31 +01:00
|
|
|
"no log stdout [LEVEL]",
|
2004-08-26 15:08:30 +02:00
|
|
|
NO_STR
|
|
|
|
"Logging control\n"
|
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.
2004-12-07 16:39:31 +01:00
|
|
|
"Cancel logging to stdout\n"
|
|
|
|
"Logging level\n")
|
2004-08-26 15:08:30 +02:00
|
|
|
{
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_ALL,
|
|
|
|
vtysh_log_file,
|
|
|
|
vtysh_log_file_cmd,
|
|
|
|
"log file FILENAME",
|
|
|
|
"Logging control\n"
|
|
|
|
"Logging to file\n"
|
|
|
|
"Logging filename\n")
|
|
|
|
{
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
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.
2004-12-07 16:39:31 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2004-08-26 15:08:30 +02:00
|
|
|
DEFUNSH (VTYSH_ALL,
|
|
|
|
no_vtysh_log_file,
|
|
|
|
no_vtysh_log_file_cmd,
|
|
|
|
"no log file [FILENAME]",
|
|
|
|
NO_STR
|
|
|
|
"Logging control\n"
|
|
|
|
"Cancel logging to file\n"
|
|
|
|
"Logging file name\n")
|
|
|
|
{
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
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.
2004-12-07 16:39:31 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2004-08-26 15:08:30 +02:00
|
|
|
DEFUNSH (VTYSH_ALL,
|
|
|
|
vtysh_log_syslog,
|
|
|
|
vtysh_log_syslog_cmd,
|
|
|
|
"log syslog",
|
|
|
|
"Logging control\n"
|
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.
2004-12-07 16:39:31 +01:00
|
|
|
"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)
|
2004-08-26 15:08:30 +02:00
|
|
|
{
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_ALL,
|
|
|
|
no_vtysh_log_syslog,
|
|
|
|
no_vtysh_log_syslog_cmd,
|
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.
2004-12-07 16:39:31 +01:00
|
|
|
"no log syslog [LEVEL]",
|
2004-08-26 15:08:30 +02:00
|
|
|
NO_STR
|
|
|
|
"Logging control\n"
|
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.
2004-12-07 16:39:31 +01:00
|
|
|
"Cancel logging to syslog\n"
|
|
|
|
"Logging level\n")
|
2004-08-26 15:08:30 +02:00
|
|
|
{
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_ALL,
|
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.
2004-12-07 16:39:31 +01:00
|
|
|
vtysh_log_facility,
|
|
|
|
vtysh_log_facility_cmd,
|
|
|
|
"log facility "LOG_FACILITIES,
|
2004-08-26 15:08:30 +02:00
|
|
|
"Logging control\n"
|
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.
2004-12-07 16:39:31 +01:00
|
|
|
"Facility parameter for syslog messages\n"
|
|
|
|
LOG_FACILITY_DESC)
|
|
|
|
|
2004-08-26 15:08:30 +02:00
|
|
|
{
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_ALL,
|
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.
2004-12-07 16:39:31 +01:00
|
|
|
no_vtysh_log_facility,
|
|
|
|
no_vtysh_log_facility_cmd,
|
|
|
|
"no log facility [FACILITY]",
|
2004-08-26 15:08:30 +02:00
|
|
|
NO_STR
|
|
|
|
"Logging control\n"
|
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.
2004-12-07 16:39:31 +01:00
|
|
|
"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")
|
2004-08-26 15:08:30 +02:00
|
|
|
{
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_ALL,
|
|
|
|
vtysh_log_record_priority,
|
|
|
|
vtysh_log_record_priority_cmd,
|
|
|
|
"log record-priority",
|
|
|
|
"Logging control\n"
|
|
|
|
"Log the priority of the message within the message\n")
|
|
|
|
{
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_ALL,
|
|
|
|
no_vtysh_log_record_priority,
|
|
|
|
no_vtysh_log_record_priority_cmd,
|
|
|
|
"no log record-priority",
|
|
|
|
NO_STR
|
|
|
|
"Logging control\n"
|
|
|
|
"Do not log the priority of the message within the message\n")
|
|
|
|
{
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-10-03 22:11:32 +02:00
|
|
|
DEFUNSH (VTYSH_ALL,
|
|
|
|
vtysh_service_password_encrypt,
|
|
|
|
vtysh_service_password_encrypt_cmd,
|
|
|
|
"service password-encryption",
|
|
|
|
"Set up miscellaneous service\n"
|
|
|
|
"Enable encrypted passwords\n")
|
|
|
|
{
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_ALL,
|
|
|
|
no_vtysh_service_password_encrypt,
|
|
|
|
no_vtysh_service_password_encrypt_cmd,
|
|
|
|
"no service password-encryption",
|
|
|
|
NO_STR
|
|
|
|
"Set up miscellaneous service\n"
|
|
|
|
"Enable encrypted passwords\n")
|
|
|
|
{
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_ALL,
|
|
|
|
vtysh_config_password,
|
|
|
|
vtysh_password_cmd,
|
|
|
|
"password (8|) WORD",
|
|
|
|
"Assign the terminal connection password\n"
|
|
|
|
"Specifies a HIDDEN password will follow\n"
|
|
|
|
"dummy string \n"
|
|
|
|
"The HIDDEN line password string\n")
|
|
|
|
{
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_ALL,
|
|
|
|
vtysh_password_text,
|
|
|
|
vtysh_password_text_cmd,
|
|
|
|
"password LINE",
|
|
|
|
"Assign the terminal connection password\n"
|
|
|
|
"The UNENCRYPTED (cleartext) line password\n")
|
|
|
|
{
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_ALL,
|
|
|
|
vtysh_config_enable_password,
|
|
|
|
vtysh_enable_password_cmd,
|
|
|
|
"enable password (8|) WORD",
|
|
|
|
"Modify enable password parameters\n"
|
|
|
|
"Assign the privileged level password\n"
|
|
|
|
"Specifies a HIDDEN password will follow\n"
|
|
|
|
"dummy string \n"
|
|
|
|
"The HIDDEN 'enable' password string\n")
|
|
|
|
{
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_ALL,
|
|
|
|
vtysh_enable_password_text,
|
|
|
|
vtysh_enable_password_text_cmd,
|
|
|
|
"enable password LINE",
|
|
|
|
"Modify enable password parameters\n"
|
|
|
|
"Assign the privileged level password\n"
|
|
|
|
"The UNENCRYPTED (cleartext) 'enable' password\n")
|
|
|
|
{
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH (VTYSH_ALL,
|
|
|
|
no_vtysh_config_enable_password,
|
|
|
|
no_vtysh_enable_password_cmd,
|
|
|
|
"no enable password",
|
|
|
|
NO_STR
|
|
|
|
"Modify enable password parameters\n"
|
|
|
|
"Assign the privileged level password\n")
|
|
|
|
{
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
DEFUN (vtysh_write_terminal,
|
|
|
|
vtysh_write_terminal_cmd,
|
|
|
|
"write terminal",
|
|
|
|
"Write running configuration to memory, network, or terminal\n"
|
|
|
|
"Write to terminal\n")
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
char line[] = "write terminal\n";
|
|
|
|
FILE *fp = NULL;
|
|
|
|
|
|
|
|
if (vtysh_pager_name)
|
|
|
|
{
|
2002-12-13 21:49:00 +01:00
|
|
|
fp = popen (vtysh_pager_name, "w");
|
2002-12-13 21:15:29 +01:00
|
|
|
if (fp == NULL)
|
|
|
|
{
|
|
|
|
perror ("popen");
|
|
|
|
exit (1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
fp = stdout;
|
|
|
|
|
|
|
|
vty_out (vty, "Building configuration...%s", VTY_NEWLINE);
|
|
|
|
vty_out (vty, "%sCurrent configuration:%s", VTY_NEWLINE,
|
|
|
|
VTY_NEWLINE);
|
2004-10-03 22:11:32 +02:00
|
|
|
vty_out (vty, "!%s", VTY_NEWLINE);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
ret = vtysh_client_config (&vtysh_client[VTYSH_INDEX_ZEBRA], line);
|
|
|
|
ret = vtysh_client_config (&vtysh_client[VTYSH_INDEX_RIP], line);
|
|
|
|
ret = vtysh_client_config (&vtysh_client[VTYSH_INDEX_RIPNG], line);
|
|
|
|
ret = vtysh_client_config (&vtysh_client[VTYSH_INDEX_OSPF], line);
|
|
|
|
ret = vtysh_client_config (&vtysh_client[VTYSH_INDEX_OSPF6], line);
|
|
|
|
ret = vtysh_client_config (&vtysh_client[VTYSH_INDEX_BGP], line);
|
2003-12-23 11:39:08 +01:00
|
|
|
ret = vtysh_client_config (&vtysh_client[VTYSH_INDEX_ISIS], line);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2004-10-03 22:11:32 +02:00
|
|
|
/* Integrate vtysh specific configuration. */
|
|
|
|
vtysh_config_write ();
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
vtysh_config_dump (fp);
|
|
|
|
|
|
|
|
if (vtysh_pager_name && fp)
|
|
|
|
{
|
|
|
|
fflush (fp);
|
|
|
|
if (pclose (fp) == -1)
|
|
|
|
{
|
|
|
|
perror ("pclose");
|
|
|
|
exit (1);
|
|
|
|
}
|
|
|
|
fp = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-10-03 22:11:32 +02:00
|
|
|
DEFUN (vtysh_integrated_config,
|
|
|
|
vtysh_integrated_config_cmd,
|
|
|
|
"service integrated-vtysh-config",
|
|
|
|
"Set up miscellaneous service\n"
|
|
|
|
"Write configuration into integrated file\n")
|
2002-12-13 21:49:00 +01:00
|
|
|
{
|
2004-10-03 22:11:32 +02:00
|
|
|
vtysh_writeconfig_integrated = 1;
|
|
|
|
return CMD_SUCCESS;
|
2002-12-13 21:49:00 +01:00
|
|
|
}
|
|
|
|
|
2004-10-03 22:11:32 +02:00
|
|
|
DEFUN (no_vtysh_integrated_config,
|
|
|
|
no_vtysh_integrated_config_cmd,
|
|
|
|
"no service integrated-vtysh-config",
|
|
|
|
NO_STR
|
|
|
|
"Set up miscellaneous service\n"
|
|
|
|
"Write configuration into integrated file\n")
|
2002-12-13 21:49:00 +01:00
|
|
|
{
|
2004-10-03 22:11:32 +02:00
|
|
|
vtysh_writeconfig_integrated = 0;
|
|
|
|
return CMD_SUCCESS;
|
2002-12-13 21:49:00 +01: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.
2004-12-07 16:39:31 +01:00
|
|
|
static int
|
|
|
|
write_config_integrated(void)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
char line[] = "write terminal\n";
|
|
|
|
FILE *fp;
|
|
|
|
char *integrate_sav = NULL;
|
|
|
|
|
2004-08-26 15:08:30 +02:00
|
|
|
integrate_sav = malloc (strlen (integrate_default) +
|
|
|
|
strlen (CONF_BACKUP_EXT) + 1);
|
2002-12-13 21:15:29 +01:00
|
|
|
strcpy (integrate_sav, integrate_default);
|
|
|
|
strcat (integrate_sav, CONF_BACKUP_EXT);
|
|
|
|
|
2002-12-13 21:49:00 +01:00
|
|
|
fprintf (stdout,"Building Configuration...\n");
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2004-08-26 15:08:30 +02:00
|
|
|
/* Move current configuration file to backup config file. */
|
2002-12-13 21:15:29 +01:00
|
|
|
unlink (integrate_sav);
|
|
|
|
rename (integrate_default, integrate_sav);
|
2004-08-26 15:08:30 +02:00
|
|
|
free (integrate_sav);
|
2002-12-13 21:49:00 +01:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
fp = fopen (integrate_default, "w");
|
|
|
|
if (fp == NULL)
|
|
|
|
{
|
2004-08-26 15:08:30 +02:00
|
|
|
fprintf (stdout,"%% Can't open configuration file %s.\n",
|
|
|
|
integrate_default);
|
2002-12-13 21:15:29 +01:00
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = vtysh_client_config (&vtysh_client[VTYSH_INDEX_ZEBRA], line);
|
|
|
|
ret = vtysh_client_config (&vtysh_client[VTYSH_INDEX_RIP], line);
|
|
|
|
ret = vtysh_client_config (&vtysh_client[VTYSH_INDEX_RIPNG], line);
|
|
|
|
ret = vtysh_client_config (&vtysh_client[VTYSH_INDEX_OSPF], line);
|
|
|
|
ret = vtysh_client_config (&vtysh_client[VTYSH_INDEX_OSPF6], line);
|
|
|
|
ret = vtysh_client_config (&vtysh_client[VTYSH_INDEX_BGP], line);
|
2003-12-23 11:39:08 +01:00
|
|
|
ret = vtysh_client_config (&vtysh_client[VTYSH_INDEX_ISIS], line);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
vtysh_config_dump (fp);
|
|
|
|
|
|
|
|
fclose (fp);
|
|
|
|
|
2003-12-22 21:15:53 +01:00
|
|
|
if (chmod (integrate_default, CONFIGFILE_MASK) != 0)
|
|
|
|
{
|
|
|
|
fprintf (stdout,"%% Can't chmod configuration file %s: %s (%d)\n",
|
2004-11-20 03:06:59 +01:00
|
|
|
integrate_default, safe_strerror(errno), errno);
|
2003-12-22 21:15:53 +01:00
|
|
|
return CMD_WARNING;
|
|
|
|
}
|
|
|
|
|
2002-12-13 21:49:00 +01:00
|
|
|
fprintf(stdout,"Integrated configuration saved to %s\n",integrate_default);
|
|
|
|
|
|
|
|
fprintf (stdout,"[OK]\n");
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2002-12-13 21:49:00 +01:00
|
|
|
DEFUN (vtysh_write_memory,
|
|
|
|
vtysh_write_memory_cmd,
|
|
|
|
"write memory",
|
|
|
|
"Write running configuration to memory, network, or terminal\n"
|
|
|
|
"Write configuration to the file (same as write file)\n")
|
|
|
|
{
|
2003-04-19 01:55:29 +02:00
|
|
|
int ret = CMD_SUCCESS;
|
2002-12-13 21:49:00 +01:00
|
|
|
char line[] = "write memory\n";
|
|
|
|
|
2004-10-03 22:11:32 +02:00
|
|
|
/* If integrated Quagga.conf explicitely set. */
|
|
|
|
if (vtysh_writeconfig_integrated)
|
|
|
|
return write_config_integrated();
|
2002-12-13 21:49:00 +01:00
|
|
|
|
|
|
|
fprintf (stdout,"Building Configuration...\n");
|
|
|
|
|
|
|
|
ret = vtysh_client_execute (&vtysh_client[VTYSH_INDEX_ZEBRA], line, stdout);
|
|
|
|
ret = vtysh_client_execute (&vtysh_client[VTYSH_INDEX_RIP], line, stdout);
|
|
|
|
ret = vtysh_client_execute (&vtysh_client[VTYSH_INDEX_RIPNG], line, stdout);
|
|
|
|
ret = vtysh_client_execute (&vtysh_client[VTYSH_INDEX_OSPF], line, stdout);
|
|
|
|
ret = vtysh_client_execute (&vtysh_client[VTYSH_INDEX_OSPF6], line, stdout);
|
|
|
|
ret = vtysh_client_execute (&vtysh_client[VTYSH_INDEX_BGP], line, stdout);
|
2003-12-23 11:39:08 +01:00
|
|
|
ret = vtysh_client_execute (&vtysh_client[VTYSH_INDEX_ISIS], line, stdout);
|
2004-10-03 22:11:32 +02:00
|
|
|
|
2002-12-13 21:49:00 +01:00
|
|
|
fprintf (stdout,"[OK]\n");
|
|
|
|
|
2003-04-19 01:55:29 +02:00
|
|
|
return ret;
|
2002-12-13 21:49:00 +01:00
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
ALIAS (vtysh_write_memory,
|
|
|
|
vtysh_copy_runningconfig_startupconfig_cmd,
|
|
|
|
"copy running-config startup-config",
|
|
|
|
"Copy from one file to another\n"
|
|
|
|
"Copy from current system configuration\n"
|
|
|
|
"Copy to startup configuration\n")
|
|
|
|
|
|
|
|
ALIAS (vtysh_write_memory,
|
|
|
|
vtysh_write_file_cmd,
|
|
|
|
"write file",
|
|
|
|
"Write running configuration to memory, network, or terminal\n"
|
|
|
|
"Write configuration to the file (same as write memory)\n")
|
|
|
|
|
2003-05-25 13:51:29 +02:00
|
|
|
ALIAS (vtysh_write_memory,
|
|
|
|
vtysh_write_cmd,
|
|
|
|
"write",
|
|
|
|
"Write running configuration to memory, network, or terminal\n")
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
ALIAS (vtysh_write_terminal,
|
|
|
|
vtysh_show_running_config_cmd,
|
|
|
|
"show running-config",
|
|
|
|
SHOW_STR
|
|
|
|
"Current operating configuration\n")
|
2004-08-25 14:22:00 +02:00
|
|
|
|
2004-08-27 15:56:39 +02:00
|
|
|
DEFUN (vtysh_terminal_length,
|
|
|
|
vtysh_terminal_length_cmd,
|
|
|
|
"terminal length <0-512>",
|
|
|
|
"Set terminal line parameters\n"
|
|
|
|
"Set number of lines on a screen\n"
|
|
|
|
"Number of lines on screen (0 for no pausing)\n")
|
|
|
|
{
|
|
|
|
int lines;
|
|
|
|
char *endptr = NULL;
|
|
|
|
char default_pager[10];
|
|
|
|
|
|
|
|
lines = strtol (argv[0], &endptr, 10);
|
|
|
|
if (lines < 0 || lines > 512 || *endptr != '\0')
|
|
|
|
{
|
|
|
|
vty_out (vty, "length is malformed%s", VTY_NEWLINE);
|
|
|
|
return CMD_WARNING;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (vtysh_pager_name)
|
|
|
|
{
|
|
|
|
free (vtysh_pager_name);
|
|
|
|
vtysh_pager_name = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lines != 0)
|
|
|
|
{
|
|
|
|
snprintf(default_pager, 10, "more -%i", lines);
|
|
|
|
vtysh_pager_name = strdup (default_pager);
|
|
|
|
}
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUN (vtysh_terminal_no_length,
|
|
|
|
vtysh_terminal_no_length_cmd,
|
|
|
|
"terminal no length",
|
|
|
|
"Set terminal line parameters\n"
|
|
|
|
NO_STR
|
|
|
|
"Set number of lines on a screen\n")
|
|
|
|
{
|
|
|
|
if (vtysh_pager_name)
|
|
|
|
{
|
|
|
|
free (vtysh_pager_name);
|
|
|
|
vtysh_pager_name = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
vtysh_pager_init();
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-10-28 19:43:11 +02:00
|
|
|
DEFUN (vtysh_show_daemons,
|
|
|
|
vtysh_show_daemons_cmd,
|
|
|
|
"show daemons",
|
2004-10-03 22:11:32 +02:00
|
|
|
SHOW_STR
|
|
|
|
"Show list of running daemons\n")
|
|
|
|
{
|
|
|
|
if ( vtysh_client[VTYSH_INDEX_ZEBRA].fd > 0 )
|
|
|
|
vty_out(vty, " zebra");
|
|
|
|
if ( vtysh_client[VTYSH_INDEX_RIP].fd > 0 )
|
|
|
|
vty_out(vty, " ripd");
|
|
|
|
if ( vtysh_client[VTYSH_INDEX_RIPNG].fd > 0 )
|
|
|
|
vty_out(vty, " ripngd");
|
|
|
|
if ( vtysh_client[VTYSH_INDEX_OSPF].fd > 0 )
|
|
|
|
vty_out(vty, " ospfd");
|
|
|
|
if ( vtysh_client[VTYSH_INDEX_OSPF6].fd > 0 )
|
|
|
|
vty_out(vty, " ospf6d");
|
|
|
|
if ( vtysh_client[VTYSH_INDEX_BGP].fd > 0 )
|
|
|
|
vty_out(vty, " bgpd");
|
|
|
|
if ( vtysh_client[VTYSH_INDEX_ISIS].fd > 0 )
|
|
|
|
vty_out(vty, " isisd");
|
|
|
|
vty_out(vty, "%s", VTY_NEWLINE);
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Execute command in child process. */
|
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.
2004-12-07 16:39:31 +01:00
|
|
|
static int
|
2004-10-11 15:20:40 +02:00
|
|
|
execute_command (const char *command, int argc, const char *arg1,
|
|
|
|
const char *arg2)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
pid_t pid;
|
|
|
|
int status;
|
|
|
|
|
|
|
|
/* Call fork(). */
|
|
|
|
pid = fork ();
|
|
|
|
|
|
|
|
if (pid < 0)
|
|
|
|
{
|
|
|
|
/* Failure of fork(). */
|
2004-11-20 03:06:59 +01:00
|
|
|
fprintf (stderr, "Can't fork: %s\n", safe_strerror (errno));
|
2002-12-13 21:15:29 +01:00
|
|
|
exit (1);
|
|
|
|
}
|
|
|
|
else if (pid == 0)
|
|
|
|
{
|
|
|
|
/* This is child process. */
|
|
|
|
switch (argc)
|
|
|
|
{
|
|
|
|
case 0:
|
2004-03-04 18:45:00 +01:00
|
|
|
ret = execlp (command, command, (const char *)NULL);
|
2002-12-13 21:15:29 +01:00
|
|
|
break;
|
|
|
|
case 1:
|
2004-03-04 18:45:00 +01:00
|
|
|
ret = execlp (command, command, arg1, (const char *)NULL);
|
2002-12-13 21:15:29 +01:00
|
|
|
break;
|
|
|
|
case 2:
|
2004-03-04 18:45:00 +01:00
|
|
|
ret = execlp (command, command, arg1, arg2, (const char *)NULL);
|
2002-12-13 21:15:29 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* When execlp suceed, this part is not executed. */
|
2004-11-20 03:06:59 +01:00
|
|
|
fprintf (stderr, "Can't execute %s: %s\n", command, safe_strerror (errno));
|
2002-12-13 21:15:29 +01:00
|
|
|
exit (1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* This is parent. */
|
|
|
|
execute_flag = 1;
|
|
|
|
ret = wait4 (pid, &status, 0, NULL);
|
|
|
|
execute_flag = 0;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUN (vtysh_ping,
|
|
|
|
vtysh_ping_cmd,
|
|
|
|
"ping WORD",
|
2003-06-25 12:49:55 +02:00
|
|
|
"Send echo messages\n"
|
2002-12-13 21:15:29 +01:00
|
|
|
"Ping destination address or hostname\n")
|
|
|
|
{
|
|
|
|
execute_command ("ping", 1, argv[0], NULL);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2003-06-25 12:49:55 +02:00
|
|
|
ALIAS (vtysh_ping,
|
|
|
|
vtysh_ping_ip_cmd,
|
|
|
|
"ping ip WORD",
|
|
|
|
"Send echo messages\n"
|
|
|
|
"IP echo\n"
|
|
|
|
"Ping destination address or hostname\n")
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
DEFUN (vtysh_traceroute,
|
|
|
|
vtysh_traceroute_cmd,
|
|
|
|
"traceroute WORD",
|
|
|
|
"Trace route to destination\n"
|
|
|
|
"Trace route to destination address or hostname\n")
|
|
|
|
{
|
|
|
|
execute_command ("traceroute", 1, argv[0], NULL);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2003-06-25 12:49:55 +02:00
|
|
|
ALIAS (vtysh_traceroute,
|
|
|
|
vtysh_traceroute_ip_cmd,
|
|
|
|
"traceroute ip WORD",
|
|
|
|
"Trace route to destination\n"
|
|
|
|
"IP trace\n"
|
|
|
|
"Trace route to destination address or hostname\n")
|
|
|
|
|
|
|
|
#ifdef HAVE_IPV6
|
|
|
|
DEFUN (vtysh_ping6,
|
|
|
|
vtysh_ping6_cmd,
|
|
|
|
"ping ipv6 WORD",
|
|
|
|
"Send echo messages\n"
|
|
|
|
"IPv6 echo\n"
|
|
|
|
"Ping destination address or hostname\n")
|
|
|
|
{
|
|
|
|
execute_command ("ping6", 1, argv[0], NULL);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUN (vtysh_traceroute6,
|
|
|
|
vtysh_traceroute6_cmd,
|
|
|
|
"traceroute ipv6 WORD",
|
|
|
|
"Trace route to destination\n"
|
|
|
|
"IPv6 trace\n"
|
|
|
|
"Trace route to destination address or hostname\n")
|
|
|
|
{
|
|
|
|
execute_command ("traceroute6", 1, argv[0], NULL);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
DEFUN (vtysh_telnet,
|
|
|
|
vtysh_telnet_cmd,
|
|
|
|
"telnet WORD",
|
|
|
|
"Open a telnet connection\n"
|
|
|
|
"IP address or hostname of a remote system\n")
|
|
|
|
{
|
|
|
|
execute_command ("telnet", 1, argv[0], NULL);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUN (vtysh_telnet_port,
|
|
|
|
vtysh_telnet_port_cmd,
|
|
|
|
"telnet WORD PORT",
|
|
|
|
"Open a telnet connection\n"
|
|
|
|
"IP address or hostname of a remote system\n"
|
|
|
|
"TCP Port number\n")
|
|
|
|
{
|
|
|
|
execute_command ("telnet", 2, argv[0], argv[1]);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2003-01-25 07:56:09 +01:00
|
|
|
DEFUN (vtysh_ssh,
|
|
|
|
vtysh_ssh_cmd,
|
|
|
|
"ssh WORD",
|
|
|
|
"Open an ssh connection\n"
|
|
|
|
"[user@]host\n")
|
|
|
|
{
|
|
|
|
execute_command ("ssh", 1, argv[0], NULL);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
DEFUN (vtysh_start_shell,
|
|
|
|
vtysh_start_shell_cmd,
|
|
|
|
"start-shell",
|
|
|
|
"Start UNIX shell\n")
|
|
|
|
{
|
|
|
|
execute_command ("sh", 0, NULL, NULL);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUN (vtysh_start_bash,
|
|
|
|
vtysh_start_bash_cmd,
|
|
|
|
"start-shell bash",
|
|
|
|
"Start UNIX shell\n"
|
|
|
|
"Start bash\n")
|
|
|
|
{
|
|
|
|
execute_command ("bash", 0, NULL, NULL);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUN (vtysh_start_zsh,
|
|
|
|
vtysh_start_zsh_cmd,
|
|
|
|
"start-shell zsh",
|
|
|
|
"Start UNIX shell\n"
|
|
|
|
"Start Z shell\n")
|
|
|
|
{
|
|
|
|
execute_command ("zsh", 0, NULL, NULL);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
2004-08-25 14:22:00 +02: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.
2004-12-07 16:39:31 +01:00
|
|
|
static void
|
2002-12-13 21:15:29 +01:00
|
|
|
vtysh_install_default (enum node_type node)
|
|
|
|
{
|
|
|
|
install_element (node, &config_list_cmd);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Making connection to protocol daemon. */
|
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.
2004-12-07 16:39:31 +01:00
|
|
|
static int
|
2004-10-07 23:40:25 +02:00
|
|
|
vtysh_connect (struct vtysh_client *vclient, const char *path)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
int sock, len;
|
|
|
|
struct sockaddr_un addr;
|
|
|
|
struct stat s_stat;
|
|
|
|
|
|
|
|
memset (vclient, 0, sizeof (struct vtysh_client));
|
|
|
|
vclient->fd = -1;
|
|
|
|
|
|
|
|
/* Stat socket to see if we have permission to access it. */
|
|
|
|
ret = stat (path, &s_stat);
|
|
|
|
if (ret < 0 && errno != ENOENT)
|
|
|
|
{
|
|
|
|
fprintf (stderr, "vtysh_connect(%s): stat = %s\n",
|
2004-11-20 03:06:59 +01:00
|
|
|
path, safe_strerror(errno));
|
2002-12-13 21:15:29 +01:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ret >= 0)
|
|
|
|
{
|
|
|
|
if (! S_ISSOCK(s_stat.st_mode))
|
|
|
|
{
|
|
|
|
fprintf (stderr, "vtysh_connect(%s): Not a socket\n",
|
|
|
|
path);
|
|
|
|
exit (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
sock = socket (AF_UNIX, SOCK_STREAM, 0);
|
|
|
|
if (sock < 0)
|
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
2004-08-26 15:08:30 +02:00
|
|
|
fprintf(stderr, "vtysh_connect(%s): socket = %s\n", path,
|
2004-11-20 03:06:59 +01:00
|
|
|
safe_strerror(errno));
|
2002-12-13 21:15:29 +01:00
|
|
|
#endif /* DEBUG */
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
memset (&addr, 0, sizeof (struct sockaddr_un));
|
|
|
|
addr.sun_family = AF_UNIX;
|
|
|
|
strncpy (addr.sun_path, path, strlen (path));
|
|
|
|
#ifdef HAVE_SUN_LEN
|
|
|
|
len = addr.sun_len = SUN_LEN(&addr);
|
|
|
|
#else
|
|
|
|
len = sizeof (addr.sun_family) + strlen (addr.sun_path);
|
|
|
|
#endif /* HAVE_SUN_LEN */
|
|
|
|
|
|
|
|
ret = connect (sock, (struct sockaddr *) &addr, len);
|
|
|
|
if (ret < 0)
|
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
2004-08-26 15:08:30 +02:00
|
|
|
fprintf(stderr, "vtysh_connect(%s): connect = %s\n", path,
|
2004-11-20 03:06:59 +01:00
|
|
|
safe_strerror(errno));
|
2002-12-13 21:15:29 +01:00
|
|
|
#endif /* DEBUG */
|
|
|
|
close (sock);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
vclient->fd = sock;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
vtysh_connect_all()
|
|
|
|
{
|
|
|
|
/* Clear each daemons client structure. */
|
2003-04-07 18:10:05 +02:00
|
|
|
vtysh_connect (&vtysh_client[VTYSH_INDEX_ZEBRA], ZEBRA_VTYSH_PATH);
|
|
|
|
vtysh_connect (&vtysh_client[VTYSH_INDEX_RIP], RIP_VTYSH_PATH);
|
|
|
|
vtysh_connect (&vtysh_client[VTYSH_INDEX_RIPNG], RIPNG_VTYSH_PATH);
|
|
|
|
vtysh_connect (&vtysh_client[VTYSH_INDEX_OSPF], OSPF_VTYSH_PATH);
|
|
|
|
vtysh_connect (&vtysh_client[VTYSH_INDEX_OSPF6], OSPF6_VTYSH_PATH);
|
|
|
|
vtysh_connect (&vtysh_client[VTYSH_INDEX_BGP], BGP_VTYSH_PATH);
|
2003-12-23 11:39:08 +01:00
|
|
|
vtysh_connect (&vtysh_client[VTYSH_INDEX_ISIS], ISIS_VTYSH_PATH);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2004-08-26 15:08:30 +02:00
|
|
|
/* To disable readline's filename completion. */
|
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.
2004-12-07 16:39:31 +01:00
|
|
|
static char *
|
2003-04-19 01:55:29 +02:00
|
|
|
vtysh_completion_entry_function (const char *ignore, int invoking_key)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2003-04-19 01:55:29 +02:00
|
|
|
return NULL;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
vtysh_readline_init ()
|
|
|
|
{
|
|
|
|
/* readline related settings. */
|
|
|
|
rl_bind_key ('?', vtysh_rl_describe);
|
2003-03-25 06:07:42 +01:00
|
|
|
rl_completion_entry_function = vtysh_completion_entry_function;
|
2002-12-13 21:15:29 +01:00
|
|
|
rl_attempted_completion_function = (CPPFunction *)new_completion;
|
|
|
|
/* do not append space after completion. It will be appended
|
2004-08-26 15:08:30 +02:00
|
|
|
* in new_completion() function explicitly. */
|
2002-12-13 21:15:29 +01:00
|
|
|
rl_completion_append_character = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
char *
|
|
|
|
vtysh_prompt ()
|
|
|
|
{
|
|
|
|
struct utsname names;
|
|
|
|
static char buf[100];
|
|
|
|
const char*hostname;
|
|
|
|
extern struct host host;
|
|
|
|
|
|
|
|
hostname = host.name;
|
|
|
|
|
|
|
|
if (!hostname)
|
|
|
|
{
|
|
|
|
uname (&names);
|
|
|
|
hostname = names.nodename;
|
|
|
|
}
|
|
|
|
|
|
|
|
snprintf (buf, sizeof buf, cmd_prompt (vty->node), hostname);
|
|
|
|
|
|
|
|
return buf;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
vtysh_init_vty ()
|
|
|
|
{
|
|
|
|
/* Make vty structure. */
|
|
|
|
vty = vty_new ();
|
|
|
|
vty->type = VTY_SHELL;
|
|
|
|
vty->node = VIEW_NODE;
|
|
|
|
|
|
|
|
/* Initialize commands. */
|
|
|
|
cmd_init (0);
|
|
|
|
|
|
|
|
/* Install nodes. */
|
|
|
|
install_node (&bgp_node, NULL);
|
|
|
|
install_node (&rip_node, NULL);
|
|
|
|
install_node (&interface_node, NULL);
|
|
|
|
install_node (&rmap_node, NULL);
|
|
|
|
install_node (&zebra_node, NULL);
|
|
|
|
install_node (&bgp_vpnv4_node, NULL);
|
|
|
|
install_node (&bgp_ipv4_node, NULL);
|
|
|
|
install_node (&bgp_ipv4m_node, NULL);
|
|
|
|
/* #ifdef HAVE_IPV6 */
|
|
|
|
install_node (&bgp_ipv6_node, NULL);
|
|
|
|
/* #endif */
|
|
|
|
install_node (&ospf_node, NULL);
|
|
|
|
/* #ifdef HAVE_IPV6 */
|
|
|
|
install_node (&ripng_node, NULL);
|
|
|
|
install_node (&ospf6_node, NULL);
|
|
|
|
/* #endif */
|
|
|
|
install_node (&keychain_node, NULL);
|
|
|
|
install_node (&keychain_key_node, NULL);
|
2003-12-23 11:39:08 +01:00
|
|
|
install_node (&isis_node, NULL);
|
2004-10-03 22:11:32 +02:00
|
|
|
install_node (&vty_node, NULL);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
vtysh_install_default (VIEW_NODE);
|
|
|
|
vtysh_install_default (ENABLE_NODE);
|
|
|
|
vtysh_install_default (CONFIG_NODE);
|
|
|
|
vtysh_install_default (BGP_NODE);
|
|
|
|
vtysh_install_default (RIP_NODE);
|
|
|
|
vtysh_install_default (INTERFACE_NODE);
|
|
|
|
vtysh_install_default (RMAP_NODE);
|
|
|
|
vtysh_install_default (ZEBRA_NODE);
|
|
|
|
vtysh_install_default (BGP_VPNV4_NODE);
|
|
|
|
vtysh_install_default (BGP_IPV4_NODE);
|
|
|
|
vtysh_install_default (BGP_IPV4M_NODE);
|
|
|
|
vtysh_install_default (BGP_IPV6_NODE);
|
|
|
|
vtysh_install_default (OSPF_NODE);
|
|
|
|
vtysh_install_default (RIPNG_NODE);
|
|
|
|
vtysh_install_default (OSPF6_NODE);
|
2003-12-23 11:39:08 +01:00
|
|
|
vtysh_install_default (ISIS_NODE);
|
2002-12-13 21:15:29 +01:00
|
|
|
vtysh_install_default (KEYCHAIN_NODE);
|
|
|
|
vtysh_install_default (KEYCHAIN_KEY_NODE);
|
2004-10-03 22:11:32 +02:00
|
|
|
vtysh_install_default (VTY_NODE);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
install_element (VIEW_NODE, &vtysh_enable_cmd);
|
|
|
|
install_element (ENABLE_NODE, &vtysh_config_terminal_cmd);
|
|
|
|
install_element (ENABLE_NODE, &vtysh_disable_cmd);
|
|
|
|
|
|
|
|
/* "exit" command. */
|
|
|
|
install_element (VIEW_NODE, &vtysh_exit_all_cmd);
|
|
|
|
install_element (VIEW_NODE, &vtysh_quit_all_cmd);
|
|
|
|
install_element (CONFIG_NODE, &vtysh_exit_all_cmd);
|
|
|
|
/* install_element (CONFIG_NODE, &vtysh_quit_all_cmd); */
|
|
|
|
install_element (ENABLE_NODE, &vtysh_exit_all_cmd);
|
|
|
|
install_element (ENABLE_NODE, &vtysh_quit_all_cmd);
|
|
|
|
install_element (RIP_NODE, &vtysh_exit_ripd_cmd);
|
|
|
|
install_element (RIP_NODE, &vtysh_quit_ripd_cmd);
|
2003-03-25 06:07:42 +01:00
|
|
|
install_element (RIPNG_NODE, &vtysh_exit_ripngd_cmd);
|
|
|
|
install_element (RIPNG_NODE, &vtysh_quit_ripngd_cmd);
|
2002-12-13 21:15:29 +01:00
|
|
|
install_element (OSPF_NODE, &vtysh_exit_ospfd_cmd);
|
|
|
|
install_element (OSPF_NODE, &vtysh_quit_ospfd_cmd);
|
2003-03-25 06:07:42 +01:00
|
|
|
install_element (OSPF6_NODE, &vtysh_exit_ospf6d_cmd);
|
|
|
|
install_element (OSPF6_NODE, &vtysh_quit_ospf6d_cmd);
|
2002-12-13 21:15:29 +01:00
|
|
|
install_element (BGP_NODE, &vtysh_exit_bgpd_cmd);
|
|
|
|
install_element (BGP_NODE, &vtysh_quit_bgpd_cmd);
|
|
|
|
install_element (BGP_VPNV4_NODE, &vtysh_exit_bgpd_cmd);
|
|
|
|
install_element (BGP_VPNV4_NODE, &vtysh_quit_bgpd_cmd);
|
|
|
|
install_element (BGP_IPV4_NODE, &vtysh_exit_bgpd_cmd);
|
|
|
|
install_element (BGP_IPV4_NODE, &vtysh_quit_bgpd_cmd);
|
|
|
|
install_element (BGP_IPV4M_NODE, &vtysh_exit_bgpd_cmd);
|
|
|
|
install_element (BGP_IPV4M_NODE, &vtysh_quit_bgpd_cmd);
|
|
|
|
install_element (BGP_IPV6_NODE, &vtysh_exit_bgpd_cmd);
|
|
|
|
install_element (BGP_IPV6_NODE, &vtysh_quit_bgpd_cmd);
|
2003-12-23 11:39:08 +01:00
|
|
|
install_element (ISIS_NODE, &vtysh_exit_isisd_cmd);
|
|
|
|
install_element (ISIS_NODE, &vtysh_quit_isisd_cmd);
|
2002-12-13 21:15:29 +01:00
|
|
|
install_element (KEYCHAIN_NODE, &vtysh_exit_ripd_cmd);
|
|
|
|
install_element (KEYCHAIN_NODE, &vtysh_quit_ripd_cmd);
|
|
|
|
install_element (KEYCHAIN_KEY_NODE, &vtysh_exit_ripd_cmd);
|
|
|
|
install_element (KEYCHAIN_KEY_NODE, &vtysh_quit_ripd_cmd);
|
|
|
|
install_element (RMAP_NODE, &vtysh_exit_rmap_cmd);
|
|
|
|
install_element (RMAP_NODE, &vtysh_quit_rmap_cmd);
|
2004-10-03 22:11:32 +02:00
|
|
|
install_element (VTY_NODE, &vtysh_exit_line_vty_cmd);
|
|
|
|
install_element (VTY_NODE, &vtysh_quit_line_vty_cmd);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* "end" command. */
|
|
|
|
install_element (CONFIG_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element (ENABLE_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element (RIP_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element (RIPNG_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element (OSPF_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element (OSPF6_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element (BGP_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element (BGP_IPV4_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element (BGP_IPV4M_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element (BGP_VPNV4_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element (BGP_IPV6_NODE, &vtysh_end_all_cmd);
|
2003-12-23 11:39:08 +01:00
|
|
|
install_element (ISIS_NODE, &vtysh_end_all_cmd);
|
2002-12-13 21:15:29 +01:00
|
|
|
install_element (KEYCHAIN_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element (KEYCHAIN_KEY_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element (RMAP_NODE, &vtysh_end_all_cmd);
|
2004-10-03 22:11:32 +02:00
|
|
|
install_element (VTY_NODE, &vtysh_end_all_cmd);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2003-03-01 16:44:10 +01:00
|
|
|
install_element (INTERFACE_NODE, &interface_desc_cmd);
|
2003-03-28 03:25:45 +01:00
|
|
|
install_element (INTERFACE_NODE, &no_interface_desc_cmd);
|
2002-12-13 21:15:29 +01:00
|
|
|
install_element (INTERFACE_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element (INTERFACE_NODE, &vtysh_exit_interface_cmd);
|
|
|
|
install_element (INTERFACE_NODE, &vtysh_quit_interface_cmd);
|
|
|
|
install_element (CONFIG_NODE, &router_rip_cmd);
|
|
|
|
#ifdef HAVE_IPV6
|
|
|
|
install_element (CONFIG_NODE, &router_ripng_cmd);
|
|
|
|
#endif
|
|
|
|
install_element (CONFIG_NODE, &router_ospf_cmd);
|
|
|
|
#ifdef HAVE_IPV6
|
|
|
|
install_element (CONFIG_NODE, &router_ospf6_cmd);
|
|
|
|
#endif
|
2003-12-23 11:39:08 +01:00
|
|
|
install_element (CONFIG_NODE, &router_isis_cmd);
|
2002-12-13 21:15:29 +01:00
|
|
|
install_element (CONFIG_NODE, &router_bgp_cmd);
|
|
|
|
install_element (BGP_NODE, &address_family_vpnv4_cmd);
|
|
|
|
install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
|
|
|
|
install_element (BGP_NODE, &address_family_ipv4_unicast_cmd);
|
|
|
|
install_element (BGP_NODE, &address_family_ipv4_multicast_cmd);
|
|
|
|
#ifdef HAVE_IPV6
|
|
|
|
install_element (BGP_NODE, &address_family_ipv6_cmd);
|
|
|
|
install_element (BGP_NODE, &address_family_ipv6_unicast_cmd);
|
|
|
|
#endif
|
|
|
|
install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
|
|
|
|
install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
|
|
|
|
install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
|
|
|
|
install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
|
|
|
|
install_element (CONFIG_NODE, &key_chain_cmd);
|
|
|
|
install_element (CONFIG_NODE, &route_map_cmd);
|
2004-10-03 22:11:32 +02:00
|
|
|
install_element (CONFIG_NODE, &vtysh_line_vty_cmd);
|
2002-12-13 21:15:29 +01:00
|
|
|
install_element (KEYCHAIN_NODE, &key_cmd);
|
|
|
|
install_element (KEYCHAIN_NODE, &key_chain_cmd);
|
|
|
|
install_element (KEYCHAIN_KEY_NODE, &key_chain_cmd);
|
|
|
|
install_element (CONFIG_NODE, &vtysh_interface_cmd);
|
2003-05-23 11:25:20 +02:00
|
|
|
install_element (CONFIG_NODE, &vtysh_no_interface_cmd);
|
2002-12-13 21:15:29 +01:00
|
|
|
install_element (ENABLE_NODE, &vtysh_show_running_config_cmd);
|
|
|
|
install_element (ENABLE_NODE, &vtysh_copy_runningconfig_startupconfig_cmd);
|
|
|
|
install_element (ENABLE_NODE, &vtysh_write_file_cmd);
|
2003-05-25 13:51:29 +02:00
|
|
|
install_element (ENABLE_NODE, &vtysh_write_cmd);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2004-08-26 15:08:30 +02:00
|
|
|
/* "write terminal" command. */
|
2002-12-13 21:15:29 +01:00
|
|
|
install_element (ENABLE_NODE, &vtysh_write_terminal_cmd);
|
2004-10-03 22:11:32 +02:00
|
|
|
|
|
|
|
install_element (CONFIG_NODE, &vtysh_integrated_config_cmd);
|
|
|
|
install_element (CONFIG_NODE, &no_vtysh_integrated_config_cmd);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2004-08-26 15:08:30 +02:00
|
|
|
/* "write memory" command. */
|
2002-12-13 21:15:29 +01:00
|
|
|
install_element (ENABLE_NODE, &vtysh_write_memory_cmd);
|
|
|
|
|
2004-08-27 15:56:39 +02:00
|
|
|
install_element (VIEW_NODE, &vtysh_terminal_length_cmd);
|
|
|
|
install_element (ENABLE_NODE, &vtysh_terminal_length_cmd);
|
|
|
|
install_element (VIEW_NODE, &vtysh_terminal_no_length_cmd);
|
|
|
|
install_element (ENABLE_NODE, &vtysh_terminal_no_length_cmd);
|
2004-10-28 19:43:11 +02:00
|
|
|
install_element (VIEW_NODE, &vtysh_show_daemons_cmd);
|
|
|
|
install_element (ENABLE_NODE, &vtysh_show_daemons_cmd);
|
2004-08-27 15:56:39 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
install_element (VIEW_NODE, &vtysh_ping_cmd);
|
2003-06-25 12:49:55 +02:00
|
|
|
install_element (VIEW_NODE, &vtysh_ping_ip_cmd);
|
2002-12-13 21:15:29 +01:00
|
|
|
install_element (VIEW_NODE, &vtysh_traceroute_cmd);
|
2003-06-25 12:49:55 +02:00
|
|
|
install_element (VIEW_NODE, &vtysh_traceroute_ip_cmd);
|
|
|
|
#ifdef HAVE_IPV6
|
|
|
|
install_element (VIEW_NODE, &vtysh_ping6_cmd);
|
|
|
|
install_element (VIEW_NODE, &vtysh_traceroute6_cmd);
|
|
|
|
#endif
|
2002-12-13 21:15:29 +01:00
|
|
|
install_element (VIEW_NODE, &vtysh_telnet_cmd);
|
|
|
|
install_element (VIEW_NODE, &vtysh_telnet_port_cmd);
|
2003-01-25 07:56:09 +01:00
|
|
|
install_element (VIEW_NODE, &vtysh_ssh_cmd);
|
2002-12-13 21:15:29 +01:00
|
|
|
install_element (ENABLE_NODE, &vtysh_ping_cmd);
|
2003-06-25 12:49:55 +02:00
|
|
|
install_element (ENABLE_NODE, &vtysh_ping_ip_cmd);
|
2002-12-13 21:15:29 +01:00
|
|
|
install_element (ENABLE_NODE, &vtysh_traceroute_cmd);
|
2003-06-25 12:49:55 +02:00
|
|
|
install_element (ENABLE_NODE, &vtysh_traceroute_ip_cmd);
|
|
|
|
#ifdef HAVE_IPV6
|
|
|
|
install_element (ENABLE_NODE, &vtysh_ping6_cmd);
|
|
|
|
install_element (ENABLE_NODE, &vtysh_traceroute6_cmd);
|
|
|
|
#endif
|
2002-12-13 21:15:29 +01:00
|
|
|
install_element (ENABLE_NODE, &vtysh_telnet_cmd);
|
|
|
|
install_element (ENABLE_NODE, &vtysh_telnet_port_cmd);
|
2004-08-27 00:21:31 +02:00
|
|
|
install_element (ENABLE_NODE, &vtysh_ssh_cmd);
|
2002-12-13 21:15:29 +01:00
|
|
|
install_element (ENABLE_NODE, &vtysh_start_shell_cmd);
|
|
|
|
install_element (ENABLE_NODE, &vtysh_start_bash_cmd);
|
|
|
|
install_element (ENABLE_NODE, &vtysh_start_zsh_cmd);
|
|
|
|
|
|
|
|
install_element (CONFIG_NODE, &vtysh_log_stdout_cmd);
|
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.
2004-12-07 16:39:31 +01:00
|
|
|
install_element (CONFIG_NODE, &vtysh_log_stdout_level_cmd);
|
2002-12-13 21:15:29 +01:00
|
|
|
install_element (CONFIG_NODE, &no_vtysh_log_stdout_cmd);
|
|
|
|
install_element (CONFIG_NODE, &vtysh_log_file_cmd);
|
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.
2004-12-07 16:39:31 +01:00
|
|
|
install_element (CONFIG_NODE, &vtysh_log_file_level_cmd);
|
2002-12-13 21:15:29 +01:00
|
|
|
install_element (CONFIG_NODE, &no_vtysh_log_file_cmd);
|
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.
2004-12-07 16:39:31 +01:00
|
|
|
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);
|
2002-12-13 21:15:29 +01:00
|
|
|
install_element (CONFIG_NODE, &vtysh_log_syslog_cmd);
|
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.
2004-12-07 16:39:31 +01:00
|
|
|
install_element (CONFIG_NODE, &vtysh_log_syslog_level_cmd);
|
2002-12-13 21:15:29 +01:00
|
|
|
install_element (CONFIG_NODE, &no_vtysh_log_syslog_cmd);
|
|
|
|
install_element (CONFIG_NODE, &vtysh_log_trap_cmd);
|
|
|
|
install_element (CONFIG_NODE, &no_vtysh_log_trap_cmd);
|
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.
2004-12-07 16:39:31 +01:00
|
|
|
install_element (CONFIG_NODE, &vtysh_log_facility_cmd);
|
|
|
|
install_element (CONFIG_NODE, &no_vtysh_log_facility_cmd);
|
2002-12-13 21:15:29 +01:00
|
|
|
install_element (CONFIG_NODE, &vtysh_log_record_priority_cmd);
|
|
|
|
install_element (CONFIG_NODE, &no_vtysh_log_record_priority_cmd);
|
2004-10-03 22:11:32 +02:00
|
|
|
|
|
|
|
install_element (CONFIG_NODE, &vtysh_service_password_encrypt_cmd);
|
|
|
|
install_element (CONFIG_NODE, &no_vtysh_service_password_encrypt_cmd);
|
|
|
|
|
|
|
|
install_element (CONFIG_NODE, &vtysh_password_cmd);
|
|
|
|
install_element (CONFIG_NODE, &vtysh_password_text_cmd);
|
|
|
|
install_element (CONFIG_NODE, &vtysh_enable_password_cmd);
|
|
|
|
install_element (CONFIG_NODE, &vtysh_enable_password_text_cmd);
|
|
|
|
install_element (CONFIG_NODE, &no_vtysh_enable_password_cmd);
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|