Commit Graph

610 Commits

Author SHA1 Message Date
Donald Sharp
64f598fd28
Merge pull request #4754 from opensourcerouting/gen-northbound-improvements
tools: improve gen_northbound_callbacks
2019-07-31 14:28:45 -04:00
Rafael Zalamena
c681616f87 tools: generate code that handles all cases
Help developers to start implementing northbound with more complete
callbacks.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-07-30 15:39:34 -03:00
Rafael Zalamena
13080468b0 tools: generate northbound code without warnings
Use the alternate struct instantiation that does not generates warning
on old compilers.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-07-29 19:28:59 -03:00
Rafael Zalamena
88292d6959 tools: allow YANG model path specification
This allows developer to set a temporary YANG model directory path for
generating northbound for models not yet installed.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-07-29 18:59:20 -03:00
Rafael Zalamena
55c8666a92 frr-reload.py: fix reload with different settings
Add `allow-external-route-update` and `domainname` to the one line
context list, otherwise reload will fail when those commands show up in
the running configuration.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-07-23 18:20:22 -03:00
David Lamparter
b9a0d38d53 tools: add vim snippet
Signed-off-by: David Lamparter <equinox@diac24.net>
2019-06-12 19:35:43 +02:00
David Lamparter
9c251d376a tools: retain sanity when reloading under systemd
Without this, we end up restarting watchfrr with the systemd watchdog
non-functional & tripped a bit later.  Also, if watchfrr is in the
"control" cgroup, systemd 232 will kill it.  (241 apparently doesn't.
Can't find anything about this in systemd's ChangeLog though.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-06-10 19:21:43 +02:00
Donald Sharp
9ee2f5741d tools: On shutdown no need to flush from tools/frr.in script
Zebra already flushes routes on proper shutdown if you are not
using the -K option.  If you are using the -K option then you
do not want the tools/frr script to flush routes.

If zebra crashes and we restart then load up will either delete
the routes or leave them depending on the -K option.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-05-31 21:49:17 -04:00
Donald Sharp
610b53283b doc, tools: Update to code to show example MAX_FDS
Place in the code the ability for end operators to know how
to modify MAX_FDS so that they can run large scale operations.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-05-24 08:24:18 -04:00
Quentin Young
1f1896fc6e tools: add vrrpd to frrcommon.sh
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17 16:26:26 +00:00
Quentin Young
f9d31f6f6c tools: fix vrrp autoconfigure reload
Ticket: CM-24375
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17 00:27:08 +00:00
Quentin Young
97b5f22bcd vrrpd: update auto*, init scripts, etc
Add vrrpd to all the usual places daemons need to go

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
Quentin Young
5307949e8f tools: add lints for unsafe functions
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-08 15:55:54 +00:00
Don Slice
ee951352d1 tools: frr-reload.py stop bouncing peers on bfd timer change
Problem reported that if a bgp neighbor had a bfd timer change
made in frr.conf and systemctl reload frr performed, the neighbor
with the timer changed bounced.  If the change is made in vtysh
by just adding the new timer values, no peer bounce occurs.  This
fix skips the delete part of the delete/add process in frr-reload
so the peers stay up.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2019-04-25 10:54:54 -07:00
Christian Franke
a55578f631 tools/frr.in: Only attempt to load daemons.conf if present
Apparently, the default changed to use `/etc/frr/daemons` instead of
`/etc/frr/daemons.conf`. Therefore, we should ignore absence of the
latter file, because its absence is not an actuall error but will
cause a confusing error message like this:

    /etc/init.d/frr: line 507: /etc/frr/daemons.conf: No such file or directory
2019-03-26 10:33:45 +01:00
Donald Sharp
08d4711684
Merge pull request #3989 from opensourcerouting/redhat-new-init
redhat: switch to new init script
2019-03-25 07:45:04 -04:00
David Lamparter
b7862d93ae tools/frrcommon.sh: ignore 'declare' failures
The "declare -p watchfrr_options" call is just to support backwards
compatibility.  If it fails, silently ignore that.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-03-24 15:53:43 +01:00
Donald Sharp
0384e5da0b
Merge pull request #3839 from srimohans/support_bundle
FRR: Python script to generate support bundle for FRR
2019-03-22 04:03:45 -04:00
Ruben Kerkhof
33b397711b tools: fix two typos in daemons file
Signed-off-by: Ruben Kerkhof <ruben@rubenkerkhof.com>
2019-03-21 14:50:53 +01:00
David Lamparter
d3b05897ed
Merge pull request #3869 from qlyoung/cocci-fixes
Assorted Coccinelle fixes
2019-03-06 15:54:44 +01:00
Russ White
3f77bcdbe0
Merge pull request #3872 from dslicenc/frr-reload-vrf-context
tools: keep exit-vrf to change context correctly between vrfs
2019-02-27 11:16:38 -05:00
Quentin Young
25af5f0d79 tools: add coccinelle spatches
Add some Coccinelle semantic patches we can use to automatically
refactor code in the future.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-02-26 17:40:40 +00:00
Don Slice
06ad470d7c tools: keep exit-vrf to change context correctly between vrfs
Discovered in testing that if a static route in the default table
was entered immediately after a vrf static block, the static route
intended for the default table was put in the vrf instead.  This
fix retains the "exit-vrf" statement which causes the following
static routes to appear in the default table correctly.

Ticket: CM-23985
Signed-off-by: Don Slice <dslice@cumulusnetwork.com>
2019-02-26 14:23:53 +00:00
Don Slice
348135a5da tools: fix blackhole static changes in frr-reload.py
Problem caused when nclu is used to create "ip route 1.1.1.0/24
blackhole" because frr-reload.py changed the line to Null0 instead
of blackhole.  If nclu tries to delete it using the same line as
entered, the commit fails since it doesn't match.

Ticket: CM-23986
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2019-02-26 14:08:27 +00:00
Donald Sharp
5fa3430885
Merge pull request #3836 from opensourcerouting/debian/master-kill-backports
[master] debian packaging
2019-02-23 18:23:21 -05:00
Sri Mohana Singamsetty
e60eb780e4 FRR: Python script to generate support bundle for FRR
This has a python script that helps in collecting various CLI show command outputs in an automated way.

This commit has two files.

1.Text Configuration file: support_bundle_commands.conf - This file has list of CLI show commands to be executed. This file will be in tools/etc/frr/ directory. On executing command "sudo install -m 644 tools/etc/frr/ support_bundle_commands.conf /etc/frr/support_bundle_commands.conf", as part of FRR installation, this file will be copied into /etc/frr directory.

2.Python script file: generate_support_bundle.py - This file has the python code that has the below functionality.
  * It reads the support_bundle_commands.conf file. For each process present in the conf file, it creates a support_bundle file. For example, it creates bgp_support_bundle.log file for BGP and zebra_support_bundle.log file for Zebra. These files will be created in /var/log/frr/ directory. This is where regular FRR log files are also stored currently.
  * The script reads the CLI command specified between CLI_START and CLI_END key words for each process. It will execute the commands one by one.
  * For each such command, the script also appends the current time stamp at which the CLI command is executed.
  * In case of successful execution of the CLI command, it will copy the CLI output into the above support bundle file.
  * In case of CLI command failure, it will capture the error thrown and the error is also written into the same file.
  * A small snippet of the output file is as below.

  >>[2019-01-02 13:55:23.318987]show bgp summary

  IPv4 Unicast Summary:
  BGP router identifier 203.0.113.1, local AS number 65000 vrf-id 0
  BGP table version 4
  RIB entries 7, using 1176 bytes of memory
  Peers 1, using 21 KiB of memory
  Peer groups 1, using 64 bytes of memory

  Neighbor        V         AS MsgRcvd MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd
  203.0.113.2     4      65001      34      34        0    0    0 00:29:47            2

  Total number of neighbors 1
  >>[2019-01-02 13:55:23.619953]show ip bgp

  BGP table version is 4, local router ID is 203.0.113.1, vrf id 0
  Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
                 i internal, r RIB-failure, S Stale, R Removed

Signed-off-by: Sri Mohana Singamsetty <msingamsetty@vmware.com>
2019-02-20 11:56:22 -08:00
David Lamparter
195f215cfc tools: fix new init script wrt. multi-instance
TBH when I looked at watchfrr I didn't see any MI support and hence
assumed this just didn't work to begin with.  However, it actually does
(transparently to watchfrr, by just using "ospfd-1" as daemon name.)

So, fix this up and make it work again.

(Also remove 2 extraneous \n in messages.)

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-02-19 21:38:23 +01:00
David Lamparter
3ec9556728 watchfrr: build in defaults for -r/-s/-k
There's no good reason to not have these options default to the
installation path of tools/watchfrr.sh.  Doing so allows us to ditch
watchfrr_options from daemons/daemons.conf completely.

Fixes: #3652
Signed-off-by: David Lamparter <equinox@diac24.net>
2019-02-19 21:34:31 +01:00
David Lamparter
1bc91be4b8 tools/tarsource.sh: deal with AC_INIT []
configure.ac got cleaned up, now there's [] around the version number.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-02-19 21:34:08 +01:00
David Lamparter
4734c22a4f tools/tarsource.sh: support FRR as a git submodule
a git submodule will have .git as a file instead of a directory... which
breaks tarsource.sh.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-02-19 21:34:08 +01:00
David Lamparter
380fe10b16 tools: don't watch nonexistent daemons
If we try to monitor a nonexisting daemon in watchfrr, it will
(currently) forever wait at startup since the vty connection will never
come up.  Just drop the daemon from the daemon list in such a case.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-02-19 21:34:08 +01:00
David Lamparter
6b37587791 tools/tarsource.sh: keep version info on non-git
extraver won't have any useful value on a non-git run.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-02-19 21:34:06 +01:00
David Lamparter
3e662ed3f1 tools: update build-debian-package.sh
Signed-off-by: David Lamparter <equinox@diac24.net>
2019-02-19 21:34:06 +01:00
David Lamparter
3f406e3f8e tools/tarsource.sh: fix GZIP_ENV
Some older versions of Automake don't escape this properly.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-02-19 21:32:19 +01:00
David Lamparter
74afa5e686 debian: cleanly split off from dist tarball
The debian/ directory is distributed separately for tarballs in 3.0
(quilt) format.  Including it in the dist tarball causes problems with
automake when the separately distributed debian directory is unpacked on
top of the dist tarball;  the clean and correct thing to do here is to
not include the debian/ directory in dist tarballs.

Users have two choices for building FRR Debian packages:
- build straight off git
- build from a "frr.tar" + "frr-debian.tar"

The tarsource.sh tool does the right thing when invoked with the -D
("Debian") option.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-02-19 21:31:18 +01:00
David Lamparter
081253fcd5 tools/tarsource.sh: create debian changelog
Signed-off-by: David Lamparter <equinox@diac24.net>
2019-02-19 21:31:18 +01:00
David Lamparter
b3c4c164b5 debian: make package "official"
Move us into place in debian/

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-02-19 21:30:54 +01:00
David Lamparter
e14560a7e6 tools: add new tarsource.sh helper
It cleans your house and cooks dinner.  Or maybe it creates a clean dist
tarball for you, plus a Debian .dsc if you have dpkg installed - and
GPG-signs the result appropriately if requested.

In any case the resulting tarball should be distributed for our
releases.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-02-19 21:30:50 +01:00
Mark Stapp
95ce849b58 libs, rip, isis: change northbound operation enum to DESTROY
Change the northbound lib operation from DELETE to DESTROY;
make the required changes in the users of the northbound, in
the cli, rip, ripng, and isis.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-02-11 15:49:49 -02:00
David Lamparter
0240fee6f4
Merge pull request #3715 from qlyoung/fix-systemd-deps
tools: fix systemd dependency graph
2019-02-11 07:50:16 +01:00
Quentin Young
efbf903d61 tools: fix systemd dependency graph
Currently our systemd dependencies look something like this (example
from vanilla Debian 9):

$ systemctl list-dependencies frr
frr.service
● ├─system.slice
● └─sysinit.target
  ...

$ systemctl list-dependencies --reverse frr
frr.service
● └─network-online.target
●   └─apt-daily.service

Note that sysinit.target does not depend on any network* service or
target.

In other words, unless there is a service that requires
network-online.service, even if FRR is enabled it will not be started.
Therefore network-online.target is the wrong unit to have in WantedBy=,
as it is not always started.

This patch updates our service file so that it is properly started by
the system when enabled, delayed until networking is up, and if possible
delayed until after NetworkManager, systemd-networkd or any other
networking configuration manager has finished performing its tasks -
i.e. after network-online.target.

After these changes our new dependency graph looks like this:

$ systemctl list-dependencies frr
frr.service
● ├─system.slice
● │ └─networking.service
● ├─network.target
● └─sysinit.target
  ...

$ systemctl list-dependencies --reverse frr
frr.service
● └─multi-user.target
●   └─graphical.target

This way, FRR will be started by multi-user.target (just like most
applications), but delayed until after networking has been configured.

In the same stroke, this should also fix issues on systems that do not
provide "networking.service" (such as CentOS 7).

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Signed-off-by: David Lamparter <equinox@diac24.net>
2019-02-06 19:47:43 +00:00
David Lamparter
fdbd8086b1 build: fix a whole bunch of *FLAGS
- some target_CFLAGS that needed to include AM_CFLAGS didn't do so
- libyang/sysrepo/sqlite3/confd CFLAGS + LIBS weren't used at all
- consistently use $(FOO_CFLAGS) instead of @FOO_CFLAGS@
- 2 dependencies were missing for clippy

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-01-30 19:13:51 +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
Donald Sharp
38a5232499
Merge pull request #3507 from opensourcerouting/master-init-fixes
[master] minor tools/ fixes
2018-12-18 19:21:39 -05:00
David Lamparter
1515026516 tools/frrcommon.sh: always start staticd
"derp."

Since zebra is always started, the same should hold for staticd.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-12-18 01:26:12 +01:00
David Lamparter
b7d492f295 tools/frrcommon.sh: actually create /run/frr
tmpfiles.d is nice and all, but we can't rely on it.  Just create
/run/frr if needed.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-12-18 01:26:12 +01:00
David Lamparter
829d32552b tools/etc: remove cumulus user from vtysh.conf
This is a Cumulus-specific default which we shouldn't have in git.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-12-18 01:26:12 +01:00
David Lamparter
9210eecc7d tools: add documentation URL on frr.service
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-12-18 01:26:12 +01:00
Don Slice
2a2b64e487 tools: stop frr-reload.py from trying to delete the vrf context
Problem seen when removing last config item under the vrf context,
where frr-reload.py tries instead to delete the vrf context itself.
Since that is not permitted on an active vrf, the command errors
out and nothing is deleted.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-12-14 13:11:05 +00:00
Renato Westphal
225c06b581 tools: update checkpatch to stop suggesting the use of kstrto()
kstrto() is a kernel-specific function so this suggestion doesn't
make sense for FRR.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-12-09 13:59:19 -02:00
David Lamparter
9c830772cd *: get rid of most daemons.conf references
There's a few left over to get compatibility and not break user
installs, but most is gone.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-12-06 23:05:48 +01:00
David Lamparter
ea4d91bfba debian/tools: new init script
This separates the init script used for the system (and called in the
systemd unit file) from the script that watchfrr uses to control
daemons.  Mixing these two caused the entire thing to become a rather
huge spaghetti mess.

Note that there is a behaviour change in that the new script always
starts zebra regardless of zebra_enable.

Side changes:
- Ubuntu 12.04 removed from backports since it doesn't work anyway
- zebra is always started regardless of zebra_enable.  To disable FRR,
  the entire init script should be disabled through policy.
- no-watchfrr operation is no longer supported by the scripts in the
  Debian packages.  (This is intentional.)

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-12-06 23:05:48 +01:00
David Lamparter
10ea85ee45 tools/frr: get rid of the bash array and "bB"
With a little shell-fu, this can actually be escaped properly.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-12-06 17:29:27 +01:00
Renato Westphal
1a4bc045de lib, tests: major rework in the operational-data callbacks
The northbound infrastructure for operational data was subpar compared
to the infrastructure for configuration data. This commit addresses most
of the existing problems, making it possible to write operational-data
callbacks for more complex YANG models.

Summary of the changes:
* Add support for nested YANG lists.
* Add support for leaf-lists.
* Add support for leafs of type "empty".
* Introduce the "show yang operational-data XPATH" command, and write an
  unit test for it. The main purpose of this command is to make it
  easier to test the operational-data northbound callbacks.
* Introduce the nb_oper_data_iterate() function, that can be used
  to iterate over operational data. Make the CLI and sysrepo use this
  function.
* Since ConfD has a very peculiar API, it can't reuse the
  nb_oper_data_iterate() like the other northbound clients. In this
  case, adapt the existing ConfD callbacks to support the new features
  (and make some performance improvements in the process).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-11-26 18:28:53 -02:00
Renato Westphal
544ca69a5c lib: add support for YANG lists with mixed config and state data
A YANG list that contains both configuration and state data must have
the following callbacks: create(), delete(), get_next(), get_keys()
and lookup_entry().

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-11-26 17:38:08 -02:00
Renato Westphal
e0ccfad220 lib: rework the yang schema node iteration functions
* Rename yang_snodes_iterate() to yang_snodes_iterate_subtree() and
  expose it in the public API.
* Rename yang_module_snodes_iterate() to yang_snodes_iterate_module().
* Rename yang_all_snodes_iterate() to yang_snodes_iterate_all().
* Make it possible to stop the iteration at any time by returning
  YANG_ITER_STOP in the iteration callbacks.
* Make the iteration callbacks accept only one user argument and not
  two.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-11-26 17:38:08 -02:00
Renato Westphal
db452508bf lib, tools: use CHECK_FLAG/SET_FLAG more often in the northbound code
Cosmetic change to improve code readability a bit. No binary changes.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-11-26 17:35:58 -02:00
Quentin Young
11b5117007 tools: add non-32 bit atomic warning to checkpatch
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-11-19 19:03:45 +00:00
Sri Mohana Singamsetty
179b8a0bde watchfrr: Echo statements are blocking the execution of frr script
1) Certain echo statements present in the script before/after SSD process
restart are causing the FRR script to hang. This is breaking the frr script
functionality for start/stop/restart. Removed such echo statements.

