summaryrefslogtreecommitdiff
path: root/vtysh/vtysh_main.c
AgeCommit message (Collapse)Author
2018-03-06*: conform with COMMUNITY.md formatting rules, via 'make indent'Lou Berger
Signed-off-by: Lou Berger <lberger@labn.net>
2018-02-23vtysh: .history_quagga --> .history_frrQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-01-12vtysh: add ability to output to fileQuentin Young
Add ability to set file destination for all vtysh output, with the exception of tab-complete and similar meta output. This is useful for inline recording of some information without exiting the shell. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-10-24*: fix coverity warnings - error handling issuesRenato Westphal
Ignore the return value of some functions in the places we know they can't fail, and other small fixes. Regarding the change in bgpd/rfapi/rfapi_rib.c, asserting that rfapiRaddr2Qprefix() didn't fail is the common idiom inside the rfapi code. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-08vtysh: fix clang warningVincent JARDIN
cmd->line shall never be null for these sections. Signed-off-by: Vincent Jardin <vincent.jardin@6wind.com>
2017-09-26vtysh: remove extra / in config pathQuentin Young
before: frrdev# do wr Note: this version of vtysh never writes vtysh.conf Building Configuration... Integrated configuration saved to /etc/frr//frr.conf [OK] frrdev# after: frrdev# do wr Note: this version of vtysh never writes vtysh.conf Building Configuration... Integrated configuration saved to /etc/frr/frr.conf [OK] frrdev# Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-09-06vtysh: fix pathspaceQuentin Young
It didn't work Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-08-30*: fix styleQuentin Young
Fixes style nits introduced by recent pull requests. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-08-28vtysh: add -N/--pathspace optionDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-28vtysh: simplify path handlingDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-28vtysh: cleanup SUID handlingDavid Lamparter
Eliminate several more SUID problems (VTYSH_LOG, history file) and make the whole SUID approach more robust. Still possibly unsafe to use, but much better. [v2: wrap seteuid/setegid calls] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-17*: reindentreindent-master-afterwhitespace / reindent
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15*: make consistent & update GPLv2 file headersDavid Lamparter
The FSF's address changed, and we had a mixture of comment styles for the GPL file header. (The style with * at the beginning won out with 580 to 141 in existing files.) Note: I've intentionally left intact other "variations" of the copyright header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-08*: add frr_config_fork()David Lamparter
Centralise read_config/daemonize/dryrun/pidfile/vty_serv into libfrr. This also makes multi-instance pid/config handling available as part of the library. It's only wired up in ospfd, but the code is in lib/. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-06vtysh: Fix cli help string to have only 1 mention of vty_socketDonald Sharp
When you run 'vtysh -h' the option '--vty_socket' is listed twice. Fixes issue #253 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-27Lowercase frr.confMartín Beauchamp
2017-02-10vtysh: make -c useful with -C (dryrun)David Lamparter
-c was previously ignored when -C (dryrun/config-check) was present. Change so that -C -c creates an useful dry-run mode. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-07*: Found some instances of Quagga.confDonald Sharp
Cleanup Quagga.conf -> Frr.conf Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-03vtysh: Quagga.conf -> Frr.confQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-02-01*: fix warning fallout from set_socket_pathDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-26vtysh: Add --config_dir option to override compiled in location for ↵Martin Winter
vtysh.conf and Quagga.conf Only allow the override if vtysh is not run with setuid() Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2017-01-26vtysh: Add vty_socket cli option to override the compiled-in location for ↵Martin Winter
the VTY daemon sockets Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2016-12-20build: rename (1 of ?): configure.ac + preprocDavid Lamparter
This replaces Quagga -> FRR in most configure.ac settings as well as a handful of preprocessor macros in the source code. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-10vtysh: fix config writeDavid Lamparter
2016-11-09Revert "vtysh: Make vtysh run as quagga user"David Lamparter
This reverts commit 5dd58b08299e85735f19fba1ee307c509fb19de7. Changing vtysh uid/gid is now actually counterproductive. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-09vtysh: add -w option for integrated-config writeDavid Lamparter
This new option is intended to be used both by watchquagga as well as directly by users. It performs the collect-configuration operation and writes out Quagga.conf, regardless of whether integrated-config is enabled or not. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-09vtysh: detangle configuration writesDavid Lamparter
vtysh has a very convoluted and confusing setup where it isn't even clear which files are written where (since some filenames come indirectly from loading config). Detangle. This also removes writing vtysh.conf. The file is intended to be manually edited since it has some vague security concerns (if PAM is used). Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-09-19lib: migrate to new memory-type handlingDavid Lamparter
Move over to the new allocation counting added in the previous commit. (This commit is mostly mechanical.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
2016-08-16bgpd: Fix for CM-11777 Need Quagga.conf created at quagga installSid Khot
Ticket: CM-11777 Reviewed By: CCR-5110 Testing Done: Manual
2016-07-28*: get rid of "MTYPE 0"David Lamparter
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>
2016-06-08vtysh: drop unused variables & RETSIGTYPEDavid Lamparter
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)
2016-06-08vtysh: fix function prototypesDavid Lamparter
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)
2016-06-08lib, vtysh: reduce unneccessary C extension usageDavid Lamparter
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)
2016-04-15vtysh -f needs to flock the fileDaniel Walton
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Ticket: CM-10428
2016-04-13stop/start of zebra creates empty Quagga.conf file when "no serviceDaniel Walton
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
2016-04-06vtysh: Add file locking to Quagga.confDonald Sharp
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>
2016-04-06lib, vtysh: Return actual problem further upDonald Sharp
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>
2016-04-01vtysh: Make vtysh run as quagga userDonald Sharp
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>
2016-03-09vtysh: Set an erroneous exit code if dry run fails because of syntax errorDonald Sharp
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>
2016-02-10vtysh: Modify -b option to work with -n optionDonald Sharp
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>
2016-01-13doc, vtysh: Fixup of history handlingDonald Sharp
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>
2015-10-07Quagga: Fix some more compile warningsDonald Sharp
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>
2015-05-19vtysh: vtysh-warnings.patchDonald Sharp
Remove compile warnings for the vtysh directory Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by:
2015-05-19vtysh-add-mark-cmd.patchDonald Sharp
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.
2014-04-01lib/command.c: rewrite command matching/parsingChristian Franke
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>
2009-06-24[vtysh] Save vtysh history to a fileTomasz Pala
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)
2009-06-18[vtysh] Add a --noerror optionStephen Hemminger
There are times that configuration scripts want to run vtysh but don't want to get error messages or failed exit status
2009-06-18[vtysh] Make vtysh more useable for scriptingStephen Hemminger
Add environment variable (VTYSH_LOG) for logging. If a command fails, exit with non-zero exit code and don't continue multipart commands.
2009-06-18[vtysh] Force line buffered mode.Stephen Hemminger
Vtysh is used in pipelines and it helps if the output starts right away instead of waiting for a whole buffer to fill.
2006-10-15[daemon startup] Add --dry-run/-C argument to daemons, to check config file ↵Paul Jakma
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