From f366ad31ae6bf7e2fb7271cf8eab6dee4af3baf9 Mon Sep 17 00:00:00 2001 From: "Andrew J. Schorr" Date: Thu, 27 Jul 2006 18:01:41 +0000 Subject: [vtysh] Never skip authentication, and add support for multiple -c commands 2006-07-27 Andrew J. Schorr * vtysh.1: Document new options -d and -E, and note that now multiple -c options may be supplied, with embedded linefeed now supported. In BUGS section, remove warning about vtysh causing a daemon to freeze, since this has been fixed. * vtysh_main.c: (usage) Add new -d and -E options. And note that -c can be used multiple times, possibly with embedded linefeeds. (longopts) Add new -d and -E options. (main) Add new -d and -E options, and create a linked list to support multiple -c options. Do not call vtysh_connect_all until after vtysh_read_config(config_default) and vtysh_auth have succeeded. This prevents the vtysh.conf file from configuring any daemons, and it ensures that authentication has been passed before we send any commands to any daemons. Call vtysh_connect_all with any daemon name supplied with -d. If it is unable to connect to any daemons, issue an error message and exit immediately. When used in -c mode, call vtysh_execute("enable") before executing the commands in order to match interactive behavior. And detect embedded linefeed chars in -c commands and break them up appropriately. * vtysh.h: (vtysh_connect_all) Fix proto to reflect new daemon_name argument, and that it now returns an integer -- the number of daemons to which we were able to connect. * vtysh.c: (vtysh_connect_all) Add a new daemon_name argument. If supplied, connect only to that daemon. And return the number of daemons to which we were able to connect. (vtysh_prompt): Performance enhancement -- make struct utsname static so we call uname to get the hostname only once. --- doc/ChangeLog | 7 +++++++ doc/vtysh.1 | 37 +++++++++++++++++++++++++++++-------- 2 files changed, 36 insertions(+), 8 deletions(-) (limited to 'doc') diff --git a/doc/ChangeLog b/doc/ChangeLog index c811cb31..a0c39953 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,10 @@ +2006-07-27 Andrew J. Schorr + + * vtysh.1: Document new options -d and -E, and note that now multiple + -c options may be supplied, with embedded linefeed now supported. + In BUGS section, remove warning about vtysh causing a daemon + to freeze, since this has been fixed. + 2006-07-04 Paul Jakma * quagga.info: remove auto-generated file. It will still be diff --git a/doc/vtysh.1 b/doc/vtysh.1 index e5fccb11..eb960cdc 100644 --- a/doc/vtysh.1 +++ b/doc/vtysh.1 @@ -1,4 +1,4 @@ -.TH VTYSH 1 "3 October 2004" "Quagga VTY shell" "Version 0.96.5" +.TH VTYSH 1 "27 July 2006" "Quagga VTY shell" "Version 0.96.5" .SH NAME vtysh \- a integrated shell for Quagga routing software .SH SYNOPSIS @@ -9,6 +9,12 @@ vtysh \- a integrated shell for Quagga routing software .br .B vtysh [ +.B \-E +] [ +.B \-d +.I daemon +] +] [ .B \-c .I command ] @@ -29,13 +35,32 @@ info. Specify command to be executed under batch mode. It behaves like -c option in any other shell - .I command -is executed and vtysh exits. +is executed and +.B vtysh +exits. -It's useful for gathering info from Quagga routing software from shell scripts -etc. +It's useful for gathering info from Quagga routing software or reconfiguring +daemons from inside shell scripts, etc. +Note that multiple commands may be executed by using more than one +-c option and/or embedding linefeed characters inside the +.I command +string. +.IP "\fB\-d, \-\-daemon \fIdaemon_name\fP" +Specify which daemon to connect to. By default, +.B vtysh +attempts to connect to all Quagga daemons running on the system. With this +flag, one can specify a single daemon to connect to instead. For example, +specifying '-d ospfd' will connect only to ospfd. This can be particularly +useful inside scripts with -c where the command is targeted for a single daemon. .IP "\fB\-e, \-\-execute \fIcommand\fP" Alias for -c. It's here only for compatibility with Zebra routing software and older Quagga versions. This will be removed in future. +.IP "\fB\-E, \-\-echo\fP" +When the -c option is being used, this flag will cause the standard +.B vtysh +prompt and command to be echoed prior to displaying the results. +This is particularly useful to separate the results +when executing multiple commands. .IP "\fB\-h, \-\-help\fP" Display a usage message on standard output and exit. .SH ENVIRONMENT VARIABLES @@ -63,10 +88,6 @@ options. The definitive document is the Info file \fBQuagga\fR. .BR isisd (8), .BR zebra (8) .SH BUGS -Running the command which outputs large amount of data through pager ("show ip -ospf database", "show ip bgp" etc. in big networks) will cause daemon to be -unresponsive until vtysh returns back to the prompt. - .B vtysh eats bugs for breakfast. If you have food for the maintainers try .BI http://bugzilla.quagga.net -- cgit v1.2.1