Tests:
1. Multiple start, stop, restart
2. Multiple restarts/kill of same process.

Signed-off-by: Sri Mohana Singamsetty <msingamsetty@vmware.com>
2018-11-06 09:50:40 -08:00
Sri Mohana Singamsetty
eae8bbce91 watchfrr: replace /usr/sbin/service frr with /usr/lib/frr/frr script
Need to use /usr/lib/frr/frr script for start/stop/restart of FRR. /usr/sbin/service frr command is not working as expected.

Signed-off-by: Sri Mohana Singamsetty <msingamsetty@vmware.com>
2018-11-06 09:46:06 -08:00
Renato Westphal
12d35cedf5 tools: update checkpatch to allow indented labels
clang-format always indent labels by default and that can't be changed
with any configuration option. Also, indented labels tend to improve
code readability, especially in long functions.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-10-27 16:16:12 -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
Lou Berger
75082dafb5
Merge pull request #3235 from opensourcerouting/buildfoo-20181024
build: potpourri
2018-10-27 14:14:35 -04:00
David Lamparter
0437e10517 *: spelchek
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-25 20:10:57 +02:00
David Lamparter
67cf020d17 build: make clean and dist consistent
We weren't cleaning up some files (a whole lot of python foobar) and had
some files in the dist tarball that don't quite belong there.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-24 18:35:15 +02:00
Christian Franke
bf8e16b5de debianpkg, tools: Add fabricd to distribution scripts
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2018-10-24 15:50:56 +02:00
Quentin Young
25e87a8fdc tools: reindent frr
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-10-15 15:45:36 +00:00
Quentin Young
78230371e9
Merge pull request #3098 from opensourcerouting/watchfrr-delay
tools/frr + watchfrr spring cleaning (southern hemisphere)
2018-10-04 15:04:56 -04:00
Martin Winter
ad6707b564
Merge pull request #3108 from dmbaturin/master
Add a script for building a Debian package in one step.
2018-10-02 16:58:12 +02:00
David Lamparter
442fc69786 tools/frr: remove "watchfrr.started" hack
This is no longer neccessary since start-stop-daemon will block until
watchfrr's launch parent has exited.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-02 12:27:51 +02:00
Daniil Baturin
836ad9fb4e tools: add a script for building a Debian package in one step.
The script simplifies the relatively lengthy procedure.
It should be invoked from the top level source directory, for example:
./tools/build-debian-package.sh

