Commit Graph

465 Commits

Author SHA1 Message Date
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
9f73d2c9b6 lib: remove some strcpy, strcat
Replace with strlcpy, strlcat

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-29 18:02:57 +00:00
Quentin Young
2fff50ec01 vrrpd, lib: style fixes
Fixup:
* Blank lines after declarations
* Trailing whitespace
* Braces and parentheses

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17 00:27:08 +00:00
Quentin Young
f828842a69 vrrpd: add support for configuration writing
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17 00:27:08 +00:00
Quentin Young
d8b87afe7c lib: hashing functions should take const arguments
It doesn't make much sense for a hash function to modify its argument,
so const the hash input.

BGP does it in a couple places, those cast away the const. Not great but
not any worse than it was.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-14 21:23: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
Renato Westphal
83981138fe lib: introduce a read-write lock for northbound configurations
The upcoming gRPC-based northbound plugin will run on a separate
pthread, and it will need to have access to the running configuration
global variable.  Introduce a rw-lock to control concurrent access
to the running configuration. Add the lock inside the "nb_config"
structure so that it can be used to protect candidate configurations
as well (this might be necessary depending on the threading scheme
of future northbound plugins).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-04-26 18:04:22 -03:00
Quentin Young
0a22ddfbb1 *: remove null check before XFREE
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-02-25 23:00:46 +00:00
Renato Westphal
c139972c0f lib: rename enum to avoid conflict
Two different definitions of "enum filter_type" exist in libfrr:
one in lib/filter.h and other in lib/command_match.h. Rename one
of them to resolve a conflict that happens when both headers are
included by the same file.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-02-11 22:34:12 -02:00
David Lamparter
d4160947d9 lib: don't disable "log file" on "log syslog"
FRR log targets are independent, so "log syslog" must not disable
"log file" output.

Fixes: #3551
Fixes: 0204baa876
Signed-off-by: David Lamparter <equinox@diac24.net>
2019-01-24 19:06:00 +01: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
cf09d3ca45 lib: simplify detection of when the user is leaving the CLI config mode
We can make use of the vty->config variable to know when the CLI
user is in the configuration mode or not. This is much simpler
than obtaining this information from the vty node, and also a more
robust solution (the three switch statements below, for example,
were out of sync).

Also, fix a bug where vty->config wasn't being unset in the
vty_config_exit() function (bug introduced by commit f344c66ea3).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-01-19 16:07:30 -02:00
Renato Westphal
41e195d477 lib: reset the vty xpath index when entering the config mode
The CLI code uses the vty->xpath[] array and the vty->xpath_index
variables to keep track of where the user is in the configuration
hierarchy. As such, we were resetting vty->xpath_index to zero
whenever the user exited from the configuration mode in order to
keep the index valid. We weren't doing this in the vty_stop_input()
function however, which is called when the user types ^C in the
terminal. This was leading to bugs like this:

  zebra> en
  zebra# conf t
  zebra(config)# interface eth0
  zebra(config-if)# ^C
  zebra# conf t
  zebra(config)# interface eth0
  % Configuration failed.

  Schema node not found.
  YANG path: /frr-interface:lib/interface[name='eth0'][vrf='default']/frr-interface:lib

To fix this, do something more clever: instead of resetting the
XPath index whenever the user exits from the configuration mode,
do that when the user enters in the configuration mode. This way
the XPath index needs to be reset in a single place only, not to
mention it's a more robust solution.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-01-19 15:56:54 -02:00
Donald Sharp
0ee78eafbd
Merge pull request #3378 from opensourcerouting/remove-config-lock
*: remove the configuration lock from all daemons
2018-11-30 18:50:49 -05:00
Renato Westphal
f344c66ea3 *: remove the configuration lock from all daemons
A while ago all FRR configuration commands were converted to use the
QOBJ infrastructure to keep track of configuration objects. This
means the configuration lock isn't necessary anymore because the
QOBJ code detects when someones tries to edit a configuration object
that was deleted and react accordingly (log an error and abort the
command).  The possibility of accessing dangling pointers doesn't
exist anymore since vty->index was removed.

