Commit Graph

391 Commits

Author SHA1 Message Date
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