summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-10-24Merge pull request #7194 from qlyoung/tracingMark Stapp
Tracing
2020-10-24Merge pull request #7374 from sworleys/Revert-Revert-NHG-DependentsMark Stapp
zebra: Fix the NHG dependents relationship
2020-10-24Merge pull request #7377 from donaldsharp/bgp_static_leakRenato Westphal
bgpd: Bgp static routes memory leak
2020-10-24Merge pull request #7379 from donaldsharp/isis_mem_leakRenato Westphal
isisd: Fix memory leak on shutdown
2020-10-23Merge pull request #7380 from Orange-OpenSource/ospf-srDonald Sharp
Add more Segment Routing controls
2020-10-23Merge pull request #7382 from sworleys/Fix-Msg-BuffMark Stapp
zebra: fix unitialized msg header reading at startup
2020-10-23bgpd: clean up trace header style a bitQuentin Young
Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2020-10-23bgpd: move packet read tracepoint out of mutexQuentin Young
Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2020-10-23doc: add developer docs for tracingQuentin Young
Signed-off-by: Quentin Young <qlyoung@nvidia.com>
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-23bgpd: route processing tracepointsQuentin Young
Add tracepoints for route process, input filter and output filter. Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2020-10-23bgpd: add basic packet-related tracepointsQuentin Young
Add tracepoints for: - packet pushed to internal rx queue - packet dequeued from rx queue and processed 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-23Merge pull request #7361 from wesleycoakley/alpine-build-fixQuentin Young
alpine: Remove old docker deps for alpine
2020-10-23Merge pull request #7184 from opensourcerouting/anycast-sids-v4Olivier Dugeon
isisd: refactor Prefix-SID code + Anycast-SIDs (v2)
2020-10-23Merge pull request #6788 from mjstapp/thread_cancel_offQuentin Young
*: unify thread/task cancel apis
2020-10-23zebra: fix unitialized msg header reading at startupStephen Worley
Fixes the valgrind error we were seeing on startup due to initializing the msg header struct: ``` ==2534283== Thread 3 zebra_dplane: ==2534283== Syscall param recvmsg(msg) points to uninitialised byte(s) ==2534283== at 0x4D616DD: recvmsg (in /usr/lib64/libpthread-2.31.so) ==2534283== by 0x43107C: netlink_recv_msg (kernel_netlink.c:744) ==2534283== by 0x4330E4: nl_batch_read_resp (kernel_netlink.c:1070) ==2534283== by 0x431D12: nl_batch_send (kernel_netlink.c:1201) ==2534283== by 0x431E8B: kernel_update_multi (kernel_netlink.c:1369) ==2534283== by 0x46019B: kernel_dplane_process_func (zebra_dplane.c:3979) ==2534283== by 0x45EB7F: dplane_thread_loop (zebra_dplane.c:4368) ==2534283== by 0x493F5CC: thread_call (thread.c:1585) ==2534283== by 0x48D3450: fpt_run (frr_pthread.c:303) ==2534283== by 0x48D3D41: frr_pthread_inner (frr_pthread.c:156) ==2534283== by 0x4D56431: start_thread (in /usr/lib64/libpthread-2.31.so) ==2534283== by 0x4E709D2: clone (in /usr/lib64/libc-2.31.so) ==2534283== Address 0x85cd850 is on thread 3's stack ==2534283== in frame #2, created by nl_batch_read_resp (kernel_netlink.c:1051) ==2534283== ==2534283== Syscall param recvmsg(msg.msg_control) points to unaddressable byte(s) ==2534283== at 0x4D616DD: recvmsg (in /usr/lib64/libpthread-2.31.so) ==2534283== by 0x43107C: netlink_recv_msg (kernel_netlink.c:744) ==2534283== by 0x4330E4: nl_batch_read_resp (kernel_netlink.c:1070) ==2534283== by 0x431D12: nl_batch_send (kernel_netlink.c:1201) ==2534283== by 0x431E8B: kernel_update_multi (kernel_netlink.c:1369) ==2534283== by 0x46019B: kernel_dplane_process_func (zebra_dplane.c:3979) ==2534283== by 0x45EB7F: dplane_thread_loop (zebra_dplane.c:4368) ==2534283== by 0x493F5CC: thread_call (thread.c:1585) ==2534283== by 0x48D3450: fpt_run (frr_pthread.c:303) ==2534283== by 0x48D3D41: frr_pthread_inner (frr_pthread.c:156) ==2534283== by 0x4D56431: start_thread (in /usr/lib64/libpthread-2.31.so) ==2534283== by 0x4E709D2: clone (in /usr/lib64/libc-2.31.so) ==2534283== Address 0xa0 is not stack'd, malloc'd or (recently) free'd ==2534283== ``` Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-10-23ospfd: Add more Segment Routing controlsOlivier Dugeon
When Segment Routing is not enabled, some related output messages are printed on the console especially when Segment Routing Debug is enabled. This patch adds additional controls to check whether segment routing is enabled or not. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2020-10-23tools: add cocci patch for thread cancel api changesMark Stapp
Add Quentin's cocci patch to align code with the changes to the event cancel api. Also added a README to explain what this collection of cocci patches is for. Signed-off-by: Quentin Young <qlyoung@nvidia.com> Signed-off-by: Mark Stapp <mjs@voltanet.io>
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-23isisd: Fix memory leak on shutdownDonald Sharp
==935465== 40 bytes in 1 blocks are definitely lost in loss record 71 of 546 ==935465== at 0x483AB65: calloc (vg_replace_malloc.c:760) ==935465== by 0x48D6611: qcalloc (memory.c:110) ==935465== by 0x48CFE02: list_new (linklist.c:32) ==935465== by 0x15DBF0: isis_new (isisd.c:213) ==935465== by 0x15DAC4: isis_global_instance_create (isisd.c:179) ==935465== by 0x121892: main (isis_main.c:264) ==935465== 64 (40 direct, 24 indirect) bytes in 1 blocks are definitely lost in loss record 101 of 546 ==935465== at 0x483AB65: calloc (vg_replace_malloc.c:760) ==935465== by 0x48D6611: qcalloc (memory.c:110) ==935465== by 0x48CFE02: list_new (linklist.c:32) ==935465== by 0x15DBE3: isis_new (isisd.c:212) ==935465== by 0x15DAC4: isis_global_instance_create (isisd.c:179) ==935465== by 0x121892: main (isis_main.c:264) On isis shutdown we are seeing the above memory leaks. Modify the code to start cleaning this up. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-10-23bgpd: Bgp static routes memory leakDonald Sharp
When using MPLS_VPN/EVPN ( or really any two level table/route data structure setup ) FRR is leaking memory on shutdown: eva# conf eva(config)# router bgp 329 eva(config-router)# address-family ipv4 vpn eva(config-router-af)# network 5.6.7.8/32 rd 44:55 label 3293 eva(config-router-af)# end eva# exit sharpd@eva ~/frr_coverity (master)> ps -ef | grep frr root 1186423 10793 0 07:51 pts/1 00:00:00 sudo /usr/lib/frr/zebra --log stdout --log-level debug frr 1186425 1186423 0 07:51 pts/1 00:00:00 /usr/lib/frr/zebra --log stdout --log-level debug root 1263168 491694 0 11:10 pts/20 00:00:00 sudo valgrind --leak-check=full /usr/lib/frr/bgpd --log stdout --log-level debug frr 1263169 1263168 22 11:10 pts/20 00:00:04 /usr/bin/valgrind.bin --leak-check=full /usr/lib/frr/bgpd --log stdout --log-level debug sharpd 1263214 845829 0 11:10 pts/9 00:00:00 grep --color=auto frr sharpd@eva ~/frr_coverity (master)> sudo kill -SIGTERM 1263169 sharpd@eva ~/frr_coverity (master)> gives us this: ==1263169== 304 (40 direct, 264 indirect) bytes in 1 blocks are definitely lost in loss record 61 of 78 ==1263169== at 0x483AB65: calloc (vg_replace_malloc.c:760) ==1263169== by 0x48DD878: qcalloc (memory.c:110) ==1263169== by 0x5116D5: bgp_table_init (bgp_table.c:110) ==1263169== by 0x4EB5C4: bgp_static_set_safi (bgp_route.c:5927) ==1263169== by 0x4C3382: vpnv4_network (bgp_mplsvpn.c:1911) ==1263169== by 0x489FBEC: cmd_execute_command_real (command.c:916) ==1263169== by 0x489F7CB: cmd_execute_command (command.c:976) ==1263169== by 0x489FD04: cmd_execute (command.c:1138) ==1263169== by 0x493AF73: vty_command (vty.c:517) ==1263169== by 0x493AA07: vty_execute (vty.c:1282) ==1263169== by 0x4939B54: vtysh_read (vty.c:2115) ==1263169== by 0x492E63C: thread_call (thread.c:1585) The bgp_static_delete function was not unlocking the right bgp_dest. This problem goes away after fixing this. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-10-23Merge pull request #7364 from donaldsharp/zebra_nhg_keepMark Stapp
zebra: Do not delete nhg's when retain_mode is engaged
2020-10-23tests: extend the isisd SR topotest to test Anycast-SIDs as wellRenato Westphal
Add the following Anycast-SIDs on routers rt4 and rt5: * segment-routing prefix 10.10.10.10/32 index 100 no-php-flag n-flag-clear * segment-routing prefix 2001:db8:1000::10/128 index 101 no-php-flag n-flag-clear The updated JSON data will then check whether the Anycast-SIDs are being processed as expected (e.g. rt1 should use ECMP to rt2 and rt3, rt2 should use rt4 only as it's directly connected, etc). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2020-10-23isisd: add support for Anycast-SIDsRenato Westphal
Add the "n-flag-clear" option to the "segment-routing prefix" command. The only thing that option does is to clear the node flag of the Prefix-SID, even if it corresponds to a local loopback address. No changes are necessary other than that in order to fully support Anycast-SIDs. isisd already supports multiple routers advertising the same route with the same Prefix-SID after the recent refactoring. Clearing the node flag for such anycast routes isn't strictly required, but failure to do so can lead to problems like TI-LFA picking the wrong Prefix-SID when calculating repair paths. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2020-10-23isisd: fix the TI-LFA repair paths to preserve the original Prefix-SIDRenato Westphal
When computing backup nexthops for routes that contain a Prefix-SID, the original Prefix-SID label should be present at the end of backup label stacks (after the repair labels). This commit fixes that oversight in the original TI-LFA code. The SPF unit tests and TI-LFA topotes were also updated accordingly. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2020-10-23isisd: refactor handling of SR Prefix-SIDsRenato Westphal
Embed Prefix-SID information inside SPF data structures so that Prefix-SIDs can be installed together with their associated routes at the end of the SPF algorithm. This is different from the current implementation where Prefix-SIDs are parsed and processed separately, which is vastly suboptimal. Advantages of the new code: * No need to parse the LSPDB an additional time to detect and process SR-related changes; * Routes are installed with their Prefix-SID labels in the same ZAPI message. This can prevent packet dropping for a few milliseconds after each SPF run if there are BGP-labeled routes (e.g. L3VPN) that recurse on IGP labeled routes; * Much easier to support Anycast-SIDs, as the SPF code will naturally figure out the best nexthops and use only them (that can't be done in any reasonable way if the Prefix-SID Sub-TVLs are processed separately); * Less code to maintain and reduced memory footprint; The "show isis segment-routing prefix-sids" command was removed as it doesn't make sense anymore now that "show isis route" exists. Prefix-SIDs are a property of routes, so what was done was to extend the "show isis route" command with a new "prefix-sid" option that changes the output table to show the Prefix-SID information associated to each route. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2020-10-23isisd: create routes for local destinationsRenato Westphal
This is preparatory change for the upcoming SR Prefix-SID refactoring. Since Prefix-SID information will be stored inside IS-IS routes (instead of being maintained separately), it will be necessary to have local routes in order to store local Prefix-SID information. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2020-10-23isisd: give precedence to new-style TLVs when generating routesRenato Westphal
When both old and new-style TLVs exist for a particular prefix, give precedence to the new-style TLV (like JUNOS does) when generating routes from the SPT. This changes the current behavior which is to generate a route for both TLVs, whereas the first is overwritten by the second in a non-deterministic order (i.e. either the old-style or the new-style TLV can "win" depending on how the SPF TENTative list is arranged). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
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-23Merge pull request #7345 from opensourcerouting/bgp-aggr-suppressDonatas Abraitis
bgpd: aggregate-address suppress-map
2020-10-23Merge pull request #7365 from mjstapp/fix_ntoa_pimdDonald Sharp
pimd: replace inet_ntoa
2020-10-22Merge pull request #7372 from mjstapp/fix_ntoa_ripdDonald Sharp
ripd, staticd, isisd, babeld: replace inet_ntoa
2020-10-22Merge pull request #7367 from mjstapp/fix_ntoa_ldpdDonald Sharp
ldpd: replace inet_ntoa
2020-10-22Merge pull request #7358 from mjstapp/fix_ntoaDonald Sharp
ospfd, zebra: Replace use of inet_ntoa
2020-10-22Merge pull request #7340 from ton31337/fix/inet_ntoa_to_pI4_libDonald Sharp
lib: Convert inet_ntoa to %pI4
2020-10-22zebra: disable dependent backpointers for backup nexthopsStephen Worley
Because the backup nexthop groups currently are more like pseudo-NHEs (they don't have IDs and are not inserted into the ID table or hashed), they can't really have this depends/dependents relationship yet in both directions. Some work needs to be done there to make them more like first class citizens like "normal" NHGs to enable this. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-10-22Revert "Revert "zebra: fix NHE dependents backpointer relationship""Stephen Worley
This reverts commit a682deea0fc1e2c2dc2de31a358126793f946371.
2020-10-22isisd: replace inet_ntoaMark Stapp
Replace use of inet_ntoa, using pI4 Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-10-22babeld: replace inet_ntoaMark Stapp
Replace use of inet_ntoa, using pI4, pFX, or inet_pton. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-10-22staticd: replace inet_ntoaMark Stapp
Replace inet_ntoa with pI4 Signed-off-by: Mark Stapp <mjs@voltanet.io>