Commit Graph

459 Commits

Author SHA1 Message Date
Mark Stapp
5b724d424b
Merge pull request #5171 from donaldsharp/remove_getrusage
*: Allow disabling of `getrusage` calls
2019-10-17 12:26:28 -04:00
Renato Westphal
62ae9adeef lib, vtysh: add new libyang option to the "debug northbound" command
Guard the libyang debug messages under this command so that only
people interested on those messages will see them.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-10-16 17:11:41 -03:00
Renato Westphal
21f5aade3d vtysh: remove DEFPY variable names
Some DEFPY commands were copied to vtysh without being cleaned up
properly. Fix this.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-10-16 17:09:09 -03:00
Donald Sharp
f75e802d8a *: Allow disabling of getrusage calls
getrusage, in a heavily stressed system, can account for
signficant running time due to process switching to the kernel.
Allow the end-operator to specify `--disable-cpu-time` to
avoid this call.  Additionally we cause `show thread cpu` to
not show up if this is selected.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-16 13:34:59 -04:00
Pavel Ivashchenko
d741915ecd vtysh: fix searching commands in parent nodes
Do not check parent command nodes in case of ambiguous and incomplete commands

Signed-off-by: Pavel Ivashchenko <pivashchenko@nfware.com>
2019-10-08 12:18:15 +00:00
Quentin Young
d99d43bc4e
Merge pull request #5042 from opensourcerouting/vtysh-nb-cmds
vtysh: add two commands from the northbound
2019-09-24 05:11:00 -04:00
Igor Ryzhov
b0c3638010 vtysh: fix "no log facility" command
Actual command from the library accepts only supported facilities, not
any random word.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2019-09-23 19:43:25 +03:00
Renato Westphal
eba4e1ea9f vtysh: add the "show yang operational-data" command
The right way to implement this command in vtysh is the following:
* Send the command to each running FRR daemon;
* Collect the command output from each daemon;
* Parse the text outputs into libyang lyd_node structures. Then merge
  all these data trees into a single one. Finally, print the merged
  data trees to the standard output (libyang will take care of
  combining duplicate nodes as necessary).

What this commit does is to allow vtysh to send the "show yang
operational-data" command to a single daemon only (the last
parameter).  It's a quick workaround to allow us to write topotests
using YANG-modeled data until we do the real thing (full vtysh
northbound integration).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-09-23 09:38:05 -03:00
Renato Westphal
4ad771401e vtysh: add the "debug northbound" command
This command is defined in the lib/northbound_cli.c file, which
is not being parsed by vtysh since most commands from there need
special handling in the context of vtysh. The "debug northbound"
command, however, can be made available to vtysh without problems.
Introduce a new DEFUNSH to do that.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-09-23 09:38:05 -03:00
Quentin Young
68912a2066 vtysh, lib: allow regexp in find command
¯\_(ツ)_/¯

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-09-03 16:09:52 +00:00
Russ White
996c5b515b
Merge pull request #4797 from opensourcerouting/eigrpd-vrf
eigrpd: vrf support
2019-09-03 09:17:35 -04:00
David Lamparter
ed18356f1f bgpd/bmp: BMP implementation
This implements BMP.  There's no fine-grained history here, the non-BMP
preparations are already split out from here so all that remains is BMP
proper.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-08-30 19:22:23 +02:00
Quentin Young
52038aca4e vtysh: fix rare crash(es)
Couple code paths end up trying to dereference vty->of which can be null
in one special case.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-08-23 20:06:26 +00:00
Sri Mohana Singamsetty
ce935bc284
Merge pull request #4706 from qlyoung/fix-exit-vrf-markfile
vtysh: mark exit-vrf with end when using vtysh -m
2019-08-13 08:40:21 -07:00
Donald Sharp
e944996140 eigrpd: Add router eigrp AS [vrf NAME] and various stuff
Add the ability to parse `router eigrp AS [vrf NAME]` and
modify eigrp_lookup to actually handle a vrf_id for us.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-08-06 22:41:05 -03:00
Quentin Young
3c1c172f02
Merge pull request #4790 from opensourcerouting/ctype-cast
*: fix ctype casts
2019-08-06 13:21:13 -04:00
David Lamparter
fefa5e0ff5 *: fix ctype (isalpha & co.) casts
The correct cast for these is (unsigned char), because "char" could be
signed and thus have some negative value.  isalpha & co. expect an int
arg that is positive, i.e. 0-255.  So we need to cast to (unsigned char)
when calling any of these.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-08-06 16:54:52 +02:00
Igor Ryzhov
c7975431e6 all: remove logical-router functionality
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2019-08-02 17:10:11 +03:00
Quentin Young
2d6e4d2ebc vtysh: style nits for error code cli handler
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-07-29 17:19:05 +00:00
Quentin Young
1f9128d69f vtysh: only show error codes once
When using `show error` commands, show errors shared between multiple
daemons only once.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-07-29 17:18:18 +00:00
Igor Ryzhov
a3988e9cfa vtysh: send vtysh_quit_nexthop_group to pbrd and sharpd
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2019-07-25 11:59:27 +03:00
Igor Ryzhov
b435fc2483 vtysh: send "exit-vrf" command to staticd
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2019-07-24 15:41:20 +03:00
Quentin Young
13f48fd675 vtysh: mark exit-vrf with end when using vtysh -m
VRF context blocks have a context-specific exit command in order to
explicitly force an exit to the top level config node. This command
exists because 'ip route' commands are accepted in both VRF_NODE and
CONFIG_NODE, so static routes intended to be accepted in CONFIG_NODE
that immediately follow a VRF_NODE block will be shoved into the
VRF_NODE block unless the VRF context is explicitly exited.