Summary of the changes:
* remove the configuration lock and the vty_config_lockless() function.
* rename vty_config_unlock() to vty_config_exit() since we need to
  clean up a few things when exiting from the configuration mode.
* rename vty_config_lock() to vty_config_enter() to remove code
  duplication that existed between the three different "configuration"
  commands (terminal, private and exclusive).

Configuration commands converted to the new northbound model don't
need the configuration lock either since the northbound API also
detects when someone tries to edit a configuration object that
doesn't exist anymore.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-11-26 16:47:35 -02:00
Renato Westphal
a6233bfcb3 lib, ripd: rework API for converted CLI commands
When editing the candidate configuration, the northbound must ensure
that either all changes made by a command are accepted or none are.
This is done to prevent inconsistent states where only parts of a
command are applied in the event any error happens.

The previous API for converted commands, the nb_cli_cfg_change()
function, required callers to pass an array containing all changes
that needed to be applied in the candidate configuration. The
problem with this API is that it was very inconvenient for complex
commands, which change different configuration options depending
on several factors.  This required users to manipulate the array
of configuration changes using low-level primitives, making it
complicated to implement some commands.

To solve this problem, introduce a new API based on the two following
functions:
- nb_cli_enqueue_change()
- nb_cli_apply_changes()

The first function is used to enqueue configuration changes, one
at time. Then the nb_cli_apply_changes() function is used to apply
all the enqueued configuration changes.

To implement this, a static-sized array was allocated in the "vty"
structure, along with a counter of enqueued changes. This eliminates
the need to declare an array of configuration changes in every
converted CLI command, simplifying things quite considerably.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-11-26 15:57:23 -02:00
Renato Westphal
1c2facd12d lib: introduce new northbound API
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-10-27 16:16:12 -02:00
Donald Sharp
b45d8ccc32 lib: If command was successful don't store the command as an error
The CMD_SUCCESS_DAEMON case should be excluded from storing the command line
that we think failed.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-24 21:03:18 -04:00
Donald Sharp
74df8d6d9d *: Replace hash_cmp function return value to a bool
The ->hash_cmp and linked list ->cmp functions were sometimes
being used interchangeably and this really is not a good
thing.  So let's modify the hash_cmp function pointer to return
a boolean and convert everything to use the new syntax.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-19 13:14:45 -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
6a154c8812 *: list_delete_and_null() -> list_delete()
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-02 11:40:52 +02:00
Quentin Young
e8275c22b4
Merge pull request #3040 from pacovn/static_analysis__drop_const_1
bgpd isisd ldpd lib: const drop fixes (SA)
2018-09-17 15:25:49 -04:00
F. Aragon
36de6e0e1e
bgpd isisd ldpd lib: const drop fixes (SA)
Can be detected with e.g. ./configure CFLAGS=-Wcast-qual CC=clang

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-09-17 19:38:59 +02:00
Quentin Young
450971aa99 *: LIB_[ERR|WARN] -> EC_LIB
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-13 19:34:28 +00:00
Donald Sharp
4bb7d4482d
Merge pull request #2994 from opensourcerouting/sa-warnings
fix remaining SA warnings
2018-09-08 21:04:54 -04:00
David Lamparter
4f4060f6ab *: fix clang-6 SA warnings
I don't see these in CI, but my local clang-6 does emit warnings for
these.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-08 20:34:35 +02:00
Christian Franke
7c0cbd0e88 fabricd: add new daemon as build of isisd
fabricd is built using the sources of isisd. To allow differentiation
in the code, -DFABRICD=1 is added to its preprocessor flags.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2018-09-05 11:38:12 +02:00
Quentin Young
09c866e34d *: rename ferr_zlog -> flog_err_sys
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14 20:02:05 +00:00
Quentin Young
af4c27286d *: rename zlog_fer -> flog_err
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14 20:02:05 +00:00
Donald Sharp
481bc15ffc lib: Add LIB_ERR_SYSTEM_CALL and convert VRF_SOCKET to SOCKET
Add a new error code LIB_ERR_SYSTEM_CALL to the ferr subsystem.
Additionally convert LIB_ERR_VRF_SOCKET to a more generic
LIB_ERR_SOCKET.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-14 20:02:05 +00:00
Donald Sharp
d6853655b5
Merge branch 'master' into bfd-final 2018-08-14 08:16:10 -04:00
Donald Sharp
0ce1ca805d *: ALLOC calls cannot fail
There is no need to check for failure of a ALLOC call
as that any failure to do so will result in a assert
happening.  So we can safely remove all of this code.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-11 17:14:58 +02: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
Quentin Young
cf6bc77d28
Merge pull request #2503 from pacovn/Coverity_1469898_Uninitialized_scalar_variable
lib: uninitialized variable (2) (Coverity 1469898)
2018-06-26 11:35:58 -04: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
paco
74e7158c06
lib: null check (Coverity 1470150)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-22 23:03:24 +02:00
paco
a6a87d63d0
lib: uninitialized variable (2) (Coverity 1469898)
Previous correction (2c2d5cb397) was not enough,
so now it is ensured that the argument shift is not negative nor zero.

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-22 21:18:35 +02:00
Donald Sharp
e9b4e74a78 lib: Add --log-level to daemons
Add the ability to specify the designated log level at startup.

