Commit Graph

142 Commits

Author SHA1 Message Date
Renato Westphal
1c2facd12d lib: introduce new northbound API
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-10-27 16:16:12 -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
David Lamparter
68b8a15f87 lib: add libunwind support for backtraces
libunwind provides an alternate to backtrace() for printing out the call
stack of a particular location.  It doesn't use the frame pointer, it
goes by the DWARF debug info.  In most cases the traces have exactly the
same information, but there are some situations where libunwind traces
are better.

(On some platforms, the libc backtrace() also uses the DWARF debug info
[e.g.: ARM backtraces are impossible without it] but this is not the
case everywhere, especially not on BSD libexecinfo.)

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-18 02:51:51 +02:00
Lou Berger
e239241534
Merge pull request #3116 from opensourcerouting/libfrr-exec
lib: print version information in libfrr.so
2018-10-02 07:03:08 -04:00
David Lamparter
42efb0d43b lib: print version information in libfrr.so
This makes libfrr.so executable to print its version info.  This is
useful if you need to check your libfrr.so matches your daemons.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-02 10:26:25 +02:00
David Lamparter
d6e7625706 build: add --enable-static-bin option
This option can be used to get statically linked binaries.

Note: libfrr.la is removed from modules' library dependency list.  This
is intentional and explained in a comment in lib/subdir.am.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-01 14:56:18 +02:00
Donald Sharp
634949aef8 lua: Initial Lua import
This code sets up the ability to use lua inside of FRR.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-26 21:21:23 -04:00
David Lamparter
dbac691da6 build: fix & clean up *SAN flags
ASAN/MSAN/TSAN flags need to be in CFLAGS and LDFLAGS; the latter links
the correct compiler-dependent library.  Also, the configure switch was
broken (--disable-... would enable the sanitizer.)

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-08 21:30:42 +02:00
David Lamparter
74dc19a2f5 build: move vtysh & manpage listings to subdir.am
Since we're now building through one large Makefile, we can easily put
things with their daemons and crossreference nicely.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-08 21:30:19 +02:00
David Lamparter
aad24c5ba6 build: remove common.am
Fold things into where they make sense.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-08 21:26:54 +02:00
Donald Sharp
98ea5be8b3 lib: Add missing smux.h to make distrib results
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-05 20:58:50 -04:00
Quentin Young
04f04f0fa5
Merge pull request #2913 from opensourcerouting/non-recursive-prep
pre-final non-recursive make
2018-08-31 11:43:59 -04:00
Donald Sharp
8e1f651213 lib: Add Aggregate Table and Aggregate_node
Add a abstraction for `struct route_node` and `struct route_table`
such that we can have an aggregate route_node and table.  This
is because only bgp/rfapi and ripng use the aggregate data pointer
in `struct route_node`.  For full route tables other routing
protocols and tables are paying a 8 byte overhead per node.
A full bgp table ends up being ~1.2 million routes in bgp
and zebra.  This is not an insiginificant amount of data.

So create the data structures for this replacement, but
do not replace the aggregate pointer yet.  This is because
later commits will convert rfapi and ripng over to this
new data, and finally we'll move the aggregate pointer.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-30 17:47:59 -04:00
David Lamparter
9e53b31551 build: non-recursive doc + parallel sphinx
Sphinx actually does work with a parallel build, if the doctree creation
is a separate step (which the other builds will then just read
unmodified.)  This can be done with the "dummy" target.

This also adds "-j6" to sphinx-build and adds a "--disable-doc-html"
switch on ./configure to turn on/off building HTML docs separately.

Also, HTML docs are now installed by "make install" to
/usr/share/doc/frr/html.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-08-30 08:06:44 +02:00
Donald Sharp
807ed4e9c0 lib: Remove smux option for snmp
The smux.c code has not been able to compile for 2+ years
and no-one has noticed. Additionally net-snmp has marked
smux integration as deprecated for quite some time as well.

Since no-one has noticed and it's been broken and smux integration
is deprecated let's just remove this from the code base.

