Commit Graph

94 Commits

Author SHA1 Message Date
Sarita Patra
da787004cc yang: Defining yang files for pim
Signed-off-by: Sarita Patra <saritap@vmware.com>
2020-04-22 09:21:28 -07:00
Donald Sharp
a83014ccd6
Merge pull request #6247 from FRRouting/nb_conversions
Merge nb_converions branch to master
2020-04-16 19:39:14 -04:00
Chirag Shah
b0f502c521 yang: add ietf interface yang model
Add ietf interface yant model.
Also include it in the makefile.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-04-16 08:26:36 -07:00
Sarita Patra
7fd139b523 yang: igmp yang definition
Defined frr-igmp.yang file for IGMP protocol.

Co-authored-by: Sarita Patra <saritap@vmware.com>
Co-authored-by: Santosh P K <sapk@vmware.com>

Signed-off-by: Sarita Patra <saritap@vmware.com>
2020-04-16 08:26:29 -07:00
Chirag Shah
e7ecd0a657 *: frr nexthop yang in makefile
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-04-16 08:09:11 -07:00
vdhingra
8b04316627 lib: yang defination for basic frr-routing
Yang files for basic frr-routing used by other
daemons like staticd and pim

Co-authored-by: Santosh P K <sapk@vmware.com>
Co-authored-by: vishaldhingra <vdhingra@vmware.com>
Signed-off-by: vishaldhingra <vdhingra@vmware.com>
2020-04-16 07:55:53 -07:00
Chirag Shah
3a7262b6a9 *: add frr-vrf yang module in makefile
lib: Adding frr-vrf yang module to common place
so it can be accessed from all frr modules.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-04-16 07:49:06 -07:00
David Lamparter
1c4086281f lib/log: re-add log filtering
This is most of the old code bolted on top of the new "backend"
infrastructure.  It just wraps around zlog_fd() with the string search.

Originally-by: Stephen Worley <sworley@cumulusnetworks.com>
Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-01 06:53:26 +02:00
David Lamparter
0bdeb5e58d lib: rewrite zlog lock-free & TLS-buffered
This is a full rewrite of the "back end" logging code.  It now uses a
lock-free list to iterate over logging targets, and the targets
themselves are as lock-free as possible.  (syslog() may have a hidden
internal mutex in the C library;  the file/fd targets use a single
write() call which should ensure atomicity kernel-side.)

Note that some functionality is lost in this patch:
- Solaris printstack() backtraces are ditched (unlikely to come back)
- the `log-filter` machinery is gone (re-added in followup commit)
- `terminal monitor` is temporarily stubbed out.  The old code had a
  race condition with VTYs going away.  It'll likely come back rewritten
  and with vtysh support.
- The `zebra_ext_log` hook is gone.  Instead, it's now much easier to
  add a "proper" logging target.

v2: TLS buffer to get some actual performance

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-01 06:53:26 +02:00
Rafael Zalamena
a513824c34 yang/lib: add filter model to code
This fixes a warning on daemons that use route map about filter yang
model not being included in the binary.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-02-04 14:05:43 -03:00
Rafael Zalamena
2b3e4807ec lib: implement new route map CLI
Use the northbound back-end instead of the old route map CLI.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-02-04 14:05:43 -03:00
Rafael Zalamena
686d244f00 lib: implement route map northbound
Based on the route map old CLI, implement the route map handling using
the exported functions.

Use a curry-like programming pattern avoid code repetition when
destroying match/set entries. This is needed by other daemons that
implement custom route map functions and need to pass to lib their
specific destroy functions.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-02-04 14:05:43 -03:00
Hiroki Shirokura
e496b42030 bgpd: prefix-sid srv6 l3vpn service tlv
bgpd already supports BGP Prefix-SID path attribute and
there are some sub-types of Prefix-SID path attribute.
This commits makes bgpd to support additional sub-types.
sub-Type-4 and sub-Type-5 for construct the VPNv4 SRv6 backend
with vpnv4-unicast address family.
This path attributes is already supported by Ciscos IOS-XR and NX-OS.

Prefix-SID sub-Type-4 and sub-Type-5 is defined on following
IETF-drafts.

Supports(A-part-of):
- https://tools.ietf.org/html/draft-dawra-idr-srv6-vpn-04
- https://tools.ietf.org/html/draft-dawra-idr-srv6-vpn-05

Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2020-01-15 18:20:35 +09:00
David Lamparter
96673e067d lib: add frr_version_cmp()
This just compares 2 version strings.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-12-06 15:13:32 +01:00
David Lamparter
1c0d880814 lib: rename memory_vty.c to lib_vty.c
And memory_init() to lib_cmd_init().

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-12-06 15:13:29 +01:00
Chirag Shah
e6a0538b40 *: add ietf routing types yang module in makefile
Adding ietf routing types yang module to makefile

lib: Adding this yang module to common place
so it can be accessed from all frr modules.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-10-09 15:46:37 -07:00
David Lamparter
5c52c06c5c lib: add pull-driven data write handler
This - mostly intended for BMP - implements a pull-driven write buffer
filled on demand by a callback with some reasonable buffering logic.

