Commit Graph

517 Commits

Author SHA1 Message Date
Donatas Abraitis
0d6f7fd6fd *: Replace sizeof something to sizeof(something)
Satisfy checkpatch.pl requirements (check for sizeof without parenthesis)

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-08 21:44:53 +02:00
Donatas Abraitis
752022670a *: Remove break after return
Just a deadcode.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-02-13 15:39:54 +02:00
Donatas Abraitis
95f7965d09 *: Remove parenthesis on return for constants
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-02-09 14:21:56 +02:00
Quentin Young
b3ba5dc7fe *: don't null after XFREE; XFREE does this itself
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-02-03 11:22:13 -05:00
Mark Stapp
874f579d64 vtysh: add a cli that reads a file into running-config
Add a 'copy' cli that reads a file into the current running
config. Add an entry about the new cli to the user doc.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-01-23 14:48:06 -05:00
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
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
Quentin Young
371fdacc47 vtysh: remove exit-vrf for vtysh -m
How It's Made:

- vtysh -m is for frr-reload.py to know when a context ends. This is
  done by executing commands against the CLI graph, checking for walkup,
  and putting the appropriate context exit if walkup is necessary. Thus
  the default case for walking up from a vrf context is fine, and
  doesn't need a specific exit-vrf command. Remove that.

- exit-vrf needs to be explicitly printed at the end of vrf config
  printing. We already do this.

- vtysh's special snowflake config prettiness logic needs to know that
  exit-vrf goes with the vrf block and needs to be explicitly told not
  place this in alphabetical order in that block. We also already do
  this.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-17 14:26:36 -04:00
Quentin Young
c319e19dbd vtysh, zebra: print exit-vrf at end of vrf context
Need to explicitly exit this context otherwise we risk ambiguities
between global and vrf context commands

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-17 14:26:25 -04:00
Russ White
058054cac1
Merge pull request #1903 from donaldsharp/PBRD
Pbrd
2018-04-11 09:06:45 -04:00
Jafar Al-Gharaibeh
aa2fc55b20
Merge pull request #1982 from qlyoung/fixup-vtysh-read
vtysh: fixup incorrect read logic
2018-04-10 13:20:00 +04:00
Donald Sharp
e5c83d9b31 pbrd: Add PBR to FRR
This is an implementation of PBR for FRR.

This implemenation uses a combination of rules and
tables to determine how packets will flow.

PBR introduces a new concept of 'nexthop-groups' to
specify a group of nexthops that will be used for
ecmp.  Nexthop-groups are specified on the cli via:

nexthop-group DONNA
  nexthop 192.168.208.1
  nexthop 192.168.209.1
  nexthop 192.168.210.1
!

PBR sees the nexthop-group and installs these as a default
route with these nexthops starting at table 10000
robot# show pbr nexthop-groups
Nexthop-Group: DONNA Table: 10001 Valid: 1 Installed: 1
	Valid: 1  nexthop 192.168.209.1
	Valid: 1  nexthop 192.168.210.1
	Valid: 1  nexthop 192.168.208.1

I have also introduced the ability to specify a table
in a 'show ip route table XXX' to see the specified tables.

robot# show ip route table 10001
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, P - PIM, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR,
       > - selected route, * - FIB route

F>* 0.0.0.0/0 [0/0] via 192.168.208.1, enp0s8, 00:14:25
  *                 via 192.168.209.1, enp0s9, 00:14:25
  *                 via 192.168.210.1, enp0s10, 00:14:25

PBR tracks PBR-MAPS via the pbr-map command:

!
pbr-map EVA seq 10
  match src-ip 4.3.4.0/24
  set nexthop-group DONNA
!
pbr-map EVA seq 20
  match dst-ip 4.3.5.0/24
  set nexthop-group DONNA
!

pbr-maps can have 'match src-ip <prefix>' and 'match dst-ip <prefix>'
to affect decisions about incoming packets.  Additionally if you
only have one nexthop to use for a pbr-map you do not need
to setup a nexthop-group and can specify 'set nexthop XXXX'.

To apply the pbr-map to an incoming interface you do this:

interface enp0s10
 pbr-policy EVA
!

When a pbr-map is applied to interfaces it can be installed
into the kernel as a rule:

[sharpd@robot frr1]$ ip rule show
0:	from all lookup local
309:	from 4.3.4.0/24 iif enp0s10 lookup 10001
319:	from all to 4.3.5.0/24 iif enp0s10 lookup 10001
1000:	from all lookup [l3mdev-table]
32766:	from all lookup main
32767:	from all lookup default

[sharpd@robot frr1]$ ip route show table 10001
default proto pbr metric 20
	nexthop via 192.168.208.1 dev enp0s8 weight 1
	nexthop via 192.168.209.1 dev enp0s9 weight 1
	nexthop via 192.168.210.1 dev enp0s10 weight 1

The linux kernel now will use the rules and tables to properly
apply these policies.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-06 13:22:43 -04:00
Russ White
d2fe1ab813
Merge pull request #1998 from qlyoung/fix-vrf-keyword-walkup
lib, vtysh: vrf walkup bugfix
2018-04-04 20:51:02 -04:00
Quentin Young
fe53c680b5
vtysh: fixup incorrect read logic
If a daemon sent vtysh a response whose size satisfied

1 <= 4096 - (size % 4096) <= 2

vtysh would hang.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-04 17:04:18 -04:00
Quentin Young
2d75202acc
Merge pull request #1894 from LabNConsulting/working/master/vtysh-not-enabled
vtysh: add -u/--user flag to run commands without enable
2018-04-03 11:50:35 -04:00
Quentin Young
7d3ffd35ea
lib: remove MASC_NODE
Unused

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-30 17:45:41 -04:00
Quentin Young
16d6ea59d3
lib, vtysh: vrf walkup bugfix
Static route commands are now installed inside the VRF nodes. This has
quietly broken top-level static routes in certain scenarios due to
walkup logic resolving a static route configuration command inside
VRF_NODE first if the command is issued while in a CLI node lower than
VRF_NODE. To fix this VRF_NODE needs a special exit command, as has been
done for many other nodes with the same issue, to explicitly change the
vrf context to the default VRF so that when walkup resolves against the
VRF node it will configure against the default VRF as desired.

Of course this is a hack on top of a hack and the CLI walkup
implementation needs to be rewritten.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-30 13:14:34 -04:00
Russ White
d989640c0a
Merge pull request #1978 from qlyoung/fix-debug-all-vtysh-node
vtysh: fix node install of `[no] debug all`
2018-03-30 10:44:14 -04:00
Philippe Guibert
e7d78d0f2c vtysh: add flowspec address family cmd support
add flowspec v4 and flowspec v6 address family support for BGP.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-03-30 14:01:06 +02:00
Quentin Young
eb68fbc613
vtysh: fix node install of [no] debug all
Command belongs in ENABLE_NODE, not VIEW_NODE.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-28 10:57:52 -04:00
Lou Berger
186f6af280 vtysh: move user_mode to header file, keep checkpatch happy
Signed-off-by: Lou Berger <lberger@labn.net>
2018-03-28 10:47:34 -04:00
Lou Berger
86b286101b vtysh: add -u/--user flag to run commands without enable
Signed-off-by: Lou Berger <lberger@labn.net>
2018-03-28 10:47:34 -04:00
Quentin Young
d7c0a89a3a
*: use C99 standard fixed-width integer types
The following types are nonstandard:
- u_char
- u_short
- u_int
- u_long
- u_int8_t
- u_int16_t
- u_int32_t

Replace them with the C99 standard types:
- uint8_t
- unsigned short
- unsigned int
- unsigned long
- uint8_t
- uint16_t
- uint32_t

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-27 15:13:34 -04:00
Quentin Young
470bc61919
watchfrr, vtysh: do not write config during crash
If a daemon is restarting, crashed, or otherwise in the process of
reconnecting to watchfrr and a user issues "write memory" or "write
file" the resulting config will not include the configuration of that
daemon. This is problematic because this output will overwrite the
previous config, potentially causing unintentional loss of configuration
stored only in the config file based upon timing.

