summaryrefslogtreecommitdiffstats
path: root/vtysh/vtysh_main.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* bgpd: Fix for CM-11777 Need Quagga.conf created at quagga installSid Khot2016-08-171-1/+4
| | | | | | Ticket: CM-11777 Reviewed By: CCR-5110 Testing Done: Manual
* *: get rid of "MTYPE 0"David Lamparter2016-07-281-2/+2
| | | | | | | | | | | A few places are using 0 in place of the MTYPE_* argument. The following rewrite of the alloc tracking won't deal with that, so let's use MTYPE_TMP instead. Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> Acked-by: Donald Sharp <sharpd@cumulusnetworks.com> [DL: v2: fix XFREE(0, foo) calls too] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* vtysh: drop unused variables & RETSIGTYPEDavid Lamparter2016-06-081-8/+2
| | | | | | | | | | Drop unused return values in vtysh. Also gets rid of the rather funny prototyping of signal setup in vtysh - which as a side effect makes it not need AC_TYPE_SIGNAL in configure.ac anymore. It wasn't used sensibly to begin with... Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit 6769f43de9d595b935f2ebf1cae1428e1d1a3a5f)
* vtysh: fix function prototypesDavid Lamparter2016-06-081-0/+1
| | | | | | | | This makes a whole bunch of vtysh functions static, fixes prototypes for a few more, and masks user_free() and user_write_config() (both unused.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit a9eb9063071437f5cde3b78adf273b428c49d378)
* lib, vtysh: reduce unneccessary C extension usageDavid Lamparter2016-06-081-1/+4
| | | | | | | | We're only supporting GCC, Clang and ICC; but there's no reason to use nonstandard C constructs if they don't actually provide any benefit. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit 71f55f38cb3dd804176e7f382f52b75ddcd437de)
* vtysh -f needs to flock the fileDaniel Walton2016-04-151-0/+2
| | | | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Ticket: CM-10428
* stop/start of zebra creates empty Quagga.conf file when "no serviceDaniel Walton2016-04-131-1/+1
| | | | | | | | | | | integrated-vtysh-config" Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Ticket: CM-10403 We do not need to pass O_CREAT to open() when creating the flock file
* vtysh: Add file locking to Quagga.confDonald Sharp2016-04-071-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Systemd runs in parallel all quagga daemons after zebra is started up. Now each command has a ExecStartPost which executes vtysh -b -n. Each of these vtysh -b -n would blask configuration to each daemon. This leads to the situation where vtysh process #2 is blasting in config that is at a different spot in the Quagga.conf file that vtysh process #1 is at. If #1 has put itself into a different submode that #2 is at, we will get failures and the code will not be read in properly. This problem is especially evident for when you have more than one protocol running at one time. Solution: flock Quagga.conf. If you don't get the flock, sleep for a while, try to get flock again go to slepp... Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com> Reviewed-by: DAve Olson <olson@cumulusnetworks.com>
* lib, vtysh: Return actual problem further upDonald Sharp2016-04-071-5/+6
| | | | | | | | | | | | When we encounter a problem loading a config file quantify to the end user what has gone wrong, with a combination of err output as well as return codes. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com> Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Dave Olson <olson@cumulusnetworks.com>
* vtysh: Make vtysh run as quagga userDonald Sharp2016-04-011-0/+24
| | | | | | | | | | | | vtysh should be run as the quagga user, else when you execute a 'wr mem' the Quagga.conf and vtysh.conf files are owned by whomever started the process. This can cause file ownership issues. Ticket: CM-10217 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Dave Olson <olson@cumulusnetworks.com> Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
* vtysh: Set an erroneous exit code if dry run fails because of syntax errorDonald Sharp2016-03-091-4/+10
| | | | | | | | | | | | | | | vtysh has a -C option to do a dry run of the quagga commands. However, the program always returns 0 even when there's an error detected in the command. Furthermore, it only parses vtysh.conf, not Quagga.conf. This patch makes vtysh -C parse Quagga.conf also and return a non-zero exit code so that network automation tools can catch this to flag errors in syntax. This non-zero exit code along with printing the exact error with the line number and offending line itself should help in fixing the error. But this lack of proper error code requires the automation tools to go through an additional hoop to validate the syntax. Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
* vtysh: Modify -b option to work with -n optionDonald Sharp2016-02-101-1/+4
| | | | | | | | | | If there is no Quagga.conf file and the -b option has been specified, the vtysh -b file is erroring out and failing. Modify the code to use -n in conjunction of -b and to not error out in this situation. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* doc, vtysh: Fixup of history handlingDonald Sharp2016-01-131-2/+30
| | | | | | | | | | | This fix does two things: 1) If the ${HOME}/.history_quagga file does not exist, create it for history storing. 2) Allow vtysh -c "..." commands to be stored in history file as well Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Quagga: Fix some more compile warningsDonald Sharp2015-10-071-1/+7
| | | | | | | | The debian build process under Jessie has a 'newer' gcc compiler that is more stringent on warnings returned. This commit cleans up some more warnings returned. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* vtysh: vtysh-warnings.patchDonald Sharp2015-05-201-8/+8
| | | | | | Remove compile warnings for the vtysh directory Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by:
* vtysh-add-mark-cmd.patchDonald Sharp2015-05-201-4/+38
| | | | | | | | | | VTYSH: Add support for marking a file with appropriate end of context To support applying only differences to the existing config, this patch enables supplying the appropriate end markers to a provided file (or stdin). By end markers, I mean, adding "end" and "exit-address-family" at the appropriate places in the configuration to ease finding the differences with the running configuration.
* lib/command.c: rewrite command matching/parsingChristian Franke2014-04-011-2/+0
| | | | | | | | | | Add support for keyword commands. Includes new documentation for DEFUN() in lib/command.h, for preexisting features as well as new keyword specification. Signed-off-by: Christian Franke <chris@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* [vtysh] Save vtysh history to a fileTomasz Pala2009-06-241-1/+7
| | | | | vtsh_main.c: save 1000 last lines of history to $HOME/.history_quagga (the file must be created by hand first, this is intended behaviour)
* [vtysh] Add a --noerror optionStephen Hemminger2009-06-181-7/+18
| | | | | There are times that configuration scripts want to run vtysh but don't want to get error messages or failed exit status
* [vtysh] Make vtysh more useable for scriptingStephen Hemminger2009-06-181-3/+42
| | | | | | Add environment variable (VTYSH_LOG) for logging. If a command fails, exit with non-zero exit code and don't continue multipart commands.
* [vtysh] Force line buffered mode.Stephen Hemminger2009-06-181-0/+1
| | | | | Vtysh is used in pipelines and it helps if the output starts right away instead of waiting for a whole buffer to fill.
* [daemon startup] Add --dry-run/-C argument to daemons, to check config file ↵Paul Jakma2006-10-161-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | syntax 2006-10-04 Oliver Hookins <ohookins@gmail.com> * bgpd/bgp_main.c: Add configuration check option, with '-C' rather than '-c' for consistency between daemons. * isisd/isis_main.c: ditto * ospf6d/ospf6_main.c: ditto * ospfd/ospf_main.c: ditto * ripngd/ripng_main.c: ditto * vtysh/vtysh_main.c: ditto * ripd/rip_main.c: Change the config check option to '-C' and tidy up the code. * zebra/main.c: ditto 2006-10-04 Stergiakis Alexandros <astergiakis@antcor.com> * ripd/rip_main.c: This trivial patch introduces a new command-line option '-c', which instructs zebra/ripd to check its configuration file for validity, print any error message, and then exit. This is useful when the configuration file is edited by hand or otherwise, and you simply want to validate it without any other effect. * zebra/main.c: ditto
* [vtysh] Never skip authentication, and add support for multiple -c commandsAndrew J. Schorr2006-07-271-14/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2006-07-27 Andrew J. Schorr <ajschorr@alumni.princeton.edu> * 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.
* Vtysh compiles cleanly as well.hasso2004-10-071-1/+0
|
* Big vtysh cleanup. See changelogs for details.hasso2004-10-031-20/+13
|
* Port ospf6d to sigevent and rename signal handling functions in vtysh not tohasso2004-08-281-7/+8
| | | | conflict the ones in lib/sigevent.c. Fixes compiling with --disable-shared.
* More vtysh fixes. Specifying configuration from command line works now.hasso2004-08-271-8/+10
|
* Vtysh cleanup part 2. No any functional changes yet except VTYSH_INTERFACE.hasso2004-08-261-14/+11
|
* Cleaning up whitespace mess mostly caused by my patches. Biggerhasso2004-08-251-6/+6
| | | | reorganization of this spagetti will follow soon.
* Vtysh fixes:hasso2004-04-061-6/+16
| | | | | | * replace -e with -c * don't save command in history if last line is the same one * doc/help fixes
* 2004-03-16 David Young <dyoung@pobox.com>gdt2004-03-161-1/+1
| | | | | | | | | * (many) reference <lib/version.h> rather than "version.h", because version.h is a generated file and not present in the source tree when using objdir builds. (committed by gdt) works fine with normal builds; didn't try objdir
* Initial revisionpaul2002-12-131-0/+288