--log-level <emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-19 09:02:21 -04:00
Donald Sharp
f8507817cf lib: Add new cli to specify where to output logs on startup
When we are starting a daemon, allow the user to specify:

--log <stdout|syslog|file:file_name>

This can be used on early startup to put the log files
where the end user wants them to show up.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-19 08:43:59 -04:00
paco
9f227e4c91
lib: null return value check (Coverity 1469894)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-12 16:37:36 +02:00
Quentin Young
0b42d81ab8 lib: fix output mangling with | include
Sometimes output would be mangled when filtering with include as a
result of the following bugs:

* Filters were applied per each call to vty_out() instead of buffering
  until a line break and then applying
* Long output would sometimes be cut due to using the wrong buffer
  pointer

Also remove the trailing \n as it should no longer be necessary to
ensure the vty prompt ends up on a new line.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-06 19:09:44 +00:00
Quentin Young
f428cb8a3a lib: add vector_compact(), use after str splits
* Add function to move all data to the start of a vector by shifting
  over contiguous empty slots
* Use this function to remove empty slots leftover after
  frrstr_filter_vec

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-06 16:16:12 +00: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
62bece4449 lib: add vector_remove() to vector.[ch]
An optimized version of this has already been implemented within graph.c
that assumes some specialized constraints for that code. It's generally
useful so this change implements a general purpose version of it.

This fixes cmd_make_strvec() that was broken by some code shuffling in
previous commits.

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

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-06 16:16:10 +00:00
Quentin Young
fe6b47b9e9 lib: add cli preprocessor for | actions
This patch adds a CLI preprocessor function that activates when `|` is
found in the command. This is the start of adding support for some text
processing utilities intended for inline use. The first one implemented
here is `| include`, which provides grep-like filtering of command
output.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-06 16:15:34 +00:00
Quentin Young
01e24c4a69 lib: add hook for preprocessing commands
This patch adds a hook point intended to allow subscribers to modify the
raw text of a CLI command before it is passed to the rest of the CLI
pipeline. To give access to the raw text of the command, a new function
for executing CLI has been defined whose only difference from
`cmd_execute_command` is that it accepts the command to execute as a
string rather than as a string vector.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-06 16:15:34 +00:00
Quentin Young
fe011935cd lib: add string utilities
I see lots of the same code being copy-pasted and slightly tweaked for
string processing all over the codebase. Time to start aggregating these
pieces into something consistent and correct.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-06 16:15:34 +00: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
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
914432b5eb lib: Fix bad function
Fix the decleration of a function to be better.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-08 19:33:07 -04:00
Donald Sharp
3518f35264 bgpd, lib, zebra: Cleanup formatting issues found
Cleanup the formating issues found.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-08 19:24:15 -04:00
Daniel Walton
0204baa876 watchfrr always writes 'log syslog informational' to the config
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Dave Olson <olson@cumulusnetworks.com>