From looking at the code, it sure looks like SNMP could use
a decent cleanup.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-23 08:36:07 -04:00
Donald Sharp
b66d022e8d lib, bgpd: Add code to make lib auto create the ferr infrastructure
Add code to auto-create the ferr infrastructure as well as add
some initial error handling for vrf.c

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-14 20:02:05 +00:00
Quentin Young
7cc0626c42 lib: ignore user CFLAGS when building Clippy
Unfortunately user CFLAGS causes #define conflicts with #defines in
Python development headers, which causes build failures under certain
platforms when using -Werror.

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

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-06 16:15:34 +00:00
Renato Westphal
7aad159464 build: append -std=gnu99 after SNMP_CFLAGS
Programs that link to libnetsnmp must be compiled using a special set
of flags as specified by the "net-snmp-config --base-cflags" command
(whose output is stored in the SNMP_CFLAGS variable). The problem is
that "net-snmp-config --base-cflags" can output -std=c99 in addition to
other compiler flags in some platforms, and this breaks the build since
FRR souce code makes use of some GNU compiler extensions (e.g. allow
trailing commas in function parameter lists). In order to solve this
problem, append -std=gnu99 after SNMP_CFLAGS in all makefiles where this
variable is used. This way the -std=c99 flag will be overwritten when it's
present. Source files that don't link to libnetsnmp will be compiled using
either -std=gnu99 or -std=gnu11 depending on the compiler availability.

Fixes #1617.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-06-02 22:12:57 -03:00
Russ White
252ecb5c11
Merge pull request #2090 from qlyoung/graph-dfs
lib: add DFS + DOT dumping to graph datastructure
2018-04-24 07:53:09 -04:00
Quentin Young
58f8a9ecde lib: add DFS + DOT dumping to graph datastructure
* Add general-purpose DFS traversal code
* Add ability to dump any graph to DOT language
* Add tests for graph datastructure

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-19 13:04:58 -04:00
Donald Sharp
036fdaad9f lib, zebra: Move label conversion strings to lib
The mpls_label2str and mpls_str2label functions should not
be zebra exclusive functions.  Move them to lib/mpls.c

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-18 07:06:11 -04:00
Philippe Guibert
0031a6bb2c lib: enhance pbr_rule structure for zapi encode and for common usage
The pbr_rule structure is derived from zebra_pbr_rule, and is
defined, so that a zclient will be able to encode the zebra_pbr_rule to
send ADD_RULE or DEL_RULE command. Also, the same structure can be used
by other daemons to derive a structure ( this will be the case for
zebra_pbr_rule).
Adding to this, an encoding function is defined, and will be used by
remote daemon to encode that message.
Those definitions are moved in new file pbr.h file.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-04-16 14:40:43 +02:00
Donald Sharp
dba32923eb lib, vtysh: Start cli for nexthop-group
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-09 11:07:41 -05:00
Donald Sharp
7ee30f288e lib: Isolate nexthop_group functions to nexthop_group.c
Also modify `struct route_entry` to use nexthop_groups.
Move ALL_NEXTHOPS loop to nexthop_group.h

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-09 11:07:41 -05:00
Quentin Young
aea03ad6e8
lib: add mt-safe debugging facilities
The current strategy for fine-grained debugging across FRR is to use
static long int bitfields, in combination with helper macros that are
copy-pasted between daemons, to hold state on what debugging information
should be collected at any given time. This has a couple of problems:

* These bitfields are generally extern'd and accessed everywhere, so
  they are not MT-safe or easy to make MT-safe
* Lots of code duplication from copy-pasting the DEBUG_* macros...
* Code duplication because of the "term" vs "conf" debugging concept

This patch aims to remedy that by providing some infrastructure to work
with debugs. The core concept of using bitfields has been retained, but
the number of these for each debug has been reduced to 1. This allows
easy use of lock-free methods for synchronizing access to debugging
info.

The helper macros have also been retained but they are now collected in
one place and perform exclusively atomic operations.

Finally there is a bit of code that allows daemons to register
callbacks, which I used to implement a command that will toggle all
debugging for any daemons that use these facilities.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-01 15:01:25 -05:00
Philippe Guibert
e26aedbe0b lib: split logicalrouter and vrf netns feature
This split is introducing logicalrouter.[ch] as the file that contains
the vty commands to configure logical router feature. The split has as
consequence that the backend of logical router is linux_netns.c formerly
called ns.c. The same relationship exists between VRF and its backend
which may be linux_netns.c file.
The split is adapting ns and vrf fiels so as to :
- clarify header
- ensure that the daemon persepctive, the feature VRF or logical router
  is called instead of calling directly ns.