Signed-off-by: Daniil Baturin <daniil@baturin.org>
2018-10-01 20:44:01 +02:00
Lou Berger
38893614e5
Merge pull request #3107 from opensourcerouting/fix/tools-gitignore
tools: Update .gitignore
2018-10-01 06:43:58 -04:00
Martin Winter
10f8da2bb4
Merge pull request #3074 from jpmondet/master
frr-reload.py: Python3 compatibility
2018-10-01 12:40:11 +02:00
David Lamparter
cffcc5f75d
Merge pull request #3034 from donaldsharp/LUA
Add initial thoughts on having lua act as a replacement for route-maps
2018-10-01 12:39:51 +02:00
Christian Franke
5b80430c3b tools: Update .gitignore
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2018-09-28 20:34:29 +02:00
Donald Sharp
1d7c7ace3c bgpd: Add lua match command
Please note this is a Proof of Concept and not actually something
that is ready to commit at this point.  The file tools/lua.scr
contains some documentation on how we expect it to work currently.
Additionally not all bgp values have been hooked up into the
ability to lua script yet.

There is still significant work to be done here:

1) Add the ability to pass in more data and to adjust the return values
as appropriate.

To set it up:

1) copy tools/lua.scr into /etc/frr (or whereever the config
directory is )

2) Create a route-map match command:
!
router bgp 55
 neighbor 10.50.11.116 remote-as external
 !
 address-family ipv4 unicast
  neighbor 10.50.11.116 route-map TEST in
 exit-address-family
!
route-map TEST permit 10
 match command mooey
!

3) In the lua.scr file make sure that you have a function
named 'mooey' ( as the above example does ):

function mooey ()
   zlog_debug(string.format("Family: %d: %s %d ifindex: %d aspath: %s localpref: %d",
                            prefix.family, prefix.route,
			    nexthop.metric, nexthop.ifindex, nexthop.aspath, nexthop.localpref))

   nexthop.metric =  33
   nexthop.localpref = 13
   return 3
end

This example script modifies the metric and localpref currently.  I've also provided
a zlog_debug function in lua to allow some simple debugging.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-26 21:21:23 -04:00
David Lamparter
40da52d8c1 tools/frr: use path settings from ./configure
...so we properly locate config files and daemons whereever the user
decided to put them.

Signed-Off-By: David Lamparter <equinox@diac24.net>
2018-09-27 02:06:14 +02:00
jpmondet
1c64265f86
frr-reload.py: Add python2 & python3 compatibility.
Signed-off-by: jpmondet <jp@mondet.org>
2018-09-26 21:45:33 +02:00
Lou Berger
d127c61aeb
Merge pull request #3010 from opensourcerouting/no-frr-thread-id
lib: frr_pthread minor simplification
2018-09-22 15:02:09 -04:00
Donald Sharp
a10f94506a
Merge pull request #3058 from pacovn/Coverity_1399484_Dereference_null_return_value
tools: null check (Coverity 1399484)
2018-09-20 13:16:30 -04:00
F. Aragon
b0bde9f33d
tools: return check (Coverity 1399196)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-09-20 16:42:31 +02:00
F. Aragon
3b23c6c379
tools: null check (Coverity 1399484)
Fixed using XCALLOC(MTYPE_TMP, ...) instead of calloc(...) because of the
error handling (XCALLOC checks + log + abort through memory_oom())

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-09-20 16:23:52 +02:00
David Lamparter
c5d580fbc7 tools/checkpatch.pl: recognize _Atomic as modifier
checkpatch is slightly confused by _Atomic, causing some spurious
warnings.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-19 22:05:32 +02:00
David Lamparter
ae9eebcaeb *: fix some solaris warnings
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-08 21:30:42 +02:00
David Lamparter
b45ac5f5c6 *: fix config.h/zebra.h include order
config.h (or, transitively, zebra.h) must be the first include file
listed for autoconf things like _GNU_SOURCE and _POSIX_C_SOURCE to work
correctly.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-08 21:30:42 +02:00
David Lamparter
e7c25325cc *: cleanup .gitignore files
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-08 21:30:42 +02:00
Christian Franke
da82f6b42a zebra: add RTPROT_FABRICD route type 197
Add an iproute2 route type for fabricd

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2018-09-05 11:38:12 +02:00
David Lamparter
01b9e3fd0d *: use frr_elevate_privs() (1/2: coccinelle)
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-08-14 20:02:05 +00:00
Quentin Young
94cb1f61a4
Merge pull request #2805 from opensourcerouting/malloc-size
lib: track total memory per MTYPE if possible
2018-08-14 11:43:39 -04:00
Donald Sharp
d6853655b5
Merge branch 'master' into bfd-final 2018-08-14 08:16:10 -04:00
David Lamparter
7aea4b8167 tools/checkpatch: fix some bogus macro warnings
checkpatch was throwing an error for "#define FOO , bar"

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-08-10 20:46:35 +02:00
Don Slice
d60f480010 tools: correct frr-reload.py handling of bgp vni/exit-vni config
Problem reported that when a peer-group was added in certain
configurations, it would be rejected because of the order of the
commands put in by nclu. Issued turned out to be how frr-reload.py
was handling the sub-sub-context of the vni under the address-family
and subsequently how it handled the following exit-vni.

Ticket: CM-21996
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-08-10 09:59:24 -07:00
Rafael Zalamena
7134904b1f bfdd: wire to the build process
Add BFD daemon to the build process and packaging instructions.

Currently the bfdd daemon does nothing, this is just to document how the
daemon insertion step occured.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2018-08-08 18:24:58 -03:00
Martin Winter
09890489cc
Merge pull request #2122 from donaldsharp/zebra_nhs
Create Staticd
2018-08-08 08:07:24 -07:00
Quentin Young
540b2efdf7 tools: improve checkpatch slicing
checkpatch cuts from the diff between the outputs of pre-patch and
post-patch runs of `checkpatch.pl`, but fixed-length greps sometimes
don't cut correctly.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-03 17:25:14 +00:00
Arthur Jones
8b5f787e8e tools/frr: make frr reload error message clearer on missing frr-reload.py
Only frr-reload.py pulls in a python depenedency for frr, we can
reduce the size of the base frr package by a lot if we separate
out frr-pythontools.  When we do this, we get a somewhat cryptic
error message when frr-reload.py is missing on frr reload.

Here, we pull the error message from frr-reload script, which is
much clearer.

Testing done:

frr reload both with and without the frr-reload.py script, see
the frr-reload message when missing and it runs frr-reload.py when
not missing.

Signed-off-by: Arthur Jones <arthur.jones@riverbed.com>
2018-08-01 09:23:55 -07:00
Donald Sharp
7ac1de8ee0 debianpkg, redhat, tools: Fixup startup/build for new daemon
Add code to allow FRR to properly build and handle the staticd
for some of the more common packaging.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-29 12:37:25 -04:00
Don Slice
cc27402c4d tools: handle exit-vrf as end of context block
Ticket: CM-21048
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-07-19 18:38:54 +00:00
Quentin Young
7c25948eca
Merge pull request #2505 from pacovn/Coverity_1143220_Argument_cannot_be_negative
tools: return check (2) (Coverity 1143220)
2018-06-21 15:02:31 -04:00
paco
9b606d6c3d
tools: return check (2) (Coverity 1143220)
Previous correction (657f9948ed) was incomplete.

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-20 21:26:38 +02:00
Donald Sharp
dd52a18493
Merge pull request #2436 from pacovn/Coverity_1143220_Argument_cannot_be_negative
tools: return check (Coverity 1143220)
2018-06-14 10:02:25 -04:00
paco
657f9948ed
tools: return check (Coverity 1143220)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-13 18:07:36 +02:00
paco
e1be9119f8
tools: out-of-bounds access (Coverity 1399290)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-13 16:33:51 +02:00
Quentin Young
e9f272a49e *: disable all sanitizers for clippy build
* Move configure flag propagations out of user flags
* Use AC_SUBST to transfer flag values to Automake
* Set default AM_CFLAGS and AM_CPPFLAGS in common.am and change child
  Makefiles to modify these base variables