However, because this is a command that exits to CONFIG_NODE, vtysh -m
should be printing an `end` at the end of the context, since
frr-reload.py relies on this context ender to know when it's back in
CONFIG_NODE. But since this is the only explicit context exit command
that also exits to CONFIG_NODE we don't really have a good way of doing
this already. Hence this god-awful patch.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-07-18 15:29:54 +00:00
Stephen Worley
8ad7c5c2e7 lib: Remove extraneous spacing/output filter cmds
Use %% style for errors in log commands and switch
tabs to a single space in output. Also, remove un-needed
output for success.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-06-19 17:20:24 -04:00
Stephen Worley
f73126c31a lib,vtysh: Add vtysh commands for log-filter
Add vtysh commands to add/del/clear/show filters across
all daemons and independently on each one. Add automake and
clippy boilerplate for those commands as well.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-06-19 17:20:24 -04:00
Stephen Worley
f9ed934c7f vtysh: Make show work-queue execute by name
Update show work-queue to use the execute_name() code
path when dispatching to a specific daemon.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-06-19 17:20:24 -04:00
Stephen Worley
2d96ff08dd vtysh: Execute command on client by name only
Add static function path for exectuting a command
on a client daemon via a string of its name only.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-06-19 17:20:24 -04:00
Stephen Worley
2e77de9516 vtysh: Update vtysh commands with all daemon str
Update the vtysh commands that target all daemons to
use the DAEMONS_* macro.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-06-19 17:20:24 -04:00
Donald Sharp
17f8c65202 pbrd: Allow autocompletion for pbr-map PBRMAP
Allow the end user to auto-complete the pbr-map name.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-05 06:51:08 -04:00
Donald Sharp
868ee86cec lib, pbrd, sharpd, vtysh: Add autocompletion for 'nexthop-group'
Add some auto-completion for the nexthop-group command

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-05 06:33:00 -04:00
Donald Sharp
ce231fbc87
Merge pull request #4430 from lkrishnamoor/hostname_crash
lib: crash when FRR hostname length > 80 chars
2019-05-31 15:02:10 -04:00
Lakshman Krishnamoorthy
63e653a21f lib: crash when FRR hostname length > 80 chars
Although the RFC states hostname length should be < 255 chars,
FRR allows infinite length technically. However, when you try
to set a hostname > 80 chars, you would immediately notice a crash.

RCA: Crash due to buffer overflow. Large buffer sprintf'd into smaller
buffer. Usage of sprintf function instead of snprintf which is safer.

Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-05-31 10:52:33 -07:00
Mark Stapp
85a6806dce lib, vtysh: make debug memstats work in vtysh
Allow vtysh to send the 'debug memstats-on-exit' command
to the running daemons.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-05-30 16:14:25 -04:00
Quentin Young
2e600d7529 vtysh: strcpy -> strlcpy, strcat -> strlcat
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-29 18:03:26 +00:00
Quentin Young
90cf59eccf lib: replace begins_with, add frrstr_endswith
* Change 'begins_with' to 'frrstr_startswith' for consistency
* Add suffix checker, frrstr_endswith()
* Update vtysh to use the new function

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-23 20:52:01 +00:00
Quentin Young
a8144d7fc8 vrrpd: interface support
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17 00:27:08 +00:00
Dinesh Dutt
dc1c13c019 lib, vtysh: Make archaic "terminal" optional in configure command
The 'configure terminal' command is a bit redundant, so make
the terminal portion optional.