- this implies that VRF will call NS apis, as logical router does.

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

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

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-02-27 11:11:24 +01:00
Quentin Young
5318d89638
lib: add ring buffer
Simple ring buffer implementation useful for fixed size FIFO queues.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-12-19 17:12:43 -05:00
Donald Sharp
dfd8f05f97 Merge pull request #1020 from opensourcerouting/ferr
"ferr" error reporting extensions
2017-09-05 07:52:18 -04:00
David Lamparter
b6116506ec lib: ZeroMQ read handler, v2
This uses zmq_getsockopt(ZMQ_FD) to create a libfrr read event, which
then wraps zmq_poll and calls an user-specified ZeroMQ read handler.
It's wrapped in a separate library in order to make ZeroMQ support an
installation-time option instead of build-time.

Extended to support per-message and per-fragment callbacks as discussed
with Bingen in PR #566.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-28 18:00:13 +02:00
David Lamparter
3155489aa2 lib: "ferr" error-information system
This provides an API to pass around extra information for errors, more
than a simple return value can carry.  This is particularly used for the
Cap'n Proto interface to be able to report more useful errors.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-28 06:04:54 +02:00
David Lamparter
de1a880c4e lib: split off compiler magic into its own file
Also make timed notices available via CONFDATE.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-24 00:18:53 +02:00
Jorge Boncompte
cd85bc2e0b lib: standardize use of queue.h
The simple queue implementation in OpenBSD and FreeBSD are called diferently,
standardize in the use of the FreeBSD version and map the missing names only
if we compile on OpenBSD.

Signed-off-by: Jorge Boncompte <jbonor@gmail.com>
2017-08-17 17:47:05 +02:00
Donald Sharp
fc73dd4bdf Merge pull request #911 from opensourcerouting/non-recursive-2
more non-recursive build, fix cross-compile, & doc build mangling
2017-08-09 14:38:07 -04:00
ßingen
6833ae01bc zebra: add pseudowire manager
Base framework for supporting MPLS pseudowires in FRR.

A consistent zserv interface is provided so that any client daemon
(e.g. ldpd, bgpd) can install/uninstall pseudowires in a standard
way. Static pseudowires can also be implemented by using the same
interface.

When zebra receives a request to install a pseudowire and the installation
in the kernel or hardware fails, a notification is sent back to the
client daemon and a new install attempt is made every 60 seconds (until
it succeeds).

Support for external dataplanes is provided by the use of hooks to
install/uninstall pseudowires.

Signed-off-by: ßingen <bingen@voltanet.io>
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-09 12:35:15 +02:00
David Lamparter
70d27c5b7d build: clean up BUILT_SOURCES
BUILT_SOURCES doesn't do what the name suggests.  What it actually means
is "these files should be built first when doing a 'make' without
explicit target" (or "make all").

It's pretty much almost always wrong to use BUILT_SOURCES, the only
correct use is when a file is needed by an unspecified / large set of
files.

Also remove version.h and route_types.h from dist tarball while we're at
it.  configure will create them anyway.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-04 11:13:55 +02:00
David Lamparter
89727c8d9e build: fix clippy cross-compile
Broke the build-for-host setup for clippy in the non-recursive changes
:/

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-04 11:09:45 +02:00
Christian Franke
31bfa0624d lib: add sbuf
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2017-08-03 11:34:01 +02:00
Renato Westphal
bd402424a4 lib: fix build from git repository on OpenBSD
The OpenBSD's cp(1) command doesn't support the -v option. This will
change in the next releases (starting from v6.2) but this patch fixes
the problem for v6.1 and older releases.

Fixes Issue #875.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-01 22:12:24 -03:00
David Lamparter
f1b32b2e5e build: fix/improve clippy dependencies
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-01 07:09:45 +02:00
David Lamparter
4a121f99f7 build: convert lib/ to non-recursive build
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-31 23:03:27 +02:00