Commit Graph

412 Commits

Author SHA1 Message Date
Mark Stapp
7183a034d1 vtysh: add an alias for the nexthop-group config targets
Use an alias for the daemons who process the nexthop-group
config cli; makes it easier to expand that list in the future.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-12-17 09:56:26 -05:00
Emanuele Di Pascale
609ac8dd49 tools, vtysh: improved fix for ldpd ifaces
instead of suppressing the 'exit' markers at the end of each
'interface XXX' clause in the mpls ldp configuration, mark
those with a special marker 'exit-ldp-if' and teach the
reload script to correctly recognize the new sub-subcontext

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
2019-11-12 15:36:15 +01:00
Emanuele Di Pascale
ccef6e47a3 tools, vtysh: fix ldpd + frr-reload.py
frr-reload.py has many special case rules that did not consider ldpd
at all. Specifically:

 1. The bulk of ldp configuration comes in a big 'mpls ldp' context, which was
    previously considered a single-line context as it started with 'mpls'. This
    rule should only apply to labels and lsps.
 2. ldp has a 'router-id' config line that fell into the same rule as the above
    one. It should not be considered a single-line context as more ldp
    configuration can follow.
 3. enabled interfaces should not end their context. A better fix
    would actually require popping a new context for each interface
    in case there is any interface-specific config, but at least this
    fix will address the most common use case.
 4. when declaring pseudowires, any line with 'member pseudowire XXX' should
    be considered a sub-context of the 'l2vpn YYY type ZZZ' context. Without
    this fix, changes in the first psuedowire declared would not correctly
    be processed (e.g. removing a 'control-word exclude' line would not
    be picked up).

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
2019-10-29 10:32:38 +01:00
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