Ticket: CM-16501
2018-05-08 19:24:15 -04:00
Quentin Young
9f46cc36aa lib: move ip node above vrf node for config order
VRF static route commands adopt global static config if static config is
placed after a vrf context with no separator, workaround by always
writing static route config before vrf config

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-05-08 19:24:15 -04:00
Don Slice
d4f368e15a lib: allow hostname to begin with a letter or number
Customers have requested the ability to name their devices starting
with a number instead of a letter.  This fix changes the check for
hostname to allow either a letter or a number.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-05-01 21:13:51 +00: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
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
Quentin Young
aec1641e52
lib: remove IRDP_NODE
Unused

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-03 10:50:58 -04:00
Rafael Zalamena
5012c1b6ee
Merge pull request #2005 from qlyoung/remove-masc-node
lib: remove MASC_NODE
2018-04-02 17:55:44 -03: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
f108d4873d
lib: remove SERVICE_NODE
Unused

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-30 16:29:51 -04:00
jaydom
7c40bf391c bgpd: add flowspec feature
This work is derived from a work done by China-Telecom.
That initial work can be found in [0].
As the gap between frr and quagga is important, a reworks has been
done in the meantime.
The initial work consists of bringing the following:
- Bringing the client side of flowspec.
- the enhancement of address-family ipv4/ipv6 flowspec
- partial data path handling at reception has been prepared
- the support for ipv4 flowspec or ipv6 flowspec in BGP open messages,
  and the internals of BGP has been done.
- the memory contexts necessary for flowspec has been provisioned

In addition to this work, the following has been done:
- the complement of adaptation for FS safi in bgp code
- the code checkstyle has been reworked so as to match frr checkstyle
- the processing of IPv6 FS NLRI is prevented
- the processing of FS NLRI is stopped ( temporary)

[0] https://github.com/chinatelecom-sdn-group/quagga_flowspec/

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: jaydom <chinatelecom-sdn-group@github.com>
2018-03-30 14:00:47 +02: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
G. Paul Ziemba
c8ff868c1a lib: add new BGP VPN policy command node
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-03-09 16:40:37 -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
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
Philippe Guibert
6dfe83b8f7
Merge pull request #1728 from mkanjari/evpn-bug-fixes
Evpn bug fixes
2018-03-06 17:27:10 +01:00
Philippe Guibert
e26aedbe0b lib: split logicalrouter and vrf netns feature
This split is introducing logicalrouter.[ch] as the file that contains
the vty commands to configure logical router feature. The split has as
consequence that the backend of logical router is linux_netns.c formerly
called ns.c. The same relationship exists between VRF and its backend
which may be linux_netns.c file.
The split is adapting ns and vrf fiels so as to :
- clarify header
- ensure that the daemon persepctive, the feature VRF or logical router
  is called instead of calling directly ns.
- this implies that VRF will call NS apis, as logical router does.

Also, like it is done for default NS and default VRF, the associated VRF
is enabled first, before NETNS is enabled, so that zvrf->zns pointer is
valid when NETNS discovery applies.

Also, other_netns.c file is a stub handler that will be used for non
linux systems. As NETNS feature is only used by Linux, some BSD systems
may want to use the same backend API to benefit from NETNS. This is what
that file has been done.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-02-27 11:11:24 +01:00
Mitesh Kanjariya
3b103fec6b vtysh/lib: write domainname to config file
Ticket: CM-19626
Review: CCR-7170
Testing: Manual

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2018-02-08 23:04:05 -08: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
Donald Sharp
57dac17c57 lib, pimd: Remove PIM_NODE as it is not needed
The PIM_NODE command is only being used to display
default vrf configuration.  Move this into the
vrf display and remove PIM_NODE.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-01-30 03:21:42 -05:00
Donald Sharp
4df759fecf
Merge pull request #1436 from rtrlib/rpki
bgpd: Add RPKI/RTR support
2017-11-13 13:35:22 -05:00
pogojotz
f806f29c49 lib: Fix command copy running-config startup-config to alias write file
Fixes: #1412
Signed-off-by: Juergen Werner <pogojotz@gmx.net>
2017-11-12 13:09:29 -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
Renato Westphal
efd7904eab *: add missing \n in some help strings
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-24 19:30:30 -02:00
Donald Sharp
affe9e9983 *: Convert list_delete(struct list *) to ** to allow nulling
Convert the list_delete(struct list *) function to use
struct list **.  This is to allow the list pointer to be nulled.

