Commit Graph

565 Commits

Author SHA1 Message Date
Quentin Young
af4d3437ce lib, vtysh: fixup style nits for error refs
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14 20:02:05 +00:00
Quentin Young
ed8841d3fb lib: add 'show error all json'
* Add 'all' option
* Add 'json' option

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14 20:02:05 +00:00
Quentin Young
7b526b6168 lib: add error reference system
* Add zlog_* function to log with a reference code
* Add ability to track reference cards for errors to ferr.[ch]
* Assign some reference code ranges

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14 20:02:05 +00:00
Donald Sharp
d6853655b5
Merge branch 'master' into bfd-final 2018-08-14 08:16:10 -04:00
Donald Sharp
4354a8052c
Merge pull request #2823 from opensourcerouting/snap-staticd
Updates to snap package to support staticd
2018-08-14 07:48:15 -04:00
Renato Westphal
91e5b43ab4 lib, vtysh: fix inconsistent interface commands in vtysh
The definition of the interface commands in vtysh.c were outdated.
Currently, all daemons that call if_cmd_init() will have the "no interface
IFNAME" command and the "[no] description" commands as well, so there's
no need to define exceptions for these commands anymore.

To fix this, make extract.pl parse the if.c file so that vtysh can get the
interface commands from there automatically. Only the "interface IFNAME
[vrf NAME]" must be kept in vtysh.c because it changes the vty node and
thus needs special treatment.

Finally, make pimd and pbrd display interface descriptions on "sh run"
when they are configured.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-08-13 18:59:31 -03:00
Renato Westphal
34c4627457 lib, vtysh: fix inconsistent VRF commands in vtysh
* Only zebra and pimd call vrf_cmd_init(), so these are the only daemons
  that should receive VRF commands from vtysh;
* "netns NAME" and "no netns NAME" are available only in zebra, write
  custom DEFSHs in vtysh to make it aware of that;
* Remove the "no vrf NAME" definition from vtysh.c and expose the
  original command to vtysh by converting the DEFUN_NOSH to a simple
  DEFUN. This command doesn't change the vty node so there's no need to
  special case it.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-08-13 18:59:31 -03:00