Signed-off-by: Dinesh Dutt <dd.ps4u@gmail.com>
2019-05-07 21:06:00 -04:00
Donald Sharp
6873d66a26 vtysh: Fixup exit nexthop-group to include sharpd
The exit of the nexthop-group should know about sharpd

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-04-27 14:09:05 +00:00
Renato Westphal
8f88441d71 Merge remote-tracking branch 'frr/master' into rip-vrf
Merge commit to solve a bunch of conflicts with other PRs that were
merged in the previous weeks.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-03-29 11:32:21 -03:00
Rafael Zalamena
64e4a6c56f vtysh: hide old BGP vpnv(4|6) commands
Only show them when explicit compiled with KEEP_OLD_VPN_COMMANDS.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-02-28 11:15:15 -03:00
David Lamparter
1569f22439 vtysh: fix pager compatibility handling
I just straight up forgot checking VTYSH_PAGER at startup, and the
"terminal paginate" command is only installed to VIEW_NODE so it can't
be processed from vtysh.conf in CONFIG_NODE...

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-02-19 14:06:01 +01:00
Donatas Abraitis
462ea14a8d vtysh: Fix typo in function name
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-02-11 18:38:35 +02:00
Ruben Kerkhof
4d762f2607 Treewide: use ANSI function definitions
Signed-off-by: Ruben Kerkhof <ruben@rubenkerkhof.com>
2019-01-24 11:21:59 +01:00
Renato Westphal
dde7b15b83 ripngd: add VRF support
* Turn the "instance" YANG presence-container into a YANG list keyed
  by the new "vrf" leaf. This is a backward incompatible change but
  this should be ok for now.

* RIPng VRF instances can be configured even when the corresponding
  VRF doesn't exist. And a RIPng VRF instance isn't deleted when
  the corresponding VRF is deleted. For this to work, implement the
  ripng_instance_enable() and ripng_instance_disable() functions
  that are called to enable/disable RIPng routing instances when
  necessary. A RIPng routing instance can be enabled only when the
  corresponding VRF is enabled (this information comes from zebra
  and depends on the underlying VRF backend). Routing instances are
  stored in the new ripng_instances rb-tree (global variable).

* Add a vrf pointer to the ripng structure instead of storing vrf_id
  only. This is much more convenient than using vrf_lookup_by_id()
  every time we need to get the vrf pointer from the VRF ID. The
  ripng->vrf pointer is updated whenever the VRF enable/disable hooks
  are called.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-01-18 16:15:41 -02:00
Renato Westphal
ae7b826a23 ripd: add VRF support
* Turn the "instance" YANG presence-container into a YANG list keyed
  by the new "vrf" leaf. This is a backward incompatible change but
  this should be ok for now.

* RIP VRF instances can be configured even when the corresponding
  VRF doesn't exist. And a RIP VRF instance isn't deleted when
  the corresponding VRF is deleted. For this to work, implement the
  rip_instance_enable() and rip_instance_disable() functions that are
  called to enable/disable RIP routing instances when necessary. A
  RIP routing instance can be enabled only when the corresponding
  VRF is enabled (this information comes from zebra and depends on
  the underlying VRF backend). Routing instances are stored in the new
  rip_instances rb-tree (global variable).

* Add a vrf pointer to the rip structure instead of storing vrf_id
  only. This is much more convenient than using vrf_lookup_by_id()
  every time we need to get the vrf pointer from the VRF ID. The
  rip->vrf pointer is updated whenever the VRF enable/disable hooks
  are called.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-01-18 16:15:41 -02:00
Donald Sharp
81dd71eb68 sharpd/vtysh: Allow sharpd to use nexthop-groups
Allow the sharp daemon to understand and use nexthop-groups.

This commit is merely to allow sharpd to understand them
when accepted in a future commit

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-02 09:46:33 -05:00
David Lamparter
76fd52625d vtysh: rework/straighten pager handling
- 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-12-06 23:05:48 +01:00
Donald Sharp
b2443937b0 vtysh: Don't attempt to reconnect the non-instanced ospf process
When running ospf instances we should not attempt to reconnect
the default ospf instance on running a command.

This commit should be targeted enough because in the case
of normal operation we connect to everything we should
and only set the VTYSH_WAS_ACTIVE flag for those we
truly have lost connection too.

Before:

donna.cumulusnetworks.com# config t
donna.cumulusnetworks.com(config)# router ospf 100
Warning: connecting to ospfd...failed!
donna.cumulusnetworks.com(config-router)#