I keep running into uses of this list_delete function where we
forget to set the returned pointer to NULL and attempt to use
it and then experience a crash, usually after the developer
has long since left the building.

Let's make the api explicit in it setting the list pointer
to null.

Cynical Prediction:  This code will expose a attempt
to use the NULL'ed list pointer in some obscure bit
of code.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-05 10:53:13 -04:00
Donald Sharp
bd74dc610a lib: Hash creation cleanup
1) Some hash key functions where converting pointers
directly to a 32 bit value via downcasting.  Pointers
are 64 bit on a majority of our platforms.

2) Some hashes were being created with 256 entries,
downsize the hash creation size to more appropriate
values.

3) Add hash names to hash creation so we can watch
the hash via 'show debugging hashtable'

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-09-05 14:33:01 -04:00
Quentin Young
60466a63f2
*: fix style
Fixes style nits introduced by recent pull requests.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-08-30 11:27:11 -04:00
Mitesh Kanjariya
09fdc88c8c Merge branch 'master' into dev-master 2017-08-28 18:19:03 -07:00
Mitesh Kanjariya
6b3ee3a0b0 lib: new APIs for get/set system hostname/domainname
1. Change hostname_get to cmd_hostname_get
2. Change domainname_get to cmd_domainname_get
3. New API to set domainname
3. Provide a CLI command to set domainname

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-08-28 17:16:52 -07:00
Mitesh Kanjariya
0802e118dd Handle hostname/domainname properly for FreeBSD
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-08-25 16:36:31 -07:00
Mitesh Kanjariya
1f53ef552d Fix compilation errors for domainname
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-08-25 15:51:16 -07:00
Mitesh Kanjariya
4a48f1b70b lib: Fix make check failures
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-08-25 15:39:14 -07:00
Mitesh Kanjariya
419cd5a03f lib/bgpd: provide/use API to get hostname/domainname
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-08-24 16:37:16 -07:00
David Lamparter
3cbb67f229 lib: better warnings for install_element
Also fixes misuse of vector_slot() - that one doesn't check for access
beyond end of vector...

And print node names in grammar sandbox "printall".

Fixes: #543
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-24 00:18:53 +02:00
David Lamparter
9eed278b16 lib: centralized memstats-at-exit
adds a new all-daemon "debug memstats-at-exit" command.  Also saves
memstats to a file in /tmp, useful if a long-running daemon is having
weird issues (e.g. in a user install).

Fixes: #437
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-24 00:18:50 +02:00
Chirag Shah
825d5fbf59 lib: Fix multi instance ospf
ospfd crashes upon configuring multi-instance ospf
i.e 'router ospf x'.
ospfd can return CMD_NOT_MY_INSTANCE which
is not supported in lib/commands

Support two of the error codes
CMD_NOT_MY_INSTANCE and CMD_WARNING_CONFIG_FAILED

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-08-10 14:59:07 -07:00
David Lamparter
695bb8f0d1 Merge branch 'frr/pull/822' ("EVPN fixes")
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-09 21:34:10 +02:00
Renato Westphal
2dd0d72624 zebra: add support for static pseudowires
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-09 13:03:36 +02:00
Mitesh Kanjariya
d37ba5499e bgpd, lib, vtysh: Added support for mac filtering in route-maps
1. Added support to create mac filters
2. Enabled route-map commands for EVPN address family
3. Provision to add mac filters under match clause in route-maps

Ticket: CM-16349
Review: CCR-6190
Unit-test: Manual (logs attached to ticket)

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-08-08 10:09:37 -04:00
Quentin Young
9d356c939f
lib: s/leychain/keychain
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-07-31 11:03:32 -04:00
Quentin Young
c652f6f633
lib: correct some node name typos
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-07-27 15:03:31 -04:00
Quentin Young
cf6c83e712
lib, vtysh: add find COMMAND
Substring search through all defined commands in all nodes.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-07-26 22:58:52 -04:00
Quentin Young
a83a533139
lib: add CLI node names
Adds an array of descriptive names for each CLI node, plus a runtime
check to make sure folks don't forget to update it.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-07-26 18:19:49 -04:00
David Lamparter
9d303b37d7 Revert "*: reindent pt. 2"
This reverts commit c14777c6bf.

