summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2019-09-18lib: add oper data cbs for ifacesQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-09-18lib: add an exception in the northbound for operational data callbacksRenato Westphal
During initialization, the northbound detects if any required callback is missing (fatal error) or if any unneeded callback is present (warning). There are three callbacks, however, that should require special handling: get_next(), get_keys() and lookup_entry(). These callbacks are normally unneeded for configuration lists. But, if a configuration list is augmented with new state nodes by another module, then the three callbacks mentioned above become required. In this case, never log a warning when these callbacks are implemented when they are not needed, since this depends on context (e.g. some daemons might augment "frr-interface" while others don't). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-09-18lib: fix ordering issues in the northboundRenato Westphal
When a configuration transaction is being performed, the northbound uses a red-black tree to store the configuration changes that need to be processed. The problem is that we were sorting the configuration changes based on their XPaths (and callback priorities). This means the original order of the changes wasn't being respected, which is a problem for lists that use the "ordered-by user" statement. To fix this, add a new "seq" member to the "nb_config_cb" structure so that we can preserve the order of the configuration changes as told by libyang. Since none of the FRR modules use "ordered-by user" lists so far, no daemon was affected by this problem. Reported-by: Martin Winter <mwinter@opensourcerouting.org> Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-09-18lib: fix corner case when iterating over YANG-modeled operational dataRenato Westphal
When updating the XPath during the iteration of operational data, include the namespace of the augmenting module when necessary. Reported-by: Quentin Young <qlyoung@cumulusnetworks.com> Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-09-18Revert "lib: introduce a read-write lock for northbound configurations"Renato Westphal
Adding a lock to protect the global running configuration doesn't help much since the FRR daemons are not prepared to process configuration changes in a pthread that is not the main one (a whole lot of new protections would be necessary to prevent race conditions). This means the lock added by commit 83981138 only adds more complexity for no benefit. Remove it now to simplify the code. All northbound clients, including the gRPC one, should either run in the main pthread or use synchronization primitives to process configuration transactions in the main pthread. This reverts commit 83981138fe8c1e0a40b8dede74eca65449dda5de.
2019-09-18lib: introduce new 'pre_validate' northbound callbackRenato Westphal
This callback can be used to validate subsections of the configuration being committed before validating the configuration changes themselves. It's useful to perform more complex validations that depend on the relationship between multiple nodes. Only YANG-level validation (performed by libyang) and the NB_EV_VALIDATE validation (that can be used to validate individual configuration changes) proved to be insufficient in some cases. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-09-18lib: add yang wrappers for IP prefixesRenato Westphal
We had wrappers for IPv4 and IPv6 prefixes, but not for IP (version agnostic) prefixes. This commit addresses this issue. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-09-17Merge pull request #4966 from Orange-OpenSource/isis-TERenato Westphal
isisd: Update TLVs processing for TE, RI & SR
2019-09-17lib: clean up frr_pthread structs at exitQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-09-17isisd: Update TLVs processing for TE, RI & SROlivier Dugeon
In preparation to Segment Routing: - Update the management of Traffic Engineering subTLVs to the new tlvs parser - Add Router Capability TLV 242 as per RFC 4971 & 7981 - Add Segment Routing subTLVs as per draft-isis-segment-routing-extension-25 Modified files: - isis_tlvs.h: add new structure to manage TE subTLVs, TLV 242 & SR subTLVs - isis_tlvs.c: add new functions (pack, copy, free, unpack & print) to process TE subTLVs, Router Capability TLV and SR subTLVs - isis_circuit.[c,h] & isis_lsp.[c,h]: update to new subTLVs & TLV processing - isis_te.[c,h]: remove all old TE structures and managment functions, and add hook call to set local and remote IP addresses as wellas update TE parameters - isis_zebra.[c,h]: add hook call when new interface is up - isis_mt.[c,h], isis_pdu.c & isis_northbound.c: adjust to new TE subTLVs - tests/isisd/test_fuzz_isis_tlv_tests.h.gz: adapte fuuz tests to new parser Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2019-09-17Merge pull request #4887 from vishaldhingra/lcomm_jsonRuss White
lib: rmap dep table is not correct in case of exact-match clause
2019-09-17Merge pull request #4810 from qlyoung/fix-pthread-bad-pointerRuss White
Fix potential frr_pthread.c stale pointer
2019-09-17Merge pull request #4564 from pguibert6WIND/misc_vrf_update_nameRuss White
Misc vrf update name
2019-09-16lib: handle frr_pthread_init/fini in libfrr initQuentin Young
Make sure we are always cleaning init'ing and cleaning up pthread infra. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-09-16lib: delete pthread from tracking list on deleteQuentin Young
Pthreads were not being deleted from the list after destruction. This isn't causing any bugs currently but that's just by dumb luck. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-09-15lib: rmap dep table is not correct in case of exact-match clausevdhingra
User pass the string match large-community 1 exact-match from CLI. Now route map lib has got the string as "1 exact-match". It passes the string to call back for compilation. BGP will parse this string and came to know that for "1" it has to do exact match. Routemap lib has to save "1" in it’s dependency table. Here routemap is saving this as a “1 exact-match” which is wrong. The solution is used the compiled data. Signed-off-by: vishaldhingra <vdhingra@vmware.com>
2019-09-13Merge pull request #4949 from opensourcerouting/mpls-zapi-improvementsOlivier Dugeon
MPLS zapi improvements
2019-09-12yang: add user type for ip-addressQuentin Young
Convert ietf-inet-types:ip-address to struct ipaddr. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-09-10lib, zebra: add new MPLS zapi message with route replace semanticsRenato Westphal
This new message makes it possible to install/reinstall LSPs with multiple nexthops using a single ZAPI message. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-09-06lib, zebra: enhance the MPLS zapi messagesRenato Westphal
* Add ability to specify the nexthop type; * Add ability to install or not a FTN (in addition to an LSP). These two additions will be useful to install local SR Prefix-SIDs configured with the no-PHP option. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-09-06lib, zebra: rename LSP type used for OSPF SRRenato Westphal
SR support for IS-IS is coming so we need to be able to distinguish OSPF and IS-IS LSPs. While here, add missing case statement for LDP on lsp_type_from_re_type(). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-09-06zebra: identify MPLS FTNs by route type and instanceRenato Westphal
Use the route type and instance instead of the route distance to identify MPLS FTNs. This is a more robust approach since the routing daemons can modify the distance of their announced routes via configuration, which can cause inconsistencies. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-09-06lib: introduce encode/decode functions for the MPLS zapi messagesRenato Westphal
Do this for the following reasons: * Improve modularity of the code by separating the decoding of the ZAPI messages from their processing; * Create an API that is easier to use by the client daemons. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-09-05lib: optimize non-transactional cliRenato Westphal
Commit eaf6705d7a fixed a problem caused by configuration changes coming from the kernel. The fix consisted of regenerating the candidate configuration before every configuration command (when using the non-transactional CLI mode). There's no need, however, to regenerate the candidate when it's identical to the running configuration. Since the northbound keeps track of the version of each configuration, we can use that information to prevent regenerating the candidate configuration when that is not necessary. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-09-04Merge pull request #4930 from donaldsharp/4851_fixupDavid Lamparter
isisd: Enabling build with openssl
2019-09-04Merge pull request #4789 from sworleys/Nexthop-Sort-OptimizationMark Stapp
lib: Nexthop Sorting Optimizations
2019-09-04Merge pull request #4877 from mjstapp/dplane_neighsDonald Sharp
zebra: move evpn neighbors to dataplane
2019-09-04isisd: Enabling build with opensslMichal Ruprich
Similar to PR #4677, I am enabling the openssl library for md5 authentication in IS-IS Signed-off-by: Michal Ruprich <michalruprich@gmail.com>
2019-09-04Merge pull request #4908 from qlyoung/vtysh-find-regexpDonatas Abraitis
vtysh, lib: allow regexp in `find` command
2019-09-04Merge pull request #4918 from brchiu/fix_values_cnt_errorDonald Sharp
lib: Fix erroneously setting pointer values_cnt as NULL
2019-09-04lib: Fix erroneously setting pointer values_cnt as NULLBi-Ruei, Chiu
It should be : *values_cnt = 0; not values_cnt = 0; Signed-off-by: Bi-Ruei, Chiu <biruei.chiu@gmail.com>
2019-09-03vtysh, lib: allow regexp in `find` commandQuentin Young
¯\_(ツ)_/¯ Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-09-03*: frr_elevate_privs -> frr_with_privsDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-09-03lib: add frr_with_mutex() block-wrapperDavid Lamparter
frr_with_mutex(...) { ... } locks and automatically unlocks the listed mutex(es) when the block is exited. This adds a bit of safety against forgetting the unlock in error paths & co. and makes the code a slight bit more readable. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-09-03lib: add some macro helpersDavid Lamparter
Macro soup, now with 50% more macros. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-09-03*: Convert some route map functions to return the enumDonald Sharp
Conver these functions: route_map_add_match route_map_delete_match route_map_add_set route_map_delete_set To return the `enum rmap_compile_rets` and ensure all functions that use this code handle all the enumerated possible returns. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-03lib: Cleanup return codes to use enum valuesDonald Sharp
A couple functions in routemap.c were returning 0/1 that were being mapped into the appropriate enum values on the calling functions to check return values. This matches the return values to the actual enum for future readability. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-08-30bgpd/bmp: BMP implementationDavid Lamparter
This implements BMP. There's no fine-grained history here, the non-BMP preparations are already split out from here so all that remains is BMP proper. Signed-off-by: David Lamparter <equinox@diac24.net>
2019-08-30lib: add monotime_to_realtime()David Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2019-08-30lib: add pull-driven data write handlerDavid Lamparter
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-28lib: Stop arm crash on shutdownDonald Sharp
Arm platforms are crashing in our topotests with this callstack; 50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory. [Current thread is 1 (Thread 0xffffabb591d0 (LWP 18947))] (gdb) bt file=file@entry=0xaaaadfed1e48 "lib/memory.c", line=line@entry=80, function=function@entry=0xaaaadfed1db8 <__func__.10514> "mt_count_free") at lib/log.c:837 (gdb) So we are crashing because we are attempting to free a mtype that has no allocations associated with it. I added this debug code: @@ -227,7 +230,9 @@ static void rcu_bump(void) struct rcu_next *rn; rn = XMALLOC(MTYPE_RCU_NEXT, sizeof(*rn)); - + zlog_debug("RCU_BUMP"); + mtype_dump(MTYPE_RCU_THREAD); + mtype_dump(MTYPE_RCU_NEXT); /* note: each RCUA_NEXT item corresponds to exactly one seqno bump. * This means we don't need to communicate which seqno is which * RCUA_NEXT, since we really don't care. and added a mtype_dump function: +void mtype_dump(struct memtype *mt) +{ + zlog_debug("%s: %d", mt->name, (int)mt->n_alloc); +} Which resulted in this output: 2019/08/28 15:41:11 BGP: RCU_BUMP 2019/08/28 15:41:11 BGP: RCU thread: 3 2019/08/28 15:41:11 BGP: RCU thread: 3 If we look at the defintion of the two static memory types: DEFINE_MTYPE_STATIC(LIB, RCU_THREAD, "RCU thread") DEFINE_MTYPE_STATIC(LIB, RCU_NEXT, "RCU sequence barrier") I would have expected the output to be: RCU_BUMP RCU thread: 3 RCU sequence barrier: X instead. As a thought experiment I reduced the number of static memory types to 1 in the file and the crash stopped happening. I suspect we have a systematic error on arm in lib/memory.h due to the asm code. I am going to leave that alone for the moment ( and leave the crash issue open ), but see if we can get this code change into the system so that our CI system becomes happy again. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-08-27*: Start process of possibly deprecating SolarisDonald Sharp
The FRR community has run into an issue where keeping up our CI system to work with solaris has become a fairly large burden. We have also sent emails and asked around and have not found anyone standing up saying that they are using Solaris. Given the fact that we do not have any comprehensive testing being done w/ solaris and the fact that we are getting a steady stream of new features that will never work on solaris and we cannot find anyone to say that they are using it. Let's start the drawn out process of deprecating the code. If in the mean-time someone comes forward with the fact that they are using it we can then not deprecate it. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-08-27lib: call vrf update hook when default vrf name changesPhilippe Guibert
this is a call done whenever vrf name changes. This is useful on remote daemons. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-08-26Merge pull request #4880 from ddutt/masterDonald Sharp
lib: Make if_lookup_by_index understand if VRF is backed by netns or not
2019-08-26Merge pull request #4812 from pogojotz/fix-destination-multi-useDonald Sharp
zebra: Do not use connection dest for bcast
2019-08-26lib: Make if_lookup_by_index understand if VRF is backed by netns or notDinesh G Dutt
FRR has two implementations of VRF, one backed by netns and the other by the proper VRF implementation in the Linux kernel. In certain places, the code assumes that a VRF is netns and so lookups fail. One example of this is in IPv6 RA code. This causes functionality such as Unnumbered BGP to fail. To fix this, this patch makes if_lookup_by_index handle the behavior based on the backend, similar to if_get_by_index. For the two places in if.c that were calling if_lookup_by_index to be specific to the VRF, I renamed the existing code, if_lookup_by_ifindex and made it a static function that is never exposed or called by any routine outside of if.c. Signed-off-by: Dinesh G Dutt <5016467+ddutt@users.noreply.github.com>
2019-08-26Merge pull request #4795 from opensourcerouting/assorted-fixesDonald Sharp
Minor assorted fixes
2019-08-23lib: use const in prefix_mac2strMark Stapp
Use const for mac pointer. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-08-22lib: remove deprecated stream_resize apiMark Stapp
Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-08-21lib: fix a couple more doc commentsRenato Westphal
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>