After:
donna.cumulusnetworks.com# conf t
donna.cumulusnetworks.com(config)# router ospf 100
donna.cumulusnetworks.com(config-router)# end
donna.cumulusnetworks.com#

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-11-21 16:15:38 -05:00
Donald Sharp
093e3f23f6 bgpd, lib, vtysh, zebra: Convert to using CMD_VNI_RANGE
For the vni range use a macro to keep track of it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-31 06:23:32 -04:00
Donald Sharp
3a3a24c869 vtysh: Allow eigrp and rip access to keychain.c config
The key-chain code was specific to rip and as such was not
being delivered to eigrp.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-24 19:54:04 -04:00
David Lamparter
25aea4b231
Merge pull request #3175 from donaldsharp/show_run_static
vtysh: Add some missing daemons to some commands in vtysh
2018-10-23 12:46:09 +02:00
Donald Sharp
2dd0b3f492 vtysh: Add some missing daemons to some commands in vtysh
Fixes: #3173
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-14 19:04:58 -04:00
Donald Sharp
7ab57d19ce lib, vtysh: Allow notification across multiple lines of failure
When reading in config files and we have failures on multiple
lines actually note the actual failure lines and return them.
This fixes an issue where we stopped counting errors after
the first one and we got missleading line numbers that
did not correspond to the actual problem.

This is fixed:
sharpd@donna ~/frr> sudo /usr/lib/frr/pimd --log=stdout -A 127.0.0.1 -f /etc/frr/pimd.conf
2018/10/11 09:41:01 PIM: VRF Created: default(0)
2018/10/11 09:41:01 PIM: pim_vrf_enable: for default
2018/10/11 09:41:01 PIM: zclient_lookup_sched_now: zclient lookup immediate connection scheduled
2018/10/11 09:41:01 PIM: zclient_lookup_new: zclient lookup socket initialized
2018/10/11 09:41:01 PIM: pimd 6.1-dev starting: vty@2611
2018/10/11 09:41:01 PIM: [EC 100663304] ERROR: No such command on config line 2: inteface lo
2018/10/11 09:41:01 PIM: [EC 100663304] ERROR: No such command on config line 3: ip igmp
2018/10/11 09:41:01 PIM: [EC 100663304] ERROR: No such command on config line 4: ip igmp join 224.1.1.1 13.13.13.2
^C2018/10/11 09:45:09 PIM: Terminating on signal SIGINT
2018/10/11 09:45:09 PIM: VRF Deletion: default(0)

Fixes: #3161
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-11 09:46:40 -04:00
David Lamparter
086aec2ad4 vtysh: make RPKI node non-conditional
Whether or not RPKI is enabled during build shouldn't really influence
vtysh; the user can always manually install bgpd_rpki.so later and it
should work.  This also means that the behaviour of "RPKI module not
loaded" is consistent regardless of whether it was a compile-time or
runtime decision.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-08 21:30:42 +02:00
Donald Sharp
714e135429
Merge pull request #2875 from opensourcerouting/fabricd
OpenFabric support
2018-09-08 13:48:48 -04:00
Donald Sharp
7c70dc57e0 vtysh: Actually make the new_completion function match
The new_completion function was not declared the same
way the rl_attempted_completion_function pointer was.
The only difference was a 'const char *' -vs- 'char *'
So convert it over.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-08 12:00:17 -04:00
Christian Franke
770ccdf874 vtysh: support fabricd
Extend extract.pl so it can deal with the isis source code being
compiled twice, once for isisd and once for fabricd.

Add the fabricd node and client to vtysh.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2018-09-05 11:38:12 +02:00
Quentin Young
61a484a90a bgpd: fix rpki exit command
If a command returns a nonzero exit status and VTYSH has a corresponding
command, VTYSH will skip executing its own version. If this happens in a
command that changes CLI nodes we get node desynchronization.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-23 16:10:12 +00:00
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
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
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
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
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
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
paco
a0c14c5400
vtysh: null dereference (Coverity 1469896)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-11 19:42:03 +02: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
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
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
Quentin Young
869f55865f vtysh: fix failure to write config w/o watchfrr
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-30 03:28:10 -04:00
Donald Sharp
97722e560e
Merge pull request #2110 from msablic/pim_mtrace_group
pimd: adding querying of state to mtrace
2018-04-24 20:08:06 -04:00
Mark Stapp
d991a3ea84 vty: use 'do' for show memory and show modules
show mem and show modules won't work in config modes without
passing 'do' to other running daemons.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-04-24 15:47:33 -04:00
Mladen Sablic
71e55fb257 pimd: adding querying of state to mtrace
Adding to mtracebis querying with group address. Same change
to vtysh mtrace command. Support for querying (S,G) and (*,G)
state in mtrace router code. Further improvments to mtrace router
code with closer complience to IETF draft. More references in
comments to the draft. Man page has been updated accordingly.

Signed-off-by: Mladen Sablic <mladen.sablic@gmail.com>
2018-04-24 18:47:50 +02:00
Quentin Young
26fbe47294 lib: add ability to dump cli mode graph
The grammar sandbox has had the ability to dump individual commands as
DOT graphs, but now that generalized DOT support is present it's trivial
to extend this to entire submodes. This is quite useful for visualizing
the CLI space when debugging CLI errors.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-22 17:14:55 -04:00