* Add flag override to turn off all sanitizers when building clippy
* Remove LSAN suppressions blacklist as it's no longer needed

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-08 17:22:13 +00:00
Donald Sharp
d4d71f1133 tools, zebra: Use different protocol value for our statics
The re-use of RTPROT_STATIC has caused too many collisions
where other legitimate route sources are causing us to
believe we are the originator of the route.  Modify
the code so that if another protocol inserts RTPROT_STATIC
we will assume it's a Kernel Route.

Fixes: #2293
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-26 08:46:13 +02:00
Lou Berger
c274a72fb3 *: fix compile with -enable-address-sanitizer configured
Signed-off-by: Lou Berger <lberger@labn.net>
2018-05-14 07:06:36 -04:00
Donald Sharp
31649cb98b redhat, tools: Increase startup time out a bit
We have run across a few cases where the startup timeout is
ocurring on heavily loaded systems.  This is especially true
in simulation environments where the hypervisor load is
extremely high.

Modify the code base to give ourselves more time to startup.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-01 23:35:53 -04:00
Donald Sharp
70bf5a07fd tools: Cleanup code to handle sharp and pbr a bit better
The sharp and pbr protocols needed a bit more handling
to be 'right' from a start/stop perspective.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-27 14:59:52 -04:00
Ilya Shipitsin
342d555eb8 tools: more lsan suppressions for clippy
Signed-off-by: Ilya Shipitsin <chipitsine@gmail.com>
2018-04-17 12:30:33 +05:00
Donald Sharp
d4c58fa8f4
Merge pull request #2040 from ajones-rvbd/ajones-issue-2030
alpine packaging: use a more standard packaging format
2018-04-12 10:17:37 -04:00
Lou Berger
0b984829be
Merge pull request #1989 from qlyoung/defpy-hidden
lib, python: DEFPY_ATTR, DEFPY_HIDDEN
2018-04-11 20:12:25 -04:00
Quentin Young
bb7f2da88d
tools: update indent.py for DEFPY_* macros
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-10 12:19:14 -04:00
Arthur Jones
915c81b3ef alpine packaging: use a more standard packaging format
Currently, we just package the frr daemons, but we don't run
them.  This is fine for basic tests, but it is inconvenient to
orchestrate the daemons from downstream test environments.

Here, we follow the redhat and debianpkg formats more closely,
putting the daemons in /usr/lib/frr and including the frr user
and groups in the package.  We also include a docker specific
startup script and a sysvinit link in /etc/init.d/frr for
openrc based alpine installs.

Testing done:

Built packages, built base images, everything seems to work fine.
Uninstalled the package, all the daemons stopped.

Issue: https://github.com/FRRouting/frr/issues/2030
Signed-off-by: Arthur Jones <arthur.jones@riverbed.com>
2018-04-09 15:34:50 -07: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
5f047032e7
Merge pull request #1984 from donaldsharp/conf_date_master
lib: Remove backwards compatiblity at 1 year
2018-03-30 12:35:53 -04:00
Russ White
a7f38c2512
Merge pull request #1980 from donaldsharp/tools_frr
tools: Cleanup shutdown
2018-03-30 10:36:34 -04:00
Olivier Dugeon
db5bdc694f
Merge pull request #1955 from qlyoung/stylechecker
tools: do not check for kernel macros
2018-03-30 13:21:22 +01:00
Lou Berger
047460795c tools: add fixup-deprecated.py script to replace deprecated quagga/frr mactors/types/etc.
Initial deprecated macros are:
	   #define VNL
	   #define VTYNL
	   #define VTY_NEWLINE
	   #define VTY_GET_INTEGER(desc, v, str)
	   #define VTY_GET_INTEGER_RANGE(desc, v, str, min, max)
	   #define VTY_GET_ULONG(desc, v, str)
	   #define VTY_GET_ULL(desc, v, str)
	   #define VTY_GET_IPV4_ADDRESS(desc, v, str)
	   #define VTY_GET_IPV4_PREFIX(desc, v, str)
	   #define vty_outln(vty, str, ...)

Signed-off-by: Lou Berger <lberger@labn.net>
2018-03-29 18:33:31 -04:00
Donald Sharp
ac654d7b9d tools: Cleanup shutdown
The shutdown code was sometimes taking 1 minute to run because
the ssd program was misbehaving after a make install.

This commit just removes the usage of ssd for shutdown
since we already have a pid file and we know that the
frr script cleans up the pid file as well.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-28 14:52:55 -04:00
Quentin Young
42732e05a9
Merge branch 'master' into stylechecker 2018-03-27 15:21:15 -04:00
Quentin Young
28ac5a0381
tools, doc: update checkpatch for u_int_*
* Checkpatch.pl now checks for nonstandard integral types
* Add shell script to replace all nonstandard types with their standard
  counterparts in C source files
* Document usage of types, mention conversion script

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-27 15:00:23 -04:00
Quentin Young
056d835596
tools: do not check for kernel macros
Certain things checked for by checkpatch.pl are kernel-specific macros
we don't have.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-22 12:11:05 -04:00
Donald Sharp
34a0beaa6c
Merge pull request #1898 from opensourcerouting/reload-helper2
tools: Add helper frr-reload shell script for clean error
2018-03-17 07:18:51 -04:00
Quentin Young
db4629b81f
Merge pull request #1890 from LabNConsulting/working/master/checkpatch1
checkpatch minor tweaks
2018-03-16 23:20:01 -04:00
Martin Winter
32398f0168 tools: Add helper frr-reload shell script for clean error
Adding the shell script allows a clean error if frr-pythontools
is not installed.

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-03-14 17:31:29 -07:00
Daniel Walton
51cee26ae2
Merge pull request #1869 from opensourcerouting/frr-reload-vnc-fix
tools/frr-reload.py: process vnc settings as sub-context
2018-03-14 07:54:53 -07:00
Lou Berger
f1beb87ed1 tools: checkpatch.sh - Add warning that // style comments don't match
recommended (kernel) comment style

Signed-off-by: Lou Berger <lberger@labn.net>
2018-03-14 10:42:20 -04:00
Lou Berger
7a7a480dfe tools: checkpatch.sh - use run specific /tmp directories, remove them when done
Signed-off-by: Lou Berger <lberger@labn.net>
2018-03-14 09:43:16 -04:00
Lou Berger
3413af0d74 tools: fix indent.py to recognize all DEFUN types:
DEFUN
    DEFUN_ATTR
    DEFUN_CMD_ELEMENT
    DEFUN_CMD_FUNC_DECL
    DEFUN_CMD_FUNC_TEXT
    DEFUN_DEPRECATED
    DEFUN_HIDDEN
    DEFUN_NOSH
    DEFUNSH
    DEFUNSH_ATTR
    DEFUNSH_DEPRECATED
    DEFUNSH_HIDDEN

Signed-off-by: Lou Berger <lberger@labn.net>
2018-03-13 05:46:03 -04:00
Christian Franke
6bd0508a89 tools/frr-reload.py: process vnc settings as sub-context
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2018-03-12 17:30:16 +01:00
Martin Winter
1708ca553b
Merge pull request #1826 from qlyoung/lsan-suppressions
tools: add LeakSanitizer suppressions list
2018-03-07 22:47:43 +01:00
Lou Berger
f574eae5c4 tools: fix indent.py FRR indent pattern matching
Signed-off-by: Lou Berger <lberger@labn.net>
2018-03-06 13:58:46 -05:00
Quentin Young
a9d0a90fe8
tools: add LeakSanitizer suppressions list
Building FRR with AddressSanitizer is kind of annoying since
libpython3.5 leaks memory, clippy links libpython3.5 and clippy runs as
part of the build process. LeakSanitizer has a way to suppress leaks at
runtime by setting the LSAN_OPTIONS environment variable to contain a
file path to a suppression list:

LSAN_OPTIONS=suppressions=path/to/suppr.txt

This commit provides the file. Setting this environment variable to

LSAN_OPTIONS=suppressions=../tools/lsan-suppressions.txt

