summaryrefslogtreecommitdiff
path: root/vtysh/vtysh_main.c
AgeCommit message (Collapse)Author
2023-01-05vtysh: Remove double retrieve of env VTYSH_HISTFILEDonald Sharp
The code is double checking the VTYSH_HISTFILE env variable, additionally clang-15 when running SA over it doesn't fully understand the code pattern. Reduce the double check to one check to reduce program run-time (ha!) and make SA happy. Signed-off-by: Donald Sharp <sharpd@nvidia.com> (cherry picked from commit 99a9f25ce8c1e070f7f37c4cbd439c11bb7432eb)
2022-08-10vtysh: Handle SIGTSTP (C-z) without exiting the vty shellDonatas Abraitis
After 4c92dd90d3d15cff640de063ff14eec950402d25 switching to poll-based I/O, vtysh prompt exits on C-z signal. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-02-28vtysh: use poll/callback-driven readline interfaceDavid Lamparter
Create a thread_master and funnel readline terminal I/O through it. This allows processing other input in parallel, e.g. log messages. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-14vtysh: Fix spelling mistakesDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-02build: ignore prototype warnings from readlineDavid Lamparter
Readline contains some truly ancient cruft. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-06-30vtysh: add CLI timestamp '-t' flagChristian Hopps
Example output: flk# show version % 2021/06/29 00:25:01.562 FRRouting 8.1-dev-my-manual-build (flk). Copyright 1996-2005 Kunihiro Ishiguro, et al. ... Signed-off-by: Christian Hopps <chopps@labn.net>
2021-04-12vtysh: Set history file on demandDonatas Abraitis
It's sometimes needed to disable logging all FRR commands at all. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-12-15vtysh: When dry-running no need to start/end configurationDonald Sharp
When doing a dry run don't send start/end configuration commands. Ticket: CM-32665 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-12-03vtysh: Have help dump the how FRR was builtDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-12-03vtysh: Display version w/ vtysh --helpDonald Sharp
Add a bit of useful data to know what version of FRR we are playing with in this vtysh instance. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-07-14*: un-split strings across linesDavid Lamparter
Remove mid-string line breaks, cf. workflow doc: .. [#tool_style_conflicts] For example, lines over 80 characters are allowed for text strings to make it possible to search the code for them: please see `Linux kernel style (breaking long lines and strings) <https://www.kernel.org/doc/html/v4.10/process/coding-style.html#breaking-long-lines-and-strings>`_ and `Issue #1794 <https://github.com/FRRouting/frr/issues/1794>`_. Scripted commit, idempotent to running: ``` python3 tools/stringmangle.py --unwrap `git ls-files | egrep '\.[ch]$'` ``` Signed-off-by: David Lamparter <equinox@diac24.net>
2020-03-08*: Replace `sizeof something` to sizeof(something)Donatas Abraitis
Satisfy checkpatch.pl requirements (check for sizeof without parenthesis) Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-05*: use gmtime_r, localtime_r exclusivelyMark Stapp
Stop using gmtime() or localtime() everywhere. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-02-09*: Remove parenthesis on return for constantsDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-06lib: rename memory_vty.c to lib_vty.cDavid Lamparter
And memory_init() to lib_cmd_init(). Signed-off-by: David Lamparter <equinox@diac24.net>
2019-11-07vtysh: be helpful and kind to unprivileged usersQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-07-29vtysh: only show error codes onceQuentin Young
When using `show error` commands, show errors shared between multiple daemons only once. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-06-04*: Convert over to all -N namespace to change DAEMON_VTY_DIRDonald Sharp
When the user specifies -N namespace allow it to influence the frr_vtydir(DAEMON_VTY_DIR) to have namespace in it's path like so: $frrstate_dir/<namespace> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-12-06vtysh: rework/straighten pager handlingDavid Lamparter
- no longer try to special-case a custom terminal length; the OS has procedures for that (SIGWINCH & TIOCGWINSZ) - only use a pager if requested by CLI command or VTYSH_PAGER. The behaviour with VTYSH_PAGER set should be compatible to previous versions. Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-12lib vtysh zebra: variable shadowing fixesF. Aragon
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-09-08vtysh: Add code to isolate append_historyDonald Sharp
The append_history function in lib readline appears to not be universally available across all of the esoteric platforms we may want to compile on. As such provide a way to gracefully do nothing. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-13vtysh: Fix missing tailing / in --config_dir option parsingMartin Winter
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-06-12vtysh: in user mode, don't show 'enable not allowed', also block writeconfigLou Berger
Signed-off-by: Lou Berger <lberger@labn.net>
2018-06-07bgpd, lib, ospf6d, vtysh: fix possible snprintf possible truncationDonald Sharp
With a new version of clang 6.0, the compiler is detecting more issues where we may be possibly be truncating the output string. Fix by increasing the size of the output string to make the compiler happy. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-22vtysh: rewrap commentsQuentin Young
fixup comments for vtysh Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-05-12vtysh: Extending vtysh to allow question-mark cmdsRodny Molina
Currently, "vtysh -c" interface does not provide a logic to parse commands ending with '?' character. In consequence, the following behavior is observed: $ vtysh -c "show bgp ?" % Unknown command. With these changes, i'm extending FRR's parser to be able to handle these commands, which allow a more friendly interaction with users that rely on "vtysh -c" interface. The typical use-case here is for scenarios in which the final users relie on external/their-own CLI and require a friendly interface to FRR's vtysh cli. $ vtysh -c "show bgp ?" <cr> A.B.C.D Network in the BGP routing table to display A.B.C.D/M IPv4 prefix X:X::X:X Network in the BGP routing table to display X:X::X:X/M IPv6 prefix attribute-info List all bgp attribute information cidr-only Display only routes with non-natural netmasks community Display routes matching the communities community-info List all bgp community information ... Signed-off-by: Rodny Molina <rmolina@linkedin.com>
2018-04-11vtysh: fix pathspec option -NChristian Franke
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2018-03-28vtysh: move user_mode to header file, keep checkpatch happyLou Berger
Signed-off-by: Lou Berger <lberger@labn.net>
2018-03-28vtysh: add -u/--user flag to run commands without enableLou Berger
Signed-off-by: Lou Berger <lberger@labn.net>
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>