clang 5 is not widely available enough for people to indent with.  This
is particularly problematic when rebasing/adjusting branches.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-22 14:52:33 +02:00
whitespace / reindent
c14777c6bf
*: reindent pt. 2
w/ clang 5

* reflow comments
* struct members go 1 per line
* binpack algo was adjusted
2017-07-17 15:26:02 -04:00
whitespace / reindent
d62a17aede *: reindent
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'`

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-17 14:04:07 +02:00
Donald Sharp
1ea6b3f237 Merge remote-tracking branch 'origin/master' into evpn_plus_struct_attr 2017-07-14 08:24:46 -04:00
Donald Sharp
da571b7a6c Merge remote-tracking branch 'origin/master' into evpn_plus_struct_attr 2017-07-14 08:11:05 -04:00
David Lamparter
28b672fcd3 lib, vtysh: remove now-useless newline arg
It's always \n now, hooray.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 13:18:14 +02:00
David Lamparter
84a98309de Merge remote-tracking branch 'frr/master' into newline-redux
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 13:15:55 +02:00
Russ White
79af1cb338 Merge pull request #808 from qlyoung/vtysh-termcols
lib, vtysh: pretty-print variable autocompletions
2017-07-14 07:10:13 -04:00
David Lamparter
2d8270596a Merge remote-tracking branch 'frr/master' into newline-redux
Lots of conflicts from CMD_WARNING_CONFIG_FAILED...

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 13:07:30 +02:00
David Lamparter
61b7d449bd *: remove VTYNL, part 3 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:03 +02:00
David Lamparter
6d3c2ed4ed *: remove VTYNL, part 1 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:02 +02:00
Daniel Walton
f1a05de982 vtysh: return non-zero for configuration failures
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

This allows frr-reload.py (or anything else that scripts via vtysh)
to know if the vtysh command worked or hit an error.
2017-07-13 19:56:08 +00:00
David Lamparter
5c7571d43f *: ditch vty_outln(), part 1 of 2
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-13 20:29:22 +02:00
Quentin Young
1a0f614dd2
lib, vtysh: pretty-print variable autocompletions
Pretty-prints variable autocompletions by breaking them up into multiple
lines, indenting them consistently and respecting the column width of
the terminal.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-07-13 10:59:13 -04:00
vivek
90e60aa7c9 bgpd: Additional configuration for EVPN
Implement configuration options for EVPN. The configuration options include
VNI configuration with RD and Import and Export Route Targets. Also, display
the EVPN configuration.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2017-07-12 15:07:27 -04:00
Quentin Young
007b0667e0
lib: fix more docstrings
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-07-06 16:27:48 -04:00
Quentin Young
dfd19ccc3a
*: update hash_create(), hash_create_size()
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-07-01 19:18:37 -04:00
Quentin Young
6f6f00107e
lib, vtysh: hashtable statistics
Adds the ability to name hash tables, and a new cli command that will
show various summary statistics for named hash tables.

Statistics computed are
  - load factor
  - full load factor (see comments)
  - stddev of full load factor

Standard deviation is computed by storing the sum of squares of bucket
lengths. This is somewhat susceptible to overflow. On platforms where a
double is 32 bits, placing 65535 or more elements into a hash table
opens up the potential for overflow, depending on how they are arranged
in buckets (which depends on the hash function). For example, placing
65535 elements into one hash bucket would cause ssq overflow, but
distributing 40000000 elements evenly among 400000 buckets (100 elements
per bucket) would not.

These cases are extremely degenerate, so the vague possibility of
overflow in an informational command is deemed an acceptable tradeoff
for constant time calculation of variance without locks or compromising
efficiency of actual table operations.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-07-01 19:18:35 -04:00
Quentin Young
4db0cff16a
lib: add statistics for hash tables
Adds a function that calculates various statistics on our implementation
of a hash table. These are useful for evaluating performance.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-07-01 19:18:06 -04:00
Quentin Young
e31b6333f4 *: vty_outln (vty, "") --> vty_out (vty, VTYNL)
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29 17:34:56 +00:00
Quentin Young
1318e7c841 *: s/VTY_NEWLINE/VTYNL/g
Should be able to fit more vty_out onto one line now

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29 17:34:54 +00:00
Quentin Young
96ade3ed77 *: use vty_outln
Saves 400 lines

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29 17:31:28 +00:00
Russ White
0bc44f61c9 Merge pull request #754 from qlyoung/fix-argv-arg
use argv->text where appropriate
2017-06-29 11:06:15 -04:00
Quentin Young
facfee22f5 *: remove VTY_GET_*
CLI validates input tokens, so there's no need to do it in handler
functions anymore.

