Commit Graph

360 Commits

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