summaryrefslogtreecommitdiffstats
path: root/lib (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #3772 from pguibert6WIND/vrf_backend_unknownDonald Sharp2019-03-253-2/+13
|\ | | | | Vrf backend unknown
| * lib: handling vrf backend unknown casePhilippe Guibert2019-02-111-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | on interface search algorithm, at initialisation, when reading config file, the vrf backend may not be yet known ( because zebra did not sync yet with daemon). For that, avoid searching interface name in a separate vrf. This change of behaviour is induced because the assumption is done that at config startup, the user is not wrong with the interface configuration to use. Every usage of vrf_get_backend() should then be wisely adapted in order to handle that init state. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
| * lib: interface handling where zebra not yet readyPhilippe Guibert2019-02-113-2/+8
| | | | | | | | | | | | | | | | | | | | other daemons need to sync with zebra to get to know which vrf backend is available. in that time, there may be interface configuration available. in that specific case, the vrf backend returned is not known. A specific return value is sent back. This will be useful to know which specific algorithm to apply. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
* | Merge pull request #3776 from opensourcerouting/pbrd-interface-nexthopsDonald Sharp2019-03-222-44/+58
|\ \ | | | | | | pbrd: add support for interface nexthops
| * | lib, pbrd: fix indentation of a few commandsRenato Westphal2019-02-151-1/+1
| | | | | | | | | | | | | | | | | | | | | When displaying the running configuration, we should use a single space to indent commands when necessary (and not two spaces). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * | lib: add support for interface nexthops on nexthop groupsRenato Westphal2019-02-151-33/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support to nexthops of type NEXTHOP_TYPE_IFINDEX to nexthop-groups. This should be especially useful when dealing with p2p interfaces like tunnels that don't have IP addresses assigned to them. NOTE: nh->addr can be NULL now, so we should always perform a null check before dereferencing this pointer. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * | lib: change how nexthop groups store nexthop addressesRenato Westphal2019-02-142-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | Use a pointer to a sockunion instead of a full sockunion in the nexthop_hold structure. This prepares the ground for the next commit, which will make nexthop addresses optional (in this commit we assume nh->addr will never be NULL, but this will change). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * | lib: consolidate nexthop-group deletion in a single placeRenato Westphal2019-02-141-7/+1
| | | | | | | | | | | | | | | | | | Reuse the nhgl_delete() function to avoid code duplication. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* | | Merge pull request #3972 from mjstapp/fix_privs_raceDonald Sharp2019-03-221-20/+21
|\ \ \ | | | | | | | | libs: fix race in privs changes
| * | | libs: fix race in privs changesMark Stapp2019-03-171-20/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the privs struct mutex more strictly, to ensure that the privs are at the level the caller expects when the apis return. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* | | | Merge pull request #3949 from qlyoung/remove-zlog-newlinesSri Mohana Singamsetty2019-03-152-5/+5
|\ \ \ \ | |/ / / |/| | | *: remove trailing newlines from zlog messages
| * | | *: remove trailing newlines from zlog messagesQuentin Young2019-03-142-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | Zlog puts its own newlines on, and doing this makes logs look nasty. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | | | Merge pull request #3902 from opensourcerouting/fix-removal-np-containersDonald Sharp2019-03-151-45/+49
|\ \ \ \ | |/ / / |/| | | lib: fix removal of yang non-presence containers
| * | | lib: fix removal of yang non-presence containersRenato Westphal2019-03-031-2/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Non-presence containers don't have "destroy" callbacks. So, once a np-container is deleted, we need to call the "destroy" callbacks of its child nodes instead. This commit doesn't fix any real problem as of now since all np-containers from the FRR YANG modules contain or one more mandatory child nodes, so they can't be deleted (libyang will add missing np-containers when validating data). Nevertheless, upcoming YANG modules should benefit from this change. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * | | lib: simplify code that calculates configuration diffsRenato Westphal2019-03-021-45/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is just a small refactoring to reduce code duplication. No behavior changes intended. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* | | | Merge pull request #3911 from mjstapp/fix_privs_deadlockDavid Lamparter2019-03-062-0/+29
|\ \ \ \ | | | | | | | | | | libs: make privilege elevation thread-safe
| * | | | libs: make privilege escalation thread-safeMark Stapp2019-03-052-0/+29
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Privs escalation is process-wide, and a multi-threaded process can deadlock. This adds a mutex and a counter to the privs object, preventing multiple threads from making the privs escalation system call. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* | | | Merge pull request #3869 from qlyoung/cocci-fixesDavid Lamparter2019-03-0627-155/+82
|\ \ \ \ | |/ / / |/| | | Assorted Coccinelle fixes
| * | | *: remove casts of XMALLOC / XCALLOCQuentin Young2019-02-262-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | No cast necessary for void * Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
| * | | *: remove null check before XFREEQuentin Young2019-02-2617-127/+67
| | | | | | | | | | | | | | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
| * | | lib: STAILQ_FOREACH_SAFE never gives a null elemQuentin Young2019-02-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | So don't check it Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
| * | | *: do not check XMALLOC / XCALLOC for null retQuentin Young2019-02-264-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | They never return NULL Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
| * | | *: use array_size instead of raw divisionQuentin Young2019-02-261-1/+2
| | | | | | | | | | | | | | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
| * | | *: remove unnecessary semicolon from switchesQuentin Young2019-02-261-2/+2
| | | | | | | | | | | | | | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
| * | | *: return bool from boolean functionsQuentin Young2019-02-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Not 1 or 0. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
| * | | *: use proper bool initializers & fix comparisonsQuentin Young2019-02-264-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - bools should be initialized with true/false - bools do not need to be compared Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | | | Merge pull request #3877 from qlyoung/remove-strncpyRenato Westphal2019-03-013-5/+5
|\ \ \ \ | | | | | | | | | | Remove strncpy
| * | | | lib: strncpy -> strlcpy | memcpyQuentin Young2019-02-263-5/+5
| |/ / / | | | | | | | | | | | | | | | | | | | | strncpy is a byte copy function not a string copy function Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | | | Merge pull request #3882 from vivek-cumulus/refine_evpn_route_addSri Mohana Singamsetty2019-03-011-1/+0
|\ \ \ \ | | | | | | | | | | Refine install of EVPN-based routes to remove some special handling
| * | | | *: Explicitly mark nexthop of EVPN-sourced routes as onlinkvivek2019-02-271-1/+0
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the case of EVPN symmetric routing, the tenant VRF is associated with a VNI that is used for routing and commonly referred to as the L3 VNI or VRF VNI. Corresponding to this VNI is a VLAN and its associated L3 (IP) interface (SVI). Overlay next hops (i.e., next hops for routes in the tenant VRF) are reachable over this interface. Howver, in the model that is supported in the implementation and commonly deployed, there is no explicit Overlay IP address associated with the next hop in the tenant VRF; the underlay IP is used if (since) the forwarding plane requires a next hop IP. Therefore, the next hop has to be explicit flagged as onlink to cause any next hop reachability checks in the forwarding plane to be skipped. https://tools.ietf.org/html/draft-ietf-bess-evpn-prefix-advertisement section 4.4 provides additional description of the above constructs. Use existing mechanism to specify the nexthops as onlink when installing these routes from bgpd to zebra and get rid of a special flag that was introduced for EVPN-sourced routes. Also, use the onlink flag during next hop validation in zebra and eliminate other special checks. Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reviewed-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | | | Merge pull request #3606 from pguibert6WIND/if_rmap_containerDonald Sharp2019-03-012-35/+93
|\ \ \ \ | |/ / / |/| | | lib, rip, ripng, eigrp: rework if_rmap context
| * | | eigrp, rip, ripng, lib: unlink if_rmap from vrfPhilippe Guibert2019-02-192-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | an interface rmap context can be created from a custom name string, instead of a vrf. This ability permits to handle several instances of interface route map in the same vrf. The naming convention will be transparent on what the name is for in the daemon code. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
| * | | lib, rip, ripng, eigrp: rework if_rmap contextPhilippe Guibert2019-02-192-35/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | so as to handle ri/ripng/eigrp multiple instances, the need is to encapsulate if_rmap hash table into a container context self to each instance. This work then reviews the if_rmap api, mainly by adding a if_rmap_ctx context, that is passed for each exchange between library and the daemon. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
* | | | lib: add compatibility #define for hash_backetQuentin Young2019-02-251-0/+5
| | | | | | | | | | | | | | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | | | *: Rename backet to bucketTim Bray2019-02-256-63/+63
| | | | | | | | | | | | | | | | | | | | | | | | Presume typo from original author Signed-off-by: Tim Bray <tim@kooky.org>
* | | | Merge pull request #3836 from opensourcerouting/debian/master-kill-backportsDonald Sharp2019-02-243-7/+31
|\ \ \ \ | | | | | | | | | | [master] debian packaging
| * | | | lib: yang: use common yang_ctx_new_setup()David Lamparter2019-02-193-7/+31
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After creating a libyang context, we need to hook up our callback to use embedded built-in modules. I hadn't added this to the yang translator code. Also, ly_ctx_new fails if the search directory doesn't exist. Since that's not a hard error for us, work around that and ignore inaccessible YANG_MODELS_DIR. (This is needed for snap packages.) Signed-off-by: David Lamparter <equinox@diac24.net>
* / / / lib: Allow DEFPY_HIDDEN to exist in vtyshDonald Sharp2019-02-211-0/+3
|/ / / | | | | | | | | | | | | | | | | | | The DEFPY_HIDDEN commands were not being picked up into vtysh. Fix this issue. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | | lib: fix garbage array size in zprivs_initQuentin Young2019-02-151-1/+1
| | | | | | | | | | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | | lib: fix uninitialized value use in privs.cQuentin Young2019-02-141-1/+1
|/ / | | | | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | lib: a few more trivial changes for C++ compatibilityRenato Westphal2019-02-123-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | * command_graph.h: stop using "new" as a parameter name as that's a reserved C++ keyword. * module.h: avoid using C99 designated initializers since C++ doesn't support them. This change hurts code readability quite considerably, so we should try to find a better solution later. * pw.h: remove unneeded empty structure to silence a C++ warning. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* | lib: add macro that performs explicit static casts when using a C++ compilerRenato Westphal2019-02-122-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | C++ doesn't support implicit casts from void pointers like C does. And the libfrr headers have some bits of code that rely on implicit casts in order to work. To solve this problem, add a new "static_cast" macro that performs explicit static casts when a C++ compiler is being used, or do nothing otherwise. NOTE: since macros are only evaluated when they are used, there might be other macros from libfrr that will need to use "static_cast" as well. If a header is successfully compiled using a C++ compiler, there's no guarantee that its macros are compatible with C++. We'll only know about such macros when they are used by C++ code, then we'll need to adapt them one by one in the future. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* | lib: rename enum to avoid conflictRenato Westphal2019-02-122-2/+2
| | | | | | | | | | | | | | | | | | Two different definitions of "enum filter_type" exist in libfrr: one in lib/filter.h and other in lib/command_match.h. Rename one of them to resolve a conflict that happens when both headers are included by the same file. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* | lib: add extern "C" {} blocks to all libfrr headersRenato Westphal2019-02-1293-0/+758
| | | | | | | | | | | | | | These are necessary to use functions defined in these headers from C++. Signed-off-by: David Lamparter <equinox@diac24.net> Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* | lib: remove unnamed struct in qobj for C++David Lamparter2019-02-111-0/+6
| | | | | | | | Signed-off-by: David Lamparter <equinox@diac24.net>
* | lib: remove extra top-level ;David Lamparter2019-02-111-2/+2
| | | | | | | | Signed-off-by: David Lamparter <equinox@diac24.net>
* | lib: make atomic ops C++ compatibleDavid Lamparter2019-02-118-17/+47
| | | | | | | | | | | | | | C++ doesn't have ISO C11 stdatomic.h or "_Atomic inttype", so use std::atomic instead to get the headers compatible. Signed-off-by: David Lamparter <equinox@diac24.net>
* | lib: make union prefixptr C++-compatibleDavid Lamparter2019-02-111-10/+19
| | | | | | | | | | | | | | Add a no-op conversion constructor to tell C++ that union prefixptr accepts any of its member types. Signed-off-by: David Lamparter <equinox@diac24.net>
* | lib: revert table.h change for C++David Lamparter2019-02-111-5/+2
| | | | | | | | | | | | | | This reverts the lib/table.h change from commit 049b31f7d810fd70069e3edbbd3fea6b5c7af98f. Signed-off-by: David Lamparter <equinox@diac24.net>
* | libs, rip, isis: change northbound operation enum to DESTROYMark Stapp2019-02-115-14/+14
| | | | | | | | | | | | | | | | Change the northbound lib operation from DELETE to DESTROY; make the required changes in the users of the northbound, in the cli, rip, ripng, and isis. Signed-off-by: Mark Stapp <mjs@voltanet.io>