This patch remedies that by making watchfrr check that all daemons are
up before attempting a configuration write, and updating vtysh so that
its failsafe respects this condition as well.

Note that this issue only manifests when using integrated config.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-21 03:11:02 -04:00
G. Paul Ziemba
b9c7bc5ab0 bgpd: new vpn-policy CLI
PR #1739 added code to leak routes between (default VRF) VPN safi and unicast RIBs in any VRF. That set of changes included temporary CLI including vpn-policy blocks to specify RD/RT/label/&c. After considerable discussion, we arrived at a consensus CLI shown below.

The code of this PR implements the vpn-specific parts of this syntax:

router bgp <as> [vrf <FOO>]
    address-family <afi> unicast
        rd (vpn|evpn) export (AS:NN | IP:nn)
        label (vpn|evpn) export (0..1048575)
        rt (vpn|evpn) (import|export|both) RTLIST...
        nexthop vpn (import|export) (A.B.C.D | X:X::X:X)
        route-map (vpn|evpn|vrf NAME) (import|export) MAP

        [no] import|export [vpn|evpn|evpn8]
        [no] import|export vrf NAME

User documentation of the vpn-specific parts of the above syntax is in PR #1937

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-03-19 22:13:43 -07:00
paulzlabn
3f1224cd1a
Merge branch 'master' into working/master/bgp-vpn-vrf-leaking 2018-03-14 13:31:58 -07:00
Lou Berger
b86543b804 vtysh: restore some DEFUNs that should not have been reformated by indent.py 2018-03-13 05:46:03 -04:00
G. Paul Ziemba
fd9b55a2b7 vtysh: add bgpd vpn-policy nodes
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-03-09 16:42:40 -05:00
Donald Sharp
dba32923eb lib, vtysh: Start cli for nexthop-group
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-09 11:07:41 -05:00
Renato Westphal
c67667e74c
Merge pull request #1808 from qlyoung/debug-mt-safe
MT-safe debug facilities
2018-03-09 11:25:37 -03:00
Lou Berger
996c93142d *: conform with COMMUNITY.md formatting rules, via 'make indent'
Signed-off-by: Lou Berger <lberger@labn.net>
2018-03-06 14:04:32 -05:00
Christian Franke
4a9746fdd0 vtysh: initialize vty structure correctly for output to terminal
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2018-03-06 01:37:49 +01:00
Quentin Young
aea03ad6e8
lib: add mt-safe debugging facilities
The current strategy for fine-grained debugging across FRR is to use
static long int bitfields, in combination with helper macros that are
copy-pasted between daemons, to hold state on what debugging information
should be collected at any given time. This has a couple of problems:

* These bitfields are generally extern'd and accessed everywhere, so
  they are not MT-safe or easy to make MT-safe
* Lots of code duplication from copy-pasting the DEBUG_* macros...
* Code duplication because of the "term" vs "conf" debugging concept

This patch aims to remedy that by providing some infrastructure to work
with debugs. The core concept of using bitfields has been retained, but
the number of these for each debug has been reduced to 1. This allows
easy use of lock-free methods for synchronizing access to debugging
info.

The helper macros have also been retained but they are now collected in
one place and perform exclusively atomic operations.

Finally there is a bit of code that allows daemons to register
callbacks, which I used to implement a command that will toggle all
debugging for any daemons that use these facilities.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-01 15:01:25 -05:00
Christian Franke
546067dfb1 vtysh: Fix missing \n at end of desc string 2018-02-27 15:34:23 +01:00
Philippe Guibert
f5d20fdb4e vtysh: change logical router node name
The logical router node goes from NS_NODE to LOGICALROUTER_NODE.
Vty commands are renamed accordingly.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-02-27 11:11:24 +01:00
Mladen Sablic
4d9ad5dcd0 pimd: Multicast traceroute client and router
This commit is the implementation of weak multicast traceroute.
It consists of IGMP module dealing with mtrace type IGMP messages
and client program mtrace/mtracebis for initiating mtrace queries.