I don't expect it to be that useful in other places, but it's not BMP
specific so it's properly split off in its own place.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-08-30 19:00:45 +02:00
Donald Sharp
76eb017923
Merge pull request #4497 from opensourcerouting/rcu
RCU support
2019-08-08 08:41:07 -04:00
Donald Sharp
3a738964ec
Merge pull request #4763 from opensourcerouting/ds-work
lib: get rid of pqueue_*, use DECLARE_HEAP in thread.c
2019-08-07 16:45:02 -04:00
Igor Ryzhov
c7975431e6 all: remove logical-router functionality
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2019-08-02 17:10:11 +03:00
David Lamparter
77faa5bd79 lib: remove pqueue_* (again)
All users of the pqueue_* implementations have been migrated to use
some new data structure (TYPEDSKIP for ospf, HEAP for thread.c).

Remove.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-08-01 17:02:53 +02:00
David Lamparter
3e41733f1b lib: RCU
Please refer to doc/developer/rcu.rst for documentation.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-07-31 03:34:09 +02:00
David Lamparter
fe9e7b71cf lib: split off c-ares code from nhrpd
This is useful in other places too, e.g. for BMP outbound connections.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-07-03 17:15:34 +02:00
David Lamparter
a5ddc34dc7
lib: Add a couple functions to nexthop_group.c (#4323)
lib: Add a couple functions to nexthop_group.c

Co-authored-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-07-03 14:42:35 +02:00
Stephen Worley
50d8965075 lib: Private api for nexthop_group manipulation
Add a file that exposes functions which modify nexthop groups.
Nexthop groups are techincally immutable but there are a
few special cases where we need direct access to add/remove
nexthops after the group has been made. This file provides a
way to expose those functions in a way that makes it clear
this is a private/hidden api.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-06-25 22:58:48 -04:00
Stephen Worley
f73126c31a lib,vtysh: Add vtysh commands for log-filter
Add vtysh commands to add/del/clear/show filters across
all daemons and independently on each one. Add automake and
clippy boilerplate for those commands as well.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-06-19 17:20:24 -04:00
David Lamparter
0688fd81d0
bgpd, lib: Add iana_afi2str and iana_safi2str for eye pleasing strings (#4439)
bgpd, lib: Add iana_afi2str and iana_safi2str for eye pleasing strings
2019-06-13 22:06:49 +02:00
David Lamparter
a71c5039ad build: improve clippy options
* adds a `--with-clippy=...` option to use a prebuilt clippy binary
* limits the autoconf tests done for `--enable-clippy-only`
  (e.g. no libyang)

Fixes: #3921
Fixes: #4006
Signed-off-by: David Lamparter <equinox@diac24.net>
2019-06-12 19:22:59 +02:00
David Lamparter
2655e41fa2 build: slim down configure.ac
Quite a few tests are deprecated/unnecessary at this point.  Remove
everything that is pointless.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-06-12 19:22:55 +02:00
David Lamparter
e128c00226 lib: add optimized inet_ntop()
This commit is brought to you by: "Manuel - Gas Gas Gas" (Initial D)

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-06-06 20:59:50 +02:00
David Lamparter
5c25bd87b5 lib/printf: integrate
Signed-off-by: David Lamparter <equinox@diac24.net>
2019-06-03 16:44:51 +02:00
Donald Sharp
17136bf23e lib, bgpd: Create iana_afi.h for storing iana_afi/safi enums
The iana_afi_t and iana_safi_t were being created in zebra.h
and zebra.h is a bit of a dumping ground.  When the iana_afi2str and
iana_safi2str functions were created, it was correctly pointed out
that we should just use the internal afi_t and safi_t 2str functions
but to do that we would need to include prefix.h in zebra.h.  Which
really is not the right thing to do.  This tells us that we need
to break out this code into it's own header.

Move to iana_afi.h the enums and specific functions and remove
from zebra.  Convert to using the afi2str and safi2str functions.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-02 15:02:07 -04:00
Donald Sharp
2950f5da55 lib: Add '--command-log-always` to all daemons startup
Add 'no log commands' cli and at the same time add a
--command-log-always to the daemon startup cli.

If --command-log-always is specified then all commands are
auto-logged and the 'no log commands' form of the command
is now ignored.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-05-31 10:06:42 -04:00
Quentin Young
5dbb0a7b2a build: fix Lua build
Each of Lua's major versions are incompatible with each other. Ubuntu,
at least, does not provide a single liblua.so or /usr/include/lua; all
SOs and headers are versioned, e.g. liblua5.3.so and
/usr/include/lua5.3. There's already an m4 macro in the GNU collection
to handle this situation, so let's use that.

This allows building with Lua enabled to work on platforms other than
Fedora.

* Move lib/lua.[ch] -> lib/frrlua.[ch] to prevent path conflicts
* Fix configure.ac search for proper CPP and linker flags
* Add Lua include path to AM_CPPFLAGS
* Update vtysh/extract.pl.in

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-10 16:08:32 +00:00
Quentin Young
6915af74fd
Merge pull request #4082 from opensourcerouting/grpc-nb-plugin
gRPC northbound plugin
2019-05-07 16:53:17 -04:00
David Lamparter
7629b6b79c Revert "lib: remove pqueue_*"
This reverts commit 798ac49d06.
2019-04-29 21:18:48 +02:00
David Lamparter
a297301e89 lib: remove fifo implementation 2019-04-27 19:33:45 +02:00
David Lamparter
798ac49d06 lib: remove pqueue_*
All users of the pqueue_* implementations have been migrated to use
TYPEDSKIP_* skiplists.  Remove.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-04-27 19:33:45 +02:00
David Lamparter
bcea0c0fde lib: atomlist & atomsort
These two are lock-free linked list implementations, the plain one is
primarily intended for queues while the sorted one is for general data
storage.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-04-27 19:33:39 +02:00
David Lamparter
80911bc26a lib: typesafe rb-tree
Typesafe red-black tree, built out of the OpenBSD implementation and the
macro soup layered on top.  API compatible with skiplists & simple
lists.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-04-27 18:22:38 +02:00
David Lamparter
abd71baa2e lib: typesafe lists, skiplist & hash
By the power of the C preprocessor, these macros provide type-safe
warppers for simple lists, skiplists and hash tables.  Also, by changing
the instantiation macro, it is easily possible to switch between
algorithms;  the code itself does not need to be changed since the API
is identical across all algorithms.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-04-27 18:20:35 +02:00
Renato Westphal
ec2ac5f28a lib: add new gRPC-based northbound plugin
This is an experimental plugin for now. Full documentation will
come later.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-04-26 18:15:32 -03:00
David Lamparter
440d5faa3a lib: add "seqlock" wait/broadcast primitive
Manually tested rather extensively in addition to included unit tests,
should work as intended.

NB: The OpenBSD futex() code is "future"; it's not actually in OpenBSD
(yet?) and thus untested.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-04-18 12:44:29 +02:00
Quentin Young
fe7f26ce76 lib: remove event_counter.[ch]
goodbye spooky code

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

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-01-30 19:13:51 +01:00
Donald Sharp
6edbb8b2e3 lib: Add mlag_role2str function
Add a generic mlag_role2str function for lib since multiple daemons
will be using this code.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-04 12:21:00 -05:00
Donald Sharp
14beb5484f lib: Add a basic mlag.h file
This is the start of a series of commits that will allow FRR to
be integrated into mlag.

Zebra and Pim will both need mlag state for the router.  As such we will
need to provide a abstract about this state through the zapi.

This is the start of the common header that both Pim and Zebra will
be using.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-04 12:21:00 -05:00
David Lamparter
3a11599cdc yang: embed models into binaries
This bakes our YANG models straight into the library/daemons, so they
don't need to be loaded from /usr/share/yang.  This makes the
installation quite a bit more robust, as well as gets us halfway to
running uninstalled.  (The other half is baking in the extension type
module.)

The /usr/share/yang directory is still searched as a fallback, as well
as for the experimental YANG model translator.  This is likely to stay
as is for the time being.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-11-19 23:45:24 +01:00
Mitch Skiba
a94eca0968 lib: Implement an allocator for 32 bit ID numbers
This commit introduces lib/id_alloc, which has facilities for both an ID number
allocator, and less efficient ID holding pools. The pools are meant to be a
temporary holding area for ID numbers meant to be re-used, and are implemented
as a linked-list stack.

The allocator itself is much more efficient with memory. Based on sizeof
values on my 64 bit desktop, the allocator requires around 155 KiB per
million IDs tracked.

IDs are ultimately tracked in a bit-map split into many "pages." The
allocator tracks a list of pages that have free bits, and which sections
of each page have free IDs, so there isn't any scanning required to find
a free ID. (The library utility ffs, or "Find First Set," is generally a
single CPU instruction.) At the moment, totally empty pages will not be
freed, so the memory utilization of this allocator will remain at the
high water mark.

The initial intended use case is for BGP's TX Addpath IDs to be pulled
from an allocator that tracks which IDs are in use, rather than a free
running counter.  The allocator reserves ID #0 as a sentinel value for
an invalid ID numbers, and BGP will want ID #1 reserved as well. To
support this, the allocator allows for IDs to be explicitly reserved,
though be aware this is only practical to use with low numbered IDs
because the allocator must allocate pages in order.

Signed-off-by Mitchell Skiba <mskiba@amazon.com>
2018-11-09 21:50:34 +00:00
Renato Westphal
8f90d89ba9 lib: retrofit interface commands to the new northbound model
The frr-interface YANG module models interfaces using a YANG list keyed
by the interface name and the interface VRF. Interfaces can't be keyed
only by their name since interface names might not be globally unique
when the netns VRF backend is in use. When using the VRF-Lite backend,
however, interface names *must* be globally unique. In this case, we need
to validate the uniqueness of interface names inside the appropriate
northbound callback since this constraint can't be expressed in the
YANG language. We must also ensure that only inactive interfaces can be
removed, among other things we need to validate in the northbound layer.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-10-27 16:16:12 -02:00