spatch follows
----------------

@getull@
expression v;
expression str;
@@
<...
- VTY_GET_ULL(..., v, str)
+ v = strtoull (str, NULL, 10)
...>

@getul@
expression v;
expression str;
@@
<...
- VTY_GET_ULONG(..., v, str)
+ v = strtoul (str, NULL, 10)
...>

@getintrange@
expression name;
expression v;
expression str;
@@
<...
- VTY_GET_INTEGER_RANGE(name, v, str, ...)
+ v = strtoul (str, NULL, 10)
...>

@getint@
expression v;
expression str;
@@
<...
- VTY_GET_INTEGER(..., v, str)
+ v = strtoul (str, NULL, 10)
...>

@getv4@
expression v;
expression str;
@@
<...
- VTY_GET_IPV4_ADDRESS(..., v, str)
+ inet_aton (str, &v)
...>

@getv4pfx@
expression v;
expression str;
@@
<...
- VTY_GET_IPV4_PREFIX(..., v, str)
+ str2prefix_ipv4 (str, &v)
...>

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-27 19:04:41 +00:00
Quentin Young
7e045c3d42 *: use ->text and strmatch where appropriate
Still need to go fix all the places where we do a 1-char strncmp...

spatch follows
------------------

@asdf@
expression idx;
@@
<...
 strcmp (
- argv[idx]->arg,
+ argv[idx]->text,
  ...)
...>

