Philippe Guibert [Tue, 13 Mar 2018 14:26:03 +0000 (15:26 +0100)]
lib: privileges are granted to vty netns command
Vty commands that link netns context to a vrf is requiring some
privileges. The change consists in retrieving the privileges at the
vrf_cmd_init() called by the relevant daemon. Then use it.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Quentin Young [Tue, 6 Mar 2018 23:08:37 +0000 (18:08 -0500)]
zebra: reorganize zserv, batch i/o
Group send and receive functions together, change handlers to take a
message instead of looking at ->ibuf and ->obuf, allow zebra to read
multiple packets off the wire at a time.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Quentin Young [Tue, 6 Mar 2018 22:57:33 +0000 (17:57 -0500)]
zebra: standardize ZAPI message handler args
A lot of the handler functions that are called directly from the ZAPI
input processing code take different argument sets where they don't need
to. These functions are called from only one place and all have the same
fundamental information available to them to do their work. There is no
need to specialize what information is passed to them; it is cleaner and
easier to understand when they all accept the same base set of
information and extract what they need inline.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Quentin Young [Tue, 6 Mar 2018 22:01:42 +0000 (17:01 -0500)]
zebra: dont return a status code in zapi handlers
All of the ZAPI message handlers return an integer that means different
things to each of them, but nobody ever reads these integers, so this is
technical debt that we can just eliminate outright.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Quentin Young [Fri, 9 Mar 2018 17:07:25 +0000 (12:07 -0500)]
lib: add convenience debugging macros
* Add DEBUG*() macros
This set of macros allows you to write printf-like debugging lines that
automatically check whether a debug is on before printing. This should
eliminate the need for explicit checks in simple cases. For example:
if (SUCH_AND_SUCH_DEBUG_IS_ON) {
zlog_warn(...);
}
Becomes:
DEBUG(warn, such_and_such, ...);
Or, equivalently,
DEBUGE(such_and_such, ...);
The levels passed to DEBUG are expanded into the names of zlog_*
functions, so the same zlog levels are available. There's also a set of
macros that have the level built into them; DEBUGE for errors, DEBUGW
for warnings, etc. Good for brevity.
* Add singular setting macros
Change the 'SET' macros to accept a boolean indicating whether the
provided bits should be set or unset, and map on/off macros to them.
Helps condense code where you already have a boolean condition that
tells you what you want to do as you can avoid writing the branch.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Arthur Jones [Sun, 11 Mar 2018 17:32:24 +0000 (10:32 -0700)]
alpine: minimal alpine packaging
For building dev packages for alpine, we provide a minimal APKBUILD
file and add a configure option for only numeric versions in the
VERSION variable as alpine does not allow non-numeric characters
in the version string.
These changes allow alpine to be built, but don't yet provide a
mechanism to build. Changes to do the build in docker are coming
soon...
Testing done:
Built alpine packages in local docker environment, packages
showed no "dev" in the package name. Also built CentOS packages
with numeric version disabled and the "dev" is still in the package
name.
Issue: https://github.com/FRRouting/frr/issues/1859 Signed-off-by: Arthur Jones <arthur.jones@riverbed.com>
Arthur Jones [Fri, 9 Mar 2018 23:08:24 +0000 (15:08 -0800)]
zebra/if_netlink: compile under musl-libc
musl-libc is a lightweight libc used by alpine linux:
https://www.musl-libc.org/
AFAICT, this is the only change to the source needed to get
basic frr support compiling on musl.
Two changes in one patch, get ethhdr from netinet/if_ether.h
and replace the only __caddr_t I could find in the source base
with caddr_t.
Testing done:
Compiled apk packages using a docker environment (patches
coming soon) also compiled redhat and debian using a similar
docker environment (RFC patches for those changes are queued
up too)...
Issue: https://github.com/FRRouting/frr/issues/1859 Signed-off-by: Arthur Jones <arthur.jones@riverbed.com>
Donald Sharp [Fri, 23 Feb 2018 18:45:36 +0000 (13:45 -0500)]
zebra: Make the ifp part of the rule structure
Every place we need to pass around the rule structure
we need to pass around the ifp as well. Move it into
the structure. This will also allow us to notify up
to higher level protocols that this worked properly
or not better too.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Donald Sharp [Fri, 16 Feb 2018 01:11:12 +0000 (20:11 -0500)]
zebra: Cleanup api
Allow the add/delete to go through a intermediary function in
zebra_pbr.c instead of directly to the underlying os call. This
will allow future refinements to track the data a bit better
so that on shutdown we can delete the rules.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
vivek [Sun, 4 Feb 2018 12:33:33 +0000 (12:33 +0000)]
*: PBR - netlink interaction and basic definitions
Implement netlink interactions for Policy Based Routing. This includes
APIs to install and uninstall rules and handle notifications from the
kernel related to rule addition or deletion. Various definitions are
added to facilitate this.
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Donald Sharp [Mon, 5 Feb 2018 15:40:09 +0000 (10:40 -0500)]
bgpd, lib, zebra: Switch to work_queue_free_and_null
The work_queue_free function free'd up the wq pointer but
did not set it too NULL. This of course causes situations
where we may use the work_queue after it is freed. Let's
modify the work_queue to set the pointer for you.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Quentin Young [Wed, 7 Mar 2018 19:35:20 +0000 (14:35 -0500)]
doc: fix make setup
Iron out all of the glitches with recursive Automake, 3rd-party
autogenerated Sphinx makefiles, building and installing 3 different
document formats under different targets, and handling clean.
* Implement all Automake-required targets for 3rd-party Makefiles
* Setup subdirectories for 3rd-party Makefiles
* Override implicit Automake document targets
* Clean up explicit targets for developer docs
* Move Sphinx-generated Makefile to an include file
* Update targets for debian packaging
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Donald Sharp [Tue, 6 Mar 2018 21:07:14 +0000 (16:07 -0500)]
lib: Increase zapi buffer size
The buffer size is currently 4k. Increase x4 times to allow for bigger
messages to be sent over the zapi.
The current size sufficient for most cases, but there are a couple
of cases with installing data to the kernel ip rules where we will
quickly hit this 4k size limit. I forsee flowspec getting close
to this limit as well.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Quentin Young [Tue, 6 Mar 2018 18:42:53 +0000 (13:42 -0500)]
ospfd: cancel SR thread at shutdown
Otherwise if it is scheduled the thread pointer will be accessed after
the shutdown task finishes accessing, having deleted the structure that
owns said pointer, which causes a heap UAF.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
The NS_DEFAULT value returns UNKNOWN in the case the vrf lite backend is
used, whereas this is wrong. This commit fixes the default value.
Also, it fixes the default value in the case NETNS support from system
is not ok, or some error can occur when reading default NS at startup.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
bgpd: permit bgp vrf socket creation on some cases
When VRF is not yet available at startup, the check for main socket
presence must be done. As the main socket creation is made in a separate
place from vrf socket for netns, ths main socket creation must not be
prevented when a BGP VRF relies on vrf lite mechanism.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Quentin Young [Tue, 6 Mar 2018 15:33:21 +0000 (10:33 -0500)]
doc: prevent `clean` target from building manpages
Unconditional automake subdirectory flag = 'man' causes manpages to
always be built regardless of target, which is undesirable for `clean`.
Remove unconditional flag and override automake targets that need to
build manpages instead.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>