Martin Winter
45d005874e vtysh: Fix missing tailing / in --config_dir option parsing
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-08-13 14:55:59 -07:00
Rafael Zalamena
c2f29cf3d7 bfdd: add vty shell commands
Implement vty shell integration and allow `bfdd` to be configured
through FRR's vtysh.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2018-08-08 18:25:04 -03:00
Martin Winter
09890489cc
Merge pull request #2122 from donaldsharp/zebra_nhs
Create Staticd
2018-08-08 08:07:24 -07:00
Donald Sharp
61a7a236df vtysh: Respect order dependancy of some pim commands
If `ip igmp query-max-respone-time ` is specified allow it
to show up before `ip igmp query-interval ` since there
are order dependancies that may show up.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com.
2018-08-02 10:38:48 -04:00
Donald Sharp
7e24fdf333 staticd: Start the addition of a staticd
This is the start of separating out the static
handling code from zebra -> staticd.  This will
help simplify the zebra code and isolate static
route handling to it's own code base.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-29 12:37:24 -04:00
Quentin Young
8d70e7fe32 vtysh: fix autocomplete garbage printouts
The semantics for suppressing output received from daemons changed
slightly when pipe actions were introduced, causing raw autocomplete
output to be printed where it shouldn't have been.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-28 18:37:01 +00:00
Quentin Young
20d8a28413 *: remove deprecated 'log trap' commands
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-25 16:35:34 +00:00
Quentin Young
5caa3ad34f
Merge pull request #2512 from pacovn/Coverity_1399200_Unchecked_return_value_from_library
vtysh: return value check (Coverity 1399200)
2018-06-22 14:11:09 -04:00
paco
1a40fad568
vtysh: return value check (Coverity 1399200)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-22 00:01:42 +02:00
Donald Sharp
1f14323649 vtysh: Fix 'no log syslog ..' to be correct
The vtysh version of `no log syslog...` was out
of sync with what is actually correct.  Fix.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-19 08:43:59 -04:00
Russ White
efd1d76673
Merge pull request #2474 from donaldsharp/vty_thread_cancel_writes
Add 'show thread poll'
2018-06-19 07:28:18 -04:00
paco
6d10727ac1
eigrpd, lib, tests, vtysh: security (cppcheck)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-19 10:40:56 +02:00
Donald Sharp
e8609f7950
Merge pull request #2484 from pacovn/cppcheck_unused_vars
eigrpd, lib: unused vars (cppcheck)
2018-06-18 15:27:11 -04:00
paco
029a775e43
eigrpd, lib, vtysh: unused vars (cppcheck)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-18 17:23:38 +02:00
Donald Sharp
626e8d0a9b lib: A small optimization for the hash iterate and walk functions
When we are iterating through the hash, keep count of how many
we've called and if we have finished calling the hash->size
iterator times, then short-circuit and stop looping over
the entire array.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-16 20:09:45 -04:00
Donald Sharp
8872626bb4 lib, vtysh: Add 'show thread poll' command
Add a 'show thread poll' command that displays the
poll information and fd's setup.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-16 20:09:45 -04:00
Quentin Young
97b1dd19a1
Merge pull request #2409 from LabNConsulting/working/master/vtysh-2400
vtysh: -u fixes
2018-06-15 12:33:44 -04:00
Quentin Young
b7ae6ac4db vtysh: fix config write
Changing vtysh to use vty_out() for everything broke writing to config
files.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-12 18:14:52 +00:00
Lou Berger
f205fcdbb2 vtysh: in user mode, don't show 'enable not allowed', also block writeconfig
Signed-off-by: Lou Berger <lberger@labn.net>
2018-06-12 12:33:25 -04:00
Jafar Al-Gharaibeh
e789c0337c
Merge pull request #2402 from qlyoung/germx-hand-sanitizer-kills-99-percent-of-germs
*: disable all sanitizers for clippy build
2018-06-12 11:11:55 -05:00
paco
a0c14c5400
vtysh: null dereference (Coverity 1469896)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-11 19:42:03 +02:00
Quentin Young
e9f272a49e *: disable all sanitizers for clippy build
* Move configure flag propagations out of user flags
* Use AC_SUBST to transfer flag values to Automake
* Set default AM_CFLAGS and AM_CPPFLAGS in common.am and change child
  Makefiles to modify these base variables
* Add flag override to turn off all sanitizers when building clippy
* Remove LSAN suppressions blacklist as it's no longer needed

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-08 17:22:13 +00:00
Russ White
9eafc8abd7
Merge pull request #2298 from qlyoung/pipe-actions-vtysh
*: add support for `|` actions
2018-06-08 07:39:36 -04:00
Donald Sharp
ff44f57014 bgpd, lib, ospf6d, vtysh: fix possible snprintf possible truncation
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-06-07 19:51:13 -04:00
Donald Sharp
b1599bb6f4 vtysh, zebra: Fix function parameters
New version of clang are detecting function parameters that we should
not be casting as such.  Fix these issues.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-07 19:49:17 -04:00
Quentin Young
5d806ec6e0 lib: fix static analysis issues, use regfree()
* Fix potential NULL dereference
* Fix use of uninitialized value
* Fix leaking memory by not freeing regex_t
* Fix extra \n when using empty regex filter
* Clean up still-reachable hook memory
* Handle nonexistent pager

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-06 16:16:12 +00:00
Quentin Young
0a334343d1 *: style for | support
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-06 16:16:12 +00:00
Quentin Young
2cddf2fff7 vtysh: add | support
* Rewrite pager implementation
* Replace fprintf() with vty_out()
* Modify vty_out() for better vtysh support
* Remove static global outputfile var
* Remove fp argument from many vtysh functions
* Add some docs for stuff along the way

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-06 16:16:10 +00:00
Donald Sharp
17e28b4cb4 vtysh: fp can never be NULL at this point in code
The fp pointer has already been dereferenced in all paths
leading to the test for non NULL.  Since we never crash
we know it cannot be NULL.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-05 10:42:05 -04:00
Quentin Young
acf59d7a87 vtysh: fix potential stack buffer overflow
If vtysh was instructed to perform line-by-line processing on the output
of a command executed against a daemon and this output, as received by
vtysh, was not terminated with a newline, vtysh could print contents of
memory to its output device.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-01 19:25:03 +00:00
Quentin Young
cfb3b1a37d
Merge pull request #2272 from msablic/vtysh_reconnect
vtysh: reconnect to daemons when connection lost
2018-05-25 14:09:44 -04:00
Quentin Young
76015847ea vtysh: rewrap comments
fixup comments for vtysh

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-05-22 21:14:00 +00:00
Mladen Sablic
67736451c5 vtysh: reconnect to daemons when connection lost
Functionality to let vtysh attempt to reconnect to daemons when
connection is lost (e.g. crash or restart).

