summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2020-10-24Merge pull request #7194 from qlyoung/tracingMark Stapp
Tracing
2020-10-23lib, bgpd: convert lttng tracepoints to frrtrace()Quentin Young
- tracepoint() -> frrtrace() - tracelog() -> frrtracelog() - tracepoint_enabled() -> frrtrace_enabled() Also removes copypasta'd #ifdefs for those LTTng macros, those are handled in lib/trace.h Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2020-10-23lib: add trace.h, frrtrace(), support for USDTQuentin Young
Previous commits added LTTng tracepoints. This was primarily for testing / trial purposes; in practice we'd like to support arbitrary tracing methods, and especially USDT probes, which SystemTap and dtrace expect, and which are supported on at least one flavor of BSD (FreeBSD). To that end this patch adds an frr-specific tracing macro, frrtrace(), which proxies into either DTRACE_PROBEn() or tracepoint() macros depending on whether --enable-usdt or --enable-lttng is passed at compile time. At some point this could be tweaked to allow compiling in both types of probes. Ideally there should be some logic there to use LTTng's optional support for generating USDT probes when both are requested. No additional libraries are required to use USDT, since these probes are a kernel feature and only need the <sys/sdt.h> header. - add --enable-usdt to toggle use of LTTng tracepoints or USDT probes - add new trace.h library header for use with tracepoint definition headers - add frrtrace() wrapper macro; this should be used to define tracepoints instead of using tracepoint() or DTRACE_PROBEn() Compilation with USDT does nothing as of this commit; the existing LTTng tracepoints need to be converted to use the frrtrace*() macros in a subsequent commit. Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2020-10-23lib: move trace.h -> libfrr_trace.hQuentin Young
Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2020-10-23lib: add tracepoint for route table getQuentin Young
Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2020-10-23lib: add tracepoints for *malloc, list opsQuentin Young
- Add tracepoints for FRR malloc and free - Add tracepoints for basic list operations Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2020-10-23lib: add tracepoint for hash insertionQuentin Young
hash_get is used for both lookup and insert; add a tracepoint for when we insert something into the hash Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2020-10-23lib: add tracepoints for pthread run, stopQuentin Young
Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2020-10-23lib: generate trace events for log messagesQuentin Young
LTTng supports tracef() and tracelog() macros, which work like printf, and are used to ease transition between logging and tracing. Messages printed using these macros end up as trace events. For our uses we are not interested in dropping logging, but it is nice to get log messages in trace output, so I've added a call to tracelog() in zlog that dumps our zlog messages as trace events. Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2020-10-23lib: add tracepoints for hash ops, thread eventsQuentin Young
Define some initial tracepoints for hash table operations, thread schedules, and thread cancels Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2020-10-23lib, configure.ac: initial LTTng supportQuentin Young
This commit adds initial support for LTTng. When --enable-lttng=no or is not specified, no tracing code is included. When --enable-lttng=yes, LTTng tracing events are (will be) generated. configure.ac: - add --enable-lttng - define HAVE_LTTNG when enabled - minimum LTTng version: 2.12.0 lib: - add trace.[ch] - update subdir.am Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2020-10-23lib: #undef _ASSERT_FUNCTIONQuentin Young
Redefining it has issues depending on header order. Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2020-10-23*: unify thread/event cancel macrosMark Stapp
Replace all lib/thread cancel macros, use thread_cancel() everywhere. Only the THREAD_OFF macro and thread_cancel() api are supported. Also adjust thread_cancel_async() to NULL caller's pointer (if present). Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-10-23* : update signature of thread_cancel apiMark Stapp
Change thread_cancel to take a ** to an event, NULL-check before dereferencing, and NULL the caller's pointer. Update many callers to use the new signature. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-10-22lib: Convert inet_ntoa to %pI4Donatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-10-22:* Convert prefix2str to %pFXDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-10-20Merge pull request #7311 from donaldsharp/table_lock_countDonatas Abraitis
Abstract rn->lock accessing and cleanup usage to %pFX and %pRN
2020-10-20Merge pull request #7300 from sworleys/EVPN-RType-NUMsPatrick Ruddy
lib,bgpd: more evpn route-type numerical command versions
2020-10-17lib: Convert usage of strings to %pFX and %pRNDonald Sharp
Convert over to using the %pFX and %pRN modifiers to output strings to allow us to consolidate on one standard for printing prefixes. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-10-17*: Create/Use accessor functions for lock countDonald Sharp
Create appropriate accessor functions for the rn->lock data. We should be accessing this data through accessor functions since it is private data to the data structure. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-10-17lib: Relax usage of `ip prefix-list A.B.C.D/M ge Y`Donald Sharp
Currently the prefix length M must be less than Y. Relax this restriction to allow M to be less than or equal to Y. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-10-17Merge pull request #7317 from pjdruddy/pr-fix-evpn-prefix2stringDonald Sharp
Pr fix evpn prefix2string
2020-10-16Merge pull request #7235 from opensourcerouting/acl-wildcard-fixSantosh P K
lib,yang: cisco acl network wildcard fixes
2020-10-16bgpd: replace bgp_evpn_route2str with prefix2strPat Ruddy
Remove bgp_evpn_route2str and replace calls with prefix2str Signed-off-by: Pat Ruddy <pat@voltanet.io>
2020-10-15lib: align prefixevpn2str output with bgp_evpn_route2strPat Ruddy
We have 2 different routines to turn an evpn route into a string. This commit aligns the two to the latest maintained version as a first step in removing one of them. Signed-off-by: Pat Ruddy <pat@voltanet.io>
2020-10-13lib: consolidate evpn type help strings into macroStephen Worley
Consolidate evpn type help strings into one single macro for use on commands that need to support all the types. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-10-12*: Use proper semantics for turning off threadDonald Sharp
We have this pattern in the code base: if (thread) THREAD_OFF(thread); If we look at THREAD_OFF we check to see if thread is non-null too. So we have a double check. This is unnecessary. Convert to just using THREAD_OFF Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-10-08lib: add some EVPN help string constantsStephen Worley
Add some EVPN help string constants to make use of in later commits. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-10-07Merge pull request #7241 from chiragshah6/evpn_dev1Renato Westphal
lib: add errmsg to nb rpc
2020-10-06Merge pull request #7238 from sworleys/Nexthop-Same-First-RemoveMark Stapp
lib: remove nexthop_same_firsthop() api
2020-10-05*: add errmsg to nb rpcChirag Shah
Display human readable error message in northbound rpc transaction failure. In case of vtysh nb client, the error message will be displayed to user. Testing: bharat# clear evpn dup-addr vni 1002 ip 11.11.11.11 Error type: generic error Error description: Requested IP's associated MAC aa:aa:aa:aa:aa:aa is still in duplicate state Signed-off-by: Chirag Shah <chirag@nvidia.com>
2020-10-04lib: fix cisco access list wildcard usageRafael Zalamena
Don't attempt to compress the wildcard information to fit a `/M`, but use its own full 4 byte field. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-10-03lib: increase the size of northbound max moduleChirag Shah
Increase the size of frr_yang_module_info macro to accomodate bgp module list. root@bharat:~/stash/frr# egrep "xpath" bgpd/bgp_nb.c | wc -l 1150 Signed-off-by: Chirag Shah <chirag@nvidia.com>
2020-10-03*: add bgp yang files into makefilesChirag Shah
Signed-off-by: Chirag Shah <chirag@nvidia.com>
2020-10-02lib: remove nexthop_same_firsthop() apiStephen Worley
Remove the nexthop_same_firsthop() api and just call nexthop_same(). Not entirely sure why we were using this function in the first place, but now we are just marking dupes with it so lets just call a common function and avoid issues. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-10-02vtysh: dynamically generate the list of daemons for commandsIgor Ryzhov
Some daemons were actually missing from the static definitions: nhrpd, babeld, eigrpd and bfdd. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-09-30lib: fix zapi_nexthop_update_decode error rcQuentin Young
This function returns true on success and false otherwise. Returning -1 on error is equivalent to returning true. Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2020-09-28lib,zebra,sharpd: add code for backup proto-NHs but disabledStephen Worley
Add the zapi code for encoding/decoding of backup nexthops for when we are ready for it, but disable it for now so that we revert to the old way with them. When zebra gets a proto-NHG with a backup in it, we early fail and tell the upper level proto. In this case sharpd. Sharpd then reverts to the old way of installation with the route. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-09-28lib,sharpd: align zapi NHG apis a bitStephen Worley
Align the zapi NHG apis to be more consistent with the zapi_route apis. Add a struct zapi_nhg to use for encodings as well. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-09-28lib: add doc to clear-up hash_iterate multi deletionStephen Worley
Add some header documentation to make it clear that you cannot delete more than one item during each iteration. Doing so could cause memory corruption for next pointer if its also deleted from the table. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-09-28lib: add proto NHG Notif header to log command typesStephen Worley
Add the proto Nexthop Group Notify Owner header to the log command types for string conversion. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-09-28lib,zebra,sharpd: clang formatStephen Worley
Clang format for NHG API and sharpd patches. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-09-28lib,zebra: fixup NHG notify zapi messagingStephen Worley
Make the message parameters align better with other zapi notifications and change the ID to correctly be a uint32. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-09-28Revert "lib,sharpd,pbrd: `set installable` nhg command"Stephen Worley
This reverts commit 1844f45e30913b27cfd875036f865a0edadcf244.
2020-09-28lib: add logging for ZEBRA_NHG_ADD[DEL]Stephen Worley
Add logging info for the new zapi ZEBRA_NHG_ADD[DEL] message types. With this patch, they are logged properly when debugs are turned on. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-09-28lib,sharpd,pbrd: `set installable` nhg commandStephen Worley
Add a command `set installable` that allows configured nexthop groups to be treated as separate/installable objects in the RIB. A callback needs to be implemented per daemon to handle installing the NHG into the rib via zapi when this command is set. This patch includes the implementation for sharpd. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-09-28lib,doc: add `onlink` flag to nexthop group configStephen Worley
Add an `onlink` flag to nexthop group configuration. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-09-28lib: add onlink flag to zapi_nh conversion helperStephen Worley
Add setting the onlink flag to the zapi_nh conversion helper function so that we can set the onlink flag with it when passing down NHGs from upper level protos. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-09-28zebra: NHG ID bounds macrosStephen Worley
Determine the NHG ID spacing and lower bound with ZEBRA_ROUTE_MAX in macros. Directly set the upperbound to be the lower 28bits of the uint32_t ID space (the top 4 are reserved for l2-NHGs). Round that number down a bit to make it more even. Convert all former lower_bound calls to just use the macro. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-09-28zebra,lib: command to only install proto-based nexthopsStephen Worley
Add a command/functionality to only install proto-based nexthops. That is nexthops owned/created by upper level protocols, not ones implicitly created by zebra. There are some scenarios where you would not want zebra to be arbitrarily installing nexthop groups and but you still want to use ones you have control over via lib/nexthop_group config and an upper level protocol. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>