@depends on asdf@
expression idx;
@@
<...
- !strcmp (argv[idx]->text,
+ strmatch (argv[idx]->text,
           ...)
...>

@depends on asdf@
expression idx;
expression arg;
@@
<...
- strcmp (argv[idx]->text, arg) == 0
+ strmatch (argv[idx]->text, arg)
...>

@depends on asdf@
expression idx;
expression arg;
@@
<...
- strcmp (argv[idx]->text, arg) != 0
+ !strmatch (argv[idx]->text, arg)
...>

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-27 17:46:42 +00:00
Quentin Young
b170d66a78 lib: allow 'do' commands in ENABLE_NODE
'do' is syntax sugar that allows the user to execute a command under
ENABLE_NODE when in another CLI node. If the user is already in
ENABLE_NODE, use of 'do' was previously disallowed. This patch allows it
because it makes it easier for us to hack around certain instances of
the node synchronization problem with vtysh.

Also included is a fix for one of these problems.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-16 14:46:08 +00:00
David Lamparter
97bd5c48de Merge remote-tracking branch 'frr/master' into pull-624 2017-06-13 09:18:14 +02:00
Quentin Young
2b4dc78f7f lib: free varhandler on exit
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-02 17:24:01 +00:00
Donald Sharp
293067f086 Merge remote-tracking branch 'origin/master' into babel 2017-05-30 10:58:03 -04:00
Lou Berger
b1ff4223c7 lib: remove BGP_ENCAP(V6)_NODE
Signed-off-by: Lou Berger <lberger@labn.net>
2017-05-23 15:40:12 -04:00
David Lamparter
c3fb7c1064 Merge branch 'frr/pull/550'
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-18 12:32:28 +02:00
Donald Sharp
fe2bfdd608 Merge pull request #532 from opensourcerouting/gpl-headers
*: make consistent & update GPLv2 file headers
2017-05-16 18:04:31 -04:00
Daniel Walton
7780aaaa72 lib: Remove the "This command currently does nothing" message
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

This breaks the "vtysh -m" output which causes problems for
frr-reload.py
2017-05-16 18:57:20 +00:00
Donald Sharp
291ca371e2 lib: Improve error message for the developer
I keep getting people asking me about what to do
when this error is generated when they are programming
new cli.  Maybe this is a bit better bread-crumb?

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-15 20:55:33 -04:00
David Lamparter
896014f4bc *: make consistent & update GPLv2 file headers
The FSF's address changed, and we had a mixture of comment styles for
the GPL file header.  (The style with * at the beginning won out with
580 to 141 in existing files.)

Note: I've intentionally left intact other "variations" of the copyright
header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15 16:37:41 +02:00
David Lamparter
7f059ea614 vtysh: autocomplete variables
This asks the connected daemons for their variable completions through a
hidden CLI command.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15 10:27:43 -04:00
David Lamparter
70d44c5cd4 lib: cli: autocomplete variables
Shows known values in the appropriate naming domain when the user hits
<?> or <Tab>.  This patch only works in the telnet CLI, the next patch
adds vtysh support.

Included completions:
- interface names
- route-map names
- prefix-list names

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15 10:27:43 -04:00
David Lamparter
c09c46ae3c lib: parser: add pre-merge varname propagation step
Fills token->varname based on context.  WORD tokens use the WORD - if it
isn't actually "WORD".  Other than that, a preceding constant token is
used as name.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15 10:27:43 -04:00
David Lamparter
5894e76da7 lib: parser: split off & rename graph handling
Put core CLI graph stuff in lib/command_graph.[ch] and consistently
prefix all function names with "cmd_".

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15 10:27:43 -04:00
David Lamparter
16705ecc65 lib: parser: add named variables in CLI
struct cmd_token now has a "varname" field which is derived from the
DEFUN's string definition.  It can be manually specified with "$name"
after some token, e.g. "foo WORD$var".  A later commit adds code to
automatically fill the value if nothing is specified.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15 10:27:43 -04:00
Donald Sharp
a616ea5f24 lib, vtysh: Add bits and pieces to allow vtysh to understand babel
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-13 23:38:14 -04:00
Donald Sharp
dfdbe7e4b0 lib: Cleanup command parsing a tiny bit
The CLI changes now make it impossible for numbers
outside the range specified in the cli to make it to
this code.  No need to check for it again.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-13 13:08:00 -04:00
Hung-Weic Chiu
9bc221113c - Solve the Coverity Scan PW.ASSIGN_WHERE_COMPARE_MEANT
- Minor refactoring

Signed-off-by: Hung-Weic Chiu <sppsorrg@gmail.com>
2017-05-10 16:02:48 -04:00
David Lamparter
92fd8a7d59 Merge pull request #468 from qlyoung/fix-list-perm
lib: fix 'list permutations'
2017-05-09 17:54:22 +02:00
Quentin Young
e4e63cb6eb lib: fix 'list permutations'
Cyclic graphs ftw

Also remove graph pretty printer from permutations.c 'cause it's not
really needed anymore

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-05 00:19:00 +00:00
Donald Sharp
b46be72b4a Merge branch 'master' into EIGRP 2017-05-02 11:38:06 -04:00
Don Slice
f51bae9cf9 bgpd: labeled unicast config
Implement support for activating the labeled-unicast address family in
BGP and relevant configuration for this address family.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2017-04-06 10:30:03 -04:00
Donald Sharp
97133f7915 Merge remote-tracking branch 'origin/master' into EIGRP 2017-04-05 20:52:32 -04:00
David Lamparter
3e7c8d040c Merge branch 'stable/2.0'
Fixed minor conflicts from "defaults" change on stable.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-04-04 19:01:47 +02:00
Lou Berger
447a8fe92e Rename: FreeRangeRouting FRRouting
Signed-off-by: Lou Berger <lberger@labn.net>
2017-03-30 14:22:35 -04:00
David Lamparter
8efe88eacf *: track version & "defaults" in configs
[CF]: Move default name to autoconf and update tests

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2017-03-28 19:18:42 +02:00
David Lamparter
4dcee34bd6 Revert "lib: Fix tab completions memleak, memory stats corruption"
This reverts commit 039dc61292.

The patch actually made the situation worse since the return value from
cmd_complete_command_real() was now inconsistently allocated from
different memory stat pools.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-09 19:23:00 +01:00