Signed-off-by: Mladen Sablic <mladen.sablic@gmail.com>
2018-05-21 20:51:03 +02:00
Quentin Young
21c84871cf
Merge pull request #2221 from rodnymolina/vtysh_extension
vtysh: Extending vtysh to allow question-mark cmds
2018-05-17 13:03:11 -04:00
Donald Sharp
9d1448357e vtysh: Fix leaked memory in error case
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-16 09:56:16 -04:00
Pascal Mathis
4911ca9cab
lib: Moved no-password warnings into header file
The warning string which appears when the users executes 'no (enable)
password' was moved into command.h and declared as a constant named
'NO_PASSWD_CMD_WARNING'.

This avoids duplicate code and makes it easy to change the warning
message in all places at once.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-05-13 19:11:43 +02:00
Rodny Molina
a4364a44ae vtysh: Extending vtysh to allow question-mark cmds
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-05-12 18:59:11 -07:00
Pascal Mathis
eb83f7ce84
lib: Improved warnings for 'no (enable) password'
When the user executes one of the commands 'no password' or 'no enable
password', a warning message gets shown to inform the user of the
security implications.

While the current implementation works, a warning message gets printed
once for each daemon, which can lead to seeing the same message many
times. This does not affect functionality, but looks like an error to
the user as it can be seen within issue #1432.

This commit only prints the warning message inside lib when vtysh
dispatch is not being used. Additionally, the warning message was copied
into the vtysh command handlers, so that they get printed exactly once.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-05-12 22:22:09 +02:00
Russ White
71ef4ee49a
Merge pull request #2132 from donaldsharp/missed_stuff
Missed stuff
2018-05-12 06:18:15 -04:00
Pascal Mathis
322e2d5c69
lib: Ported 'no (enable) password' from stable/3.0
The pull request #1545 from @donaldsharp introduced the command 'no
password' to remove an existing terminal connection password.
Additionally, warnings have been added to both 'no password' and 'no
enable password' to make the user aware of any security implications.

It seems that this specific pull request was never merged against master
and got lost. This commit is a cherry-pick of d4961273cb with fixed
conflicts and updated documentation.

Thanks to @donaldsharp and @pogojotz for the original PR.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-05-11 02:54:30 +02:00
Donald Sharp
9a55f79a26 pbrd, vtysh: Limit range to actual 1-700
The range for sequence numbers needs to be limited
by the range we have currently choosen for rule
ranges.

Ticket: CM-20562
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-08 19:24:15 -04:00
Russ White
d437ae815d
Merge pull request #2073 from pguibert6WIND/bgp_fs_pbr
Bgp Flowspec Policy Based Routing
2018-05-02 18:54:11 -04:00
Philippe Guibert
431c193b3e vtysh: add bgp_flowspec_vty to Makefile.am
In order to be able to configure flowspec from vtysh, the bgp_vty
flowspec file is added into vtysh files to parse.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-04-30 11:56:23 +02:00