Signed-off-by: Mladen Sablic <mladen.sablic@gmail.com>
2018-02-19 23:13:55 +01:00
Renato Westphal
a7ce0ad1da *: silence '-Wchar-subscripts' warnings on NetBSD
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-02-02 16:31:20 -02:00
Russ White
7c0c85a2eb
Merge pull request #1634 from qlyoung/vtysh-output-file
vtysh: add ability to output to file
2018-01-16 15:31:50 -05:00
Quentin Young
193a5a9579
vtysh: add ability to output to file
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>
2018-01-12 12:38:45 -05:00
Quentin Young
08ee8e2231
vtysh: optimize printout routine
When printing responses from a client, vtysh searches through every
response it receives twice. Once is to look for the terminating
sequence and the other is to translate \n to \0, which is used with the
line processing callback capability. However:

* There's no need to search all of the output for the terminator, we can
  just check the last 4 bytes.
* In most scenarios we won't have a callback. Therefore we don't need to
  process the output and can just dump it.

Together these optimizations have a significant impact on the total
runtime of talkative CLI commands, such as `sh ip bgp json` which runs
roughly 1000% faster when dumping 1,000,000 routes.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-01-08 16:55:36 -05:00
Renato Westphal
895352efd8
Merge pull request #1445 from donaldsharp/rpki_vtysh
vtysh: If RPKI is not compiled in don't let vtysh think it is.
2017-11-28 14:44:39 -02:00
Donald Sharp
8a71d93d85 sharpd: Add Super Happy Advanced Routing Protocol
Add a daemon that will allow us to test the zapi
as well as test route install/removal times from
the kernel.

The current commands are:

install route <starting ip address> nexthop <nexthop> (1-1000000)

This command starts installing at <starting ip address>/32
(1-100000) routes that it auto-increments by 1
Installation start time is noted in the log and finish
time is noted as well.

remove routes <starting ip address> (1-1000000)

This command removes routes at <starting ip address>/32
and removes (1-100000) routes created by the install route
command.

This code can be considered experimental and *is not*
something that should be run in a production environment.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-11-27 09:16:30 -05:00
Donald Sharp
23489cb09c vtysh: If RPKI is not compiled in don't let vtysh think it is.
The RPKI code can be turned on/off via configure switches.
If we have intentionally turned it off do not let vtysh
display that you can config it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-11-14 09:25:04 -05:00
Marcel Röthke
dabecd7c63 bgpd: Add RPKI/RTR support
This commit adds support for the RTR protocol to receive ROA
information from a RPKI cache server. That information can than be used
to validate the BGP origin AS of IP prefixes.
Both features are implemented using [rtrlib](http://rtrlib.realmv6.org/).

Signed-off-by: Marcel Röthke <marcel.roethke@haw-hamburg.de>
2017-11-10 14:37:52 +01:00
Quentin Young
9320658c0d
vtysh: protect null deref for cli completions
cmd_describe_command() returns NULL when there is no matched command, so
check the return value before trying to free it

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-11-02 11:53:24 -04:00
Renato Westphal
80c872f699 vtysh: properly fix memory leak
Commit 44f12f20 fixed the memory leak in the wrong way and introduced a
"uninitialized variable" warning.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-25 07:56:42 -02:00
Renato Westphal
44f12f209f *: fix coverity warnings - resource leaks
These are mostly trivial fixes for leaks in the error path of some functions.

The changes in bgpd/bgp_mpath.c deserves a bit of explanation though. In
the bgp_info_mpath_aggregate_update() function, we were allocating memory
for the lcomm variable but doing nothing with it. Since the code for
communities, extended communities and large communities is pretty much
the same in this function, it's clear that this was a copy and paste
error where most of the ext. community code was copied but not all of
it as it should have been.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-24 19:30:30 -02:00
Chirag Shah
b5a8894de6 ospfd: OSPFv2 VRF Support
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-10-03 09:15:19 -07:00
Quentin Young
91fd1b8d9c
vtysh: more multi-instance fixing
Preexisting code to detect commands targeted at wrong instance didn't
work because a command applied to a disconnected vtysh_client counted as
a successful run overriding wrong instance error message

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-09-28 14:01:05 -04:00