before building should allow a clean build with ASAN enabled. The
relative path is there because LeakSanitizer looks at paths relative to
the binary it is sanitizing; clippy is in lib/ so the path is set
relative to lib/.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-05 13:28:34 -05:00
Russ White
b92aee6e7c
Merge pull request #1770 from qlyoung/random-tools
*: move random tools into tools/
2018-02-27 08:55:38 -05:00
Quentin Young
6b1ebf3c3c
Merge branch 'master' into stylechecker 2018-02-23 11:23:29 -05:00
Quentin Young
2580e72f8d
tools: finer-grained error codes for checkpatch
* 2 for errors
* 1 for warnings
* 0 for clean
* Suppress all report text for a clean result
* Remove check for const structs from perl script
* Remove grep suppression for that check from shell script

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-02-23 11:02:19 -05:00
Quentin Young
6f3835891a
tools: ignore FSF warning, fn macros in checkpatch
* Unlike Linux we do require the GPL file header
* When checking for spaces between function names and parentheses,
  ignore all-uppercase function names as these are likely to be macros,
  and function-like macros may have that space

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-02-23 10:25:30 -05:00
Philippe Guibert
513e922309 tools: fix that filters issues on resulting file only
Because checkpatch result is applied to original and new file, the
analysis also parses what may be wrong with the original file.
Whereas the script should limit to analyse only what is wrong on new
file.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-02-23 16:16:30 +01:00
Philippe Guibert
893408badc
Merge pull request #1756 from qlyoung/stylechecker
tools: improve checkpatch.sh
2018-02-22 18:55:48 +01:00
Quentin Young
86d488ce66
tools: improve checkpatch.sh
* Send reports to stderr; this allows you to get just the end result by
  redirecting stderr
* Don't attempt to copy nonexistent files

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-02-22 12:54:42 -05:00
Quentin Young
7c557e5b3d
*: move random tools into tools/
Signed-off-by: Quentin Young <qlyoung@qlyoung.net>
2018-02-20 12:37:41 -05:00
Martin Winter
5b8b08de57
Merge pull request #1542 from qlyoung/stylechecker
tools: add style checking scripts
2018-02-06 08:44:37 -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
Quentin Young
1e1c1e132b
tools: return exit status in checkpatch.sh
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-01-30 10:53:35 -05:00
Quentin Young
f5fd113cbf
tools: enable stylechecker to handle new files
Since the tool is entirely diff based, it was having some issues diffing
things that didn't exist.

Also made it a bit smarter about ignoring kernel-specific style nits we
don't really care about.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-01-23 17:06:06 -05:00
Daniel Walton
9d877afc13 tools: frr-reload 'vni' keyword does not always create a sub-context
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2018-01-17 15:57:50 +00:00
Quentin Young
a162e6a599
tools: add path support for checkpatch.sh
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-01-03 16:58:42 -05:00
Quentin Young
33fe08f4b1
tools: support unclean working directory
Adds ability to still work even when the user's base FRR directory is
not clean by caching index, working directory and deletion state in
various locations then restoring after done.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-12-20 12:54:10 -05:00
Quentin Young
3e4ae70277
tools: add style checking scripts
Add shell script and modified checkpatch.pl for use with patch files
targeting FRR.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-12-20 12:54:03 -05:00
Brian Rak
0a64aff60c tools, watchfrr: Modify timeout to 90 seconds
The default timeout of 10 seconds is too quick of a timeout
given some long running cli commands.  Modify watchfrr
to have a 90s timeout value instead.

Signed-off-by: Brian Rak <brianrak@gameservers.com>
2017-12-04 09:55:39 -05: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
smccroskey
e84b5a2a72 frr.service: remove explicit dependency on socket-based syslog.target
Testing done: built and installed for all ubuntu targets

Socket-based services such as syslog need not be specified as
dependencies in service files, and doing so may slow down boot by
reducing parallelism.  All known supported systemd-based platforms
have syslog as a socket-based service.

Clears the following lintian warnings:
W: frr: systemd-service-file-refers-to-obsolete-target lib/systemd/system/frr.service syslog.target

Signed-off-by: Silas McCroskey <smccroskey@cumulusnetworks.com>
2017-11-17 17:55:32 -08:00
Martin Winter
f0d5f80737 tools: Rename to FRRouting in frr.service file
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2017-11-17 17:55:31 -08:00
Daniel Walton
b05a1d3c03 tools: frr-reload do not attempt deleting lines that cannot be deleted
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

There are several lines that we cannot do a "no" on
- frr version
- frr defaults
- password
- line vty

frr-reload should ignore these if asked to do a "no" on them
2017-11-10 18:30:25 +00:00
Daniel Walton
4c76e59220 tools: frr-reload remove Cumulus Linux release numbers from comments
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

The "3.0", etc in the comments were referring to Cumulus Linux 3.0 which
was confusing now that FRR has a 3.0
2017-11-10 17:57:42 +00:00
Daniel Walton
028bcc883f tools: frr-reload combine "'router bgp' and line" checks
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

We had multiple places checking for

    if ctx_keys[0].startswith('router bgp') and line

Combine these into a single check
2017-11-10 17:47:13 +00:00
Daniel Walton
c755f5c434 tools: frr-reload avoid del/add of BGP table-map
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2017-11-10 17:41:43 +00:00
Daniel Walton
89cca49b3a tools: frr-reload.py ignore multiple whitespaces
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

Without this fix frr-reload would do a del/add even if the only
difference were bogus whitespaces.

root@cel-redxp-10[nclu]# /usr/lib/frr/frr-reload.py --test
/etc/frr/frr.conf

Lines To Delete
===============

router bgp 100
 no bgp router-id 1.1.1.1

Lines To Add
============

router bgp 100
 bgp   router-id 1.1.1.1
root@cel-redxp-10[nclu]#
2017-11-10 17:19:08 +00: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
Donald Sharp
6977eb91c6 *: Add some documentation about how to handle new daemons
Add some breadcrumbs for when we add a new routing daemon
so things `just work`.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-05 08:54:03 -04:00
Donald Sharp
92bd13d762 tools: Add NHRP to route flushing
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-05 08:27:31 -04:00
Donald Sharp
91effb395a tools: Fix babel RT_PROT #
We had mistakenly created another RT_PROT # for babel.
This is incorrect.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-05 08:23:27 -04:00
Donald Sharp
a6487ff6b5 tools: Fix route flush
This commit does two things:

1) Flush by proto number not string
   This is useful because not all systems might have the proto
   values installed, or a version of iproute2 that they might
   be installed with.
2) Flush missing routes that might have been installed( eigrp
   and nhrp )

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-05 08:12:44 -04:00
Daniel Walton
2f52ad9627 tools: frr-reload.py should exit(1) if vtysh config mode is locked
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2017-09-27 18:47:47 +00:00
Daniel Walton
478f9ce277 tools: frr-reload capture stderr so we can log it
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2017-09-19 13:54:35 +00:00
Daniel Walton
8ad1fe6cae tools: frr-reload support for "no no" scenario
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2017-09-19 13:06:49 +00:00
Renato Westphal
a2addae8fe *: use clang's 'ForEachMacros' format style option
This fixes the broken indentation of several foreach loops throughout
the code.

From clang's documentation[1]:
  ForEachMacros: A vector of macros that should be interpreted as foreach
  loops instead of as function calls.

[1] http://clang.llvm.org/docs/ClangFormatStyleOptions.html

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-09-15 14:53:46 -03:00
Daniel Walton
7918b33541 tools: frr-reload.py support for vni under 'address-family l2vpn evpn'
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2017-09-08 13:27:23 +00:00
David Lamparter
bd354725a6 build: non-recursive watchfrr & tools
(also forgot to remove AC_SUBST(ISISD) earlier)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-09-07 16:18:50 +02:00
David Lamparter
baf7538dc7 Merge pull request #1008 from donaldsharp/check_for_daemon_existence
tools: Always ensure that the daemon exists at startup
2017-08-21 14:23:15 +02:00
Donald Sharp
ba11736761 tools: Always ensure that the daemon exists at startup
When starting up FRR with tools/frr, ensure that the
daemon specified that we are about to start actually exists.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-18 10:57:07 -04:00
Daniel Walton
596074af62 vtysh: vtysh -f FOO should exit non-zero if it hits an error
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

Today if we hit an error while apply the contents of file FOO that error
does not bubble up to a non-zero exit.
2017-08-16 20:22:59 +00: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
Donald Sharp
f790234f2f Merge pull request #892 from opensourcerouting/watchfrr-simplify
simplify watchfrr, add --terminal, improve startup logging
2017-08-09 14:32:44 -04:00
Daniel Walton
5014d96f0f bgpd, tools, vtysh: Handle config migration from 'address-family evpn' to 'address-family l2vpn evpn'
Ticket: CM-16747
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Quentin Young <qlyoung@cumulusnetworks.com>
2017-08-08 10:28:50 -04:00
David Lamparter
27e295b591 tools: remove watchfrr -A/-a/-z from init scripts
These don't exist anymore.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-02 23:36:42 +02:00
Dave Olson
a7c9d77a08 Switch to using syslog for logging as the default
Switch to using syslog as the default logging mechanism, rather than
the log file mechanism.

Send SIGHUP to syslog (any process with syslog in the name) if they have
files open in /var/log/frr/* (for debian, using lsof).  For redhat, add
sending HUP to any of the pids in /var/run/*syslog*pid, for /var/log/frr/frr.log

Updated logrotate.d/frr to handle all the new daemons for debian; redhat
already had them.

Continue to send SIGUSR1 to all running frr daemons even when syslog is
in use, in case logging has been switched from file to syslog or vice versa.
For debian, accumulate all the PIDs and use a single kill command.

Add /etc/rsyslogd.d/45-frr.conf to have all frr daemons (and tag
frr) logs go to /var/log/frr/frr.log.  If other syslog daemons are
used, logs will go to default log file.

Signed-off-by: Dave Olson <olson@cumulusnetworks.com>
2017-07-31 12:53:01 -07: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
Jafar Al-Gharaibeh
1a8c43f114 tools: update to use FRR name
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2017-07-12 13:26:22 -05:00
Ryan Hagelstrom
10bec2d24f tools: etc needed in extra dist to make distribution correctly
Signed-off-by: Ryan Hagelstrom <rhagelstrom@gmail.com>
2017-07-07 13:43:01 -05:00
Russ White
ea52147f10 Merge pull request #707 from donaldsharp/debian_babel
tools: Fix startup to include babel
2017-06-19 21:58:36 -04:00
Renato Westphal
c740f7d367 ldpd: convert cli and get rid of the xml interface
The xml2cli.pl script was useful years ago when the vty code was very
rudimentary. This is not the case anymore, so convert all ldpd CLI
commands to use DEFUNs directly and get rid of the XML interface.

The benefits are:
* Consistency with the other daemons;
* One less build dependency (the LibXML perl module);
* Easier to add new commands.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-06-16 14:43:42 -03:00
Donald Sharp
97f653d0e2 tools: Fix startup to include babel
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-06-13 10:43:20 -04:00
David Lamparter
97bd5c48de Merge remote-tracking branch 'frr/master' into pull-624 2017-06-13 09:18:14 +02:00
Donald Sharp
40078ccb05 tools, zebra: Allow zebra to insert babel routes as babel
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-06-08 08:56:36 -04:00
Donald Sharp
1f047d8d2c tools, zebra: Fix netlink notification of who owns the routes
For NHRP, EIGRP and LDP( This is for consistency as opposed to correctness )
assign some new values to routes to be installed into the kernel
so we can know who owns them later.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-06-08 08:51:25 -04:00
David Lamparter
57463530f3 Merge branch 'stable/3.0'
Conflicts:
	ospf6d/ospf6_lsa.c
	ospfd/ospf_vty.c
	zebra/interface.c

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-18 12:28:12 +02:00
David Lamparter
92eedda1fb Merge branch stable/2.0 into stable/3.0
Conflicts:
	bgpd/bgp_fsm.c
	ospf6d/ospf6_lsa.c
	ospfd/ospf_vty.c
	zebra/redistribute.c

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-18 12:23:13 +02:00
Daniel Walton
e80c8c5531 tools: Allow frr-reload.py to know about agentx
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-17 00:25:28 +00:00
Daniel Walton
ec3fd95774 tools: frr-reload.py VtyshMarkException needs to include "vtysh -m"
output

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2017-05-17 00:23:38 +00:00
Daniel Walton
619c4e3acf frr-reload.py fails on "no debug ospf6 message unknown"
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2017-05-17 00:22:00 +00:00
Daniel Walton
970c956816 tools: frr-reload removes "ipv6 nd ra-interval" and "no ipv6 nd supp"
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2017-05-17 00:18:33 +00:00
Daniel Walton
afa2e8e187 tools: reload handle removal of entire address-family section under BGP
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

When an entire address-family section is removed from under BGP, we
cannot just issue 'no address-family foo bar' as address-family line
doesn't support 'no'. We have to delete the individual lines under the
address-family.
2017-05-17 00:16:09 +00:00
Daniel Walton
825be4c27b tools: frr-reload.py should exit non-zero when "set src x.x.x.x" fails
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-17 00:14:37 +00: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
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
Quentin Young
61de994bcf tools: $valgrind --> "$valgrind"
String cmp missing quotes

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-12 23:29:58 +00:00
Christian Franke
e67d443ba1 tools: update .gitignore
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2017-05-11 15:15:52 +02: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
Hung-Weic Chiu
bb1e60c3a1 - Solve the Coverity Scan PW.ASSIGN_WHERE_COMPARE_MEANT
- Minor refactoring

Signed-off-by: Hung-Weic Chiu <sppsorrg@gmail.com>
2017-05-10 15:46:24 -04:00
Donald Sharp
a1b4f854b0 Merge remote-tracking branch 'origin/stable/3.0' 2017-05-09 20:39:35 -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
Donald Sharp
dbb12b8da9 Merge remote-tracking branch 'origin/master' into datacenter 2017-05-08 14:44:25 -04:00
Martin Winter
a9a65fbc6e Merge pull request #449 from dwalton76/valgrind-enable
Add valgrind_enable option to /etc/frr/debian.conf
2017-05-08 16:32:42 +02:00
Daniel Walton
84be3a03be Added config option for valgrind executable
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2017-05-08 13:28:07 +00: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
Quentin Young
dfe536f475 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:18:14 +00:00
Donald Sharp
82e6e35843 *: Rename debian.conf -> daemons.conf
The debian.conf file is to specific of a name towards
debian distributions.  Rename to be daemons.conf

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-04 12:45:01 -04:00
Donald Sharp
423ca47c18 tools: Proper file name is frr.conf
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-04 12:10:18 -04:00
Donald Sharp
993eafddcb *: Move etc/frr into tools
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-04 12:09:22 -04:00
Donald Sharp
1f64e4d935 *: Move default/frr into tools directory
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-04 12:07:45 -04:00
Donald Sharp
2db86748db *: Move sudoers file into tools
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-04 12:06:11 -04:00
Donald Sharp
cd9fad823d *: Move ssd from cumulus to tools directory
As discussed on the mailing list, the cumulus directory should
be going away.  This commit moves the ssd from cumulus to tools

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-04 11:58:36 -04:00
Daniel Walton
d088b27ebd Add valgrind_enable option to /etc/frr/debian.conf
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

This allows you to start all daemons via valgrind so you can catch
memory leaks, etc.
2017-05-03 13:18:20 +00:00
Donald Sharp
b46be72b4a Merge branch 'master' into EIGRP 2017-05-02 11:38:06 -04:00
Donald Sharp
22d289d393 *: Move the cumulus/etc/rt_protos.d/frr.conf
Moving cumulus/etc/rt_protos.d/frr.conf to tools/etc/rt_protos.d/frr.conf

Requested in Review.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-04-25 07:37:00 -04:00
Dinesh G Dutt
23b1f33451 Add source of route as protocol string in ip route pushed into kernel
Ticket: CM-14313
Reviewed By:
Testing Done: bgpmin, ospfmin, bgp_kitchen_sink_test

'ip route show' displays all routes as belonging to protocol zebra.
The user has to run an additional command (in vtysh) to get the actual
source of a route (bgp/ospf/static etc.). This patch addresses that by
pushing the appropriate protocol string into the protocol field of the
netlink route update message. Now you can see routes with the correct
origin as well as filter on them (ip route show proto ospf).

'ospf' is used for both IPv4 and IPv6 routes, even though the OSPF
version is different in both cases.

Sample output (old):
9.9.12.13 via 69.254.2.38 dev swp3.2  proto zebra  metric 20
9.9.13.3  proto zebra  metric 20
        nexthop via 69.254.2.30  dev swp1.2 weight 1
        nexthop via 69.254.2.34  dev swp2.2 weight 1
        nexthop via 69.254.2.38  dev swp3.2 weight 1

Sample output (new):
9.9.12.13 via 69.254.2.38 dev swp3.2  proto bgp  metric 20
9.9.13.3  proto bgp  metric 20
        nexthop via 69.254.2.30  dev swp1.2 weight 1
        nexthop via 69.254.2.34  dev swp2.2 weight 1
        nexthop via 69.254.2.38  dev swp3.2 weight 1
2017-04-20 21:24:31 -04:00
Donald Sharp
97133f7915 Merge remote-tracking branch 'origin/master' into EIGRP 2017-04-05 20:52:32 -04:00
Donald Sharp
e6ddb8e28b cumulus, tools: Fix up startup
Allow EIGRP to work within the startup scripts

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-04-05 19:24:15 -04:00
Daniel Walton
2ce26af100 tools: quagga-reload.py fails to change max-paths
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2017-04-04 18:51:32 +00:00
Martín Beauchamp
685e701ef3 Lowercase frr.conf 2017-03-09 09:45:00 -05:00
Donald Sharp
c838ce0e03 cumulus, tools: Allow nhrpd to be brought up
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-07 16:51:26 +01:00
David Lamparter
a523ab9fc8 Merge branch 'frr/pull/236' ("tools: frr-reload.py needs to treat "mpls" as a single line context")
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-07 16:02:41 +01:00
Daniel Walton
a11209a79b tools: frr-reload.py needs to treat "no " as a single line context
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-03 19:57:27 +00:00
Donald Sharp
55d56e8eb7 tools: Allow ldpd to be started
Allow ldpd to be started at runtime with the frr script.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-02 08:57:46 -05:00
Daniel Walton
45cb21bf96 tools: frr-reload.py needs to treat "mpls" as a single line context
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-01 21:20:34 +04:00
Martín Beauchamp
e20dc2ba06 Lowercase frr.conf 2017-02-27 13:26:20 -05:00
Daniel Walton
53bddc224c tools: frr-reload removes "ipv6 nd ra-interval" and "no ipv6 nd suppress-ra"
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2017-02-18 02:05:56 +12:00
Donald Sharp
305e9740ff Merge remote-tracking branch 'origin/stable/2.0' 2017-02-09 09:53:46 -05:00
Donald Sharp
0dca233ec0 *: Found some instances of Quagga.conf
Cleanup Quagga.conf -> Frr.conf

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-07 13:44:09 -05:00
Donald Sharp
7df2e1c379 Merge remote-tracking branch 'origin/stable/2.0' 2017-02-07 13:20:12 -05:00
Donald Sharp
1a35e2e565 Merge remote-tracking branch 'origin/stable/2.0' 2017-02-02 10:42:51 -05:00
Renato Westphal
45a8eba972 ldpd: introduce advanced filtering capabilities
This patch introduces several new configuration commands to ldpd. These
commands should allow the operator to define advanced filtering policies
for things like label advertisement, label allocation, etc.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-02-01 22:03:36 -02:00
David Lamparter
3cb50bf1ee Revert "*: Add source of route as protocol string in ip route pushed into kernel"
This reverts commit 1a11782c40.

The change is not suitable for stable/2.0, it's not a bugfix and has
quite a visible user impact.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-31 13:51:27 +01:00
Dinesh G Dutt
4d760f4255 tools: Silly typo in regex for catching ip route syntax
Ticket: CM-14600
Reviewed By: CCR-5615
Testing Done: Verifying the issue with/without the fix

I had intended the regexp to catch both ip and ipv6 routes, but somewhere
along the way, I left out the grouping in the regexp to catch if it was
ip or ipv6 at the start. This caused all the rest of the matches and replaces
to be off causing the issue reported by the bug.

Signed-off-by: Dinesh Dutt <ddutt@cumulusnetworks.com>
2017-01-30 13:40:53 -05:00
Dinesh G Dutt
1a11782c40 *: Add source of route as protocol string in ip route pushed into kernel
Ticket: CM-14313
Reviewed By:
Testing Done: bgpmin, ospfmin, bgp_kitchen_sink_test

'ip route show' displays all routes as belonging to protocol zebra.
The user has to run an additional command (in vtysh) to get the actual
source of a route (bgp/ospf/static etc.). This patch addresses that by
pushing the appropriate protocol string into the protocol field of the
netlink route update message. Now you can see routes with the correct
origin as well as filter on them (ip route show proto ospf).

'ospf' is used for both IPv4 and IPv6 routes, even though the OSPF
version is different in both cases.

Sample output (old):
9.9.12.13 via 69.254.2.38 dev swp3.2  proto zebra  metric 20
9.9.13.3  proto zebra  metric 20
        nexthop via 69.254.2.30  dev swp1.2 weight 1
        nexthop via 69.254.2.34  dev swp2.2 weight 1
        nexthop via 69.254.2.38  dev swp3.2 weight 1

Sample output (new):
9.9.12.13 via 69.254.2.38 dev swp3.2  proto bgp  metric 20
9.9.13.3  proto bgp  metric 20
        nexthop via 69.254.2.30  dev swp1.2 weight 1
        nexthop via 69.254.2.34  dev swp2.2 weight 1
        nexthop via 69.254.2.38  dev swp3.2 weight 1

Signed-off-by: Dinesh Dutt <ddutt@cumulusnetworks.com>
2017-01-30 13:40:53 -05:00
Dinesh G Dutt
0845b8727a tools: Fix unbound newaddr variable, fix too-broad except clauses
Ticket: CM-14351
Reviewed By: dwalton
Testing Done:attempts to run NCLU test failed, Daniel verified.

Uninit variable bug, plus missed adding ValueError to the except
clauses in a couple of places.

Signed-off-by: Dinesh Dutt <ddutt@cumulusnetworks.com>
2017-01-30 13:40:53 -05:00
Dinesh G Dutt
bb972e4465 tools: Normalize prefix-lists and IP networks for avoiding unnecessary reload
Ticket: CM-14280, CM-14281, CM-14286
Reviewed By: CCR-5546
Testing Done: quagga_service_test, bgp_enhe, bgp_vrf etc.

If the user specifies a network statement such as "network 1.1.1.1/24",
the running config shows this as "network 1.1.1.0/24" which causes
unnecessary withdrawl of the prefix and re-advertisement causing
perturbations. The same thing applies to prefix-lists and of course, IPv6
addresses.

IPv6 addresses were being normalized already, and so we use that same
function to handle the IPv6 portion of the issue. Interestingly community
strings were also getting ensnared in the normalized IPv6 function due to
the presence of ':', but thats OK.

quagga's running config changes 'null0' and 'blackhole' keywords into 'Null0'.
For example: ip route 10.1.1.0/24 blackhole' is displayed as
'ip route 10.1.1.0/24 Null0'. Reload mistakes this and issues a delete of the
Null0 route followed by an add of the "blackhole" route. Unnecessary, and
results in unexpected routing perturabations.

Also fix prefix-list's le/ge behavior: It always prints ge first even if the
user has specified le followed by ge, and it doesn't print l3 32/128 if ge
is also specified, else it prints them.

Signed-off-by: Dinesh Dutt <ddutt@cumulusnetworks.com>
2017-01-30 13:40:53 -05:00
Dinesh G Dutt
768bf950cf tools: Handle deletes of entire interface context as deleting each line
Ticket: CM-14260
Reviewed By: CCR-14260
Testing Done: quagga reload tests (quagga_service, bgp_enhe etc.)

Quagga reload handles deletes of entire context by issuing a "no.." on the
entire context itself instead of deleting each individual line of the context.
However, this doesn't work when the context is "interface" since its not
allowed to do "no interface <ifname>" inside quagga. So special case this by
deleting each individual line of the context.

Signed-off-by: Dinesh Dutt <ddutt@cumulusnetworks.com>
2017-01-30 13:40:53 -05:00
Dinesh G Dutt
0bf7cc2888 tools: Handle lack of "seq" in prefix-list statements.
Ticket: CM-14259
Reviewed By: CCR-5527
Testing Done:

If users specify "ip prefix-list FOO permit 1.2.3.4/24", running config
displays that line as "ip prefix-list FOO seq 5 permit 1.2.3.4/24", which
causes reload to delete the running config line and add back the one in
the config.

This patch fixes that.

Signed-off-by: Dinesh Dutt <ddutt@cumulusnetworks.com>
2017-01-30 13:40:49 -05:00
Dinesh G Dutt
4b78098d79 tools: Don't overwrite Quagga.conf on reload, unless user specified.
Ticket: CM-14059
Reviewed By: CCR-5524
Testing Done: the usual

At some point in the 3.x release cycle, it was decided to overwrite the
user's Quagga.conf configuration file with the output of running config
when the user did a quagga reload. This is problematic for several reasons
such as: losing user-specified comments, upsetting network automation
scripts which think some thing has changed all the time from the specified
config etc.

This patch fixes this issue by not overwriting the Quagga.conf file unless
the user specifies it via an additional option, or the file being used as
input to quagga reload isn't the default configuration file (incl. path).

Signed-off-by: Dinesh Dutt <ddutt@cumulusnetworks.com>
2017-01-30 13:40:40 -05:00
Dinesh G Dutt
78e31f4663 tools: Fix unnecessary routing perturbations due to old style config
Ticket: CM-14060
Reviewed By:
Testing Done:

There are two harmful problems (cause routing changes in the network) with the
2.5.x style config:
    one with the old style specification of "multipath as-relax", and
    the other with ip import-table, used by redistribute neighbor

In 2.5, we had the user specify 'no-as-set' as the suffix to
'bgp bestpath as-path multipath relax' to avoid quagga's default behavior
which'd cause weird routing problems. However, in 3.x, we made 'no-as-set' as
the default, and so its neither required to specify it nor is it shown in the
running config. This means when we do quagga reload, we remove the multipath
as-relax line and add it back with the no-as-set line. This causes all BGP
sessions to be reset.

The problem with the "ip import-table" is that it causes us to unimport the
routes and then add it back again, causing routing prefix changes throughout
the network, potentially causing blackholing of traffic.

This fix addresses both these issues and avoids the unnecessary routing blips.

Signed-off-by: Dinesh Dutt <ddutt@cumulusnetworks.com>
2017-01-30 13:40:04 -05:00
David Lamparter
0bf5b1cbe3 lib: parser: simplify OPTION_TKN & SELECTOR_TKN
These are functionally identical as "fork" tokens.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23 21:52:43 +01:00
David Lamparter
7758fe9f60 build: fix several ldpd XML-CLI build issues
- the location of ldp_vty_cmds.c can be either in srcdir or builddir,
  depending on whether a premade file from a dist tarball is used
- perl libxml support is only needed if that file is absent
- the actual perl script wasn't even included in the dist tarball
- the include location doesn't work when srcdir != builddir

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-17 19:00:10 +01:00
Donald Sharp
6847b9bfb9 Merge pull request #39 from opensourcerouting/renato-assorted-fixes
Renato's assorted patches
2017-01-06 14:00:29 -05:00
Donald Sharp
3b14d86eed Merge remote-tracking branch 'origin/stable/2.0' 2017-01-06 09:58:21 -05:00
Donald Sharp
d8e4c43827 debian: Convert Quagga -> Frr
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-04 09:25:20 -05:00
Donald Sharp
9473e34052 watchfrr: Rename watchquagga -> watchfrr
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-03 20:13:02 -05:00
Renato Westphal
bdcf7abf82 tools: teach xml2cli.pl the "[]" notation for optional arguments
Requested by Daniel Walton.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-01-03 22:03:28 -02:00
David Lamparter
5304ba7e56 *: kill useless if(...) after VTY_DECLVAR_CONTEXT
VTY_DECLVAR_CONTEXT already contains a NULL check, vty warning message
and return statement.  These are not needed.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-09 17:50:01 +01:00
David Lamparter
52c6b0e20a *: fix remaining vty->index & add coccinelle patch
Fix instances that the coccinelle patch didn't catch (or which
coccinelle couldn't parse), and add the patch file for future posterity
(and application to yet-unmerged branches).

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-09 17:36:25 +01:00
Quentin Young
3857f9ff97 tools: drop cmd_check.py
CLI defuns are static so the compiler catches unused
definitions, ergo no longer necessary to have a script
for this.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-12-02 19:09:11 +00:00
David Lamparter
2ab402707f lib: move command_parse_format prototype
The function prototype for command_parse_format() is better left in
command.h, so that the bison-generated header file doesn't need to be
included for that.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-01 18:45:22 +01:00
Renato Westphal
64bf316f34 xml2cli/ldpd: sync with the latest changes in CLI code
* use argv[N]->arg instead of argv[N];
* don't skip over non-variable args anymore;
* convert <>s to ()s and ()s to <>s;

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-28 18:12:18 +01:00
Quentin Young
3bd20d8460 Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>

Conflicts:
	zebra/interface.c
2016-11-22 21:36:54 +00:00
Donald Sharp
50e24903ba *: Fix up licensing to be right
These files were submitted by Cumulus but did
not properly setup the licensing of them.
This fixes that issue.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-11-18 10:14:03 -05:00
Quentin Young
b6ffa87818 tools: Remove CLI refactoring tools
No longer need automatic refactoring tools for CLI backend.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-11-12 09:17:48 +00:00
Quentin Young
07321a065d Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>

Conflicts:
	lib/command.c
	lib/vty.c
2016-11-12 05:17:37 +00:00
Quentin Young
14fe9c1525 tools: Update permutations generator for hidden/deprecated
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-11-10 23:21:06 +00:00
Donald Sharp
82b4d5da4b Merge remote-tracking branch 'origin/cmaster' into cmaster-next 2016-11-10 07:57:51 -05:00
Donald Sharp
207e0d7a79 watchquagga: Signal when we are actually up and running
When Quagga is starting up, it is returning immediately.
This is leaving us in a state where systemd believes
Quagga is up and running, while the sytem might actually
not have restarted the code yet.

Modify the code so that when watchquagga starts up
it doesn't start communicating with systemd until
such time that it detects that all daemons are
running.

Additionally modify watchquagga to touch a
file in /var/run/quagga/ that the /usr/lib/quagga/quagga
script looks for for 10 seconds.  If it finds this
Quagga started file then we know watchquagga
has successfully communicated with all daemons.
If after 10 seconds we haven't communicated
with Quagga, continue on for the start and let the
normal start failure code work.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-11-09 12:52:42 -05:00
Quentin Young
e9e190f245 Merge branch 'cmaster-next' into vtysh-grammar
Conflicts:
	vtysh/vtysh.c
	zebra/zebra_vty.c
2016-10-25 19:38:04 +00:00
Quentin Young
9b2eee91b5 tools: Fix bug whereby no searches were made
Bad assignment in header file parsing resulted in all
commands being pruned before searching for installations.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-10-25 04:01:50 +00:00
Quentin Young
1b81c5bde0 tools: Be a little more strict when matching command names
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-10-25 00:36:11 +00:00
Quentin Young
55bdefacac tools: cmd_check.py checks headers too
Sometimes commands are externed and installed in another
file, so check for a command's name in the header file
corresponding to the file it's defined in before marking
it uninstalled.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-10-25 00:29:25 +00:00
Quentin Young
71f11720ef tools: Add tool to check for uninstalled commands
cmd_check.py parses source files looking for commands
that are defined but not installed in any node.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-10-24 22:55:44 +00:00
Quentin Young
e52702f29d Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>

Conflicts:
	bgpd/bgp_route.c
	bgpd/bgp_routemap.c
	bgpd/bgp_vty.c
	isisd/isis_redist.c
	isisd/isis_routemap.c
	isisd/isis_vty.c
	isisd/isisd.c
	lib/command.c
	lib/distribute.c
	lib/if.c
	lib/keychain.c
	lib/routemap.c
	lib/routemap.h
	ospf6d/ospf6_asbr.c
	ospf6d/ospf6_interface.c
	ospf6d/ospf6_neighbor.c
	ospf6d/ospf6_top.c
	ospf6d/ospf6_zebra.c
	ospf6d/ospf6d.c
	ospfd/ospf_routemap.c
	ospfd/ospf_vty.c
	ripd/rip_routemap.c
	ripngd/ripng_routemap.c
	vtysh/extract.pl.in
	vtysh/vtysh.c
	zebra/interface.c
	zebra/irdp_interface.c
	zebra/rt_netlink.c
	zebra/rtadv.c
	zebra/test_main.c
	zebra/zebra_routemap.c
	zebra/zebra_vty.c
2016-10-17 23:36:21 +00:00
Quentin Young
943624d733 tools: Pretty print graph after input permutations
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-10-07 18:39:24 +00:00
Quentin Young
73baf6a3a6 tools: add copyright header & usage to permutations
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-10-02 19:30:08 +00:00
Quentin Young
96dcc565e6 tools: add command permutations generator
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-10-02 19:13:59 +00:00
Daniel Walton
22b27e9530 ospfd: added some missing <>s
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-30 16:05:55 +00:00
Daniel Walton
6de69f8305 all: added some missing <>s within []s
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-30 15:31:48 +00:00
Daniel Walton
00d7d2d345 bgpd and zebra: scrubbed argc CHECK MEs
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-29 18:21:36 +00:00
Daniel Walton
67656e9b65 all: added CHECK ME for DEFUNs that look at argc
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-29 17:48:57 +00:00
Daniel Walton
d04c479dd9 bgpd: change some <1-10> to (1-10>
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-28 05:07:45 +00:00
Daniel Walton
8d62b1417e tools: quagga-reload should raise Exception instead of exiting
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

NCLU imports quagga-reload.py and uses its Config class to parse
Quagga.conf.  The Config class will call 'vtysh -m -f Quagga.conf" and
if that exited with an error Config would call sys.exit(1) which in my
cases causes the NCLU daemon to exit which is bad.  The fix is to have
the Config class raise an exception instead of exiting, then NCLU can
catch the exception, log it and move on.

(cherry picked from commit 276887bb1c)
2016-09-27 16:00:47 +00:00
Daniel Walton
276887bb1c tools: quagga-reload should raise Exception instead of exiting
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

NCLU imports quagga-reload.py and uses its Config class to parse
Quagga.conf.  The Config class will call 'vtysh -m -f Quagga.conf" and
if that exited with an error Config would call sys.exit(1) which in my
cases causes the NCLU daemon to exit which is bad.  The fix is to have
the Config class raise an exception instead of exiting, then NCLU can
catch the exception, log it and move on.
2016-09-27 15:56:36 +00:00
Daniel Walton
199d90a10e Expand #defines in command strings
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-25 16:49:39 +00:00
Daniel Walton
3ce54f7812 Expand #defines in command strings
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by:   Don Slice <dslice@cumulusnetworks.com>
Reviewed-by:   Sam Tannous <stannous@cumulusnetworks.com>

Ticket:
2016-09-25 14:22:48 +00:00
Daniel Walton
9ccf14f739 Expand #defines in command strings
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-25 14:10:48 +00:00
Daniel Walton
8334fd5ade bgpd: fixed more CHECK MEs in bgp_vty.c
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-25 02:29:38 +00:00
Daniel Walton
c349116d7c lib: add 'int idx_foo' argv index variables
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 20:17:29 +00:00
Daniel Walton
80fa0c69e8 ripd: add 'int idx_foo' argv index variables
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 20:06:40 +00:00
Daniel Walton
b181fa04e2 pimd: add 'int idx_foo' argv index variables
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 20:03:41 +00:00
Daniel Walton
8d769265c4 ospfd: add 'int idx_foo' argv index variables
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 20:01:26 +00:00
Daniel Walton
51c2641415 ospf6d: add 'int idx_foo' argv index variables
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 19:56:31 +00:00
Daniel Walton
ba4c5c8307 isisd: add 'int idx_foo' argv index variables
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 19:50:58 +00:00
Daniel Walton
c500ae4060 bgpd: add 'int idx_foo' argv index variables
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 19:45:50 +00:00
Daniel Walton
7c022376c8 zebra: add 'int idx_foo' argv index variables
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 19:26:31 +00:00
Daniel Walton
0c515adf43 zebra: compress multiple whitespaces in command string
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 14:02:55 +00:00
Daniel Walton
6147e2c694 convert <1-255> to (1-255), ()s to <>s, etc
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 13:47:20 +00:00
Renato Westphal
eac6e3f027 ldpd: adapt the code for Quagga
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-09-23 09:31:09 -04:00
Daniel Walton
a5b5627b8b tools: argv_translator convert <1-255> to (1-255), ()s to <>s, etc
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 13:27:26 +00:00
Daniel Walton
9b8fa94e1f tools: alias_destroyer re_install_element None check
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 04:12:43 +00:00
Daniel Walton
c66bbd697d tools: added alias_destroyer.py
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 03:27:05 +00:00
Daniel Walton
b823bd432c isisd: argv update
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 01:07:05 +00:00
Daniel Walton
6f1ccc12de lib: argv update for filter.c, if_rmap.c keychain.c and plist.c
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 00:58:26 +00:00