]> git.proxmox.com Git - mirror_frr.git/log
mirror_frr.git
3 years agoMerge pull request #7387 from dslicenc/bgp-update-delay-local
Santosh P K [Tue, 27 Oct 2020 08:44:54 +0000 (14:14 +0530)]
Merge pull request #7387 from dslicenc/bgp-update-delay-local

bgpd: delay local routes until update-delay is over

3 years agoMerge pull request #7376 from mjstapp/fix_pim_align
Quentin Young [Mon, 26 Oct 2020 20:24:00 +0000 (16:24 -0400)]
Merge pull request #7376 from mjstapp/fix_pim_align

pimd: Fix pim address-of-unaligned error and use of zlog_warn

3 years agoMerge pull request #7384 from opensourcerouting/nb-dyn-modules
Quentin Young [Mon, 26 Oct 2020 17:14:30 +0000 (13:14 -0400)]
Merge pull request #7384 from opensourcerouting/nb-dyn-modules

lib: add API to load YANG modules on demand

3 years agoMerge pull request #7388 from donaldsharp/more_string
Mark Stapp [Mon, 26 Oct 2020 16:24:10 +0000 (12:24 -0400)]
Merge pull request #7388 from donaldsharp/more_string

More string

3 years agozebra: Fix prefix2str buf and some invalid data output in zebra_mpls.c
Donald Sharp [Mon, 26 Oct 2020 13:29:52 +0000 (09:29 -0400)]
zebra: Fix prefix2str buf and some invalid data output in zebra_mpls.c

There are several places where prefix2str was used to convert
a prefix but they were debug guarded and the buffer was
used for flog_err/warn.  This would lead to corrupt data
being output in the failure cases if debugs were not turned
on.

Modify the code in zebra_mpls.c to not use prefix2str

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agozebra: Replace some prefix2str with %pFX
Donald Sharp [Mon, 26 Oct 2020 13:17:35 +0000 (09:17 -0400)]
zebra: Replace some prefix2str with %pFX

We are loading a buffer with the prefix2str results then
using it in the debugs throughout functions.  Replace
with just using %pFX and remove the buffer.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agopbrd: Remove inet_ntoa usage from pbr
Donald Sharp [Mon, 26 Oct 2020 13:36:17 +0000 (09:36 -0400)]
pbrd: Remove inet_ntoa usage from pbr

Convert over to using %pI4 for the last inet_ntoa

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agobgpd: delay local routes until update-delay is over
Don Slice [Wed, 21 Oct 2020 14:46:49 +0000 (07:46 -0700)]
bgpd: delay local routes until update-delay is over

Problem found that turning an update-delay would only delay prefixes
learned from peers by delaying bestpath, but would allow local routes
(network statements or redistributed) to be immediately advertised,
followed by an End of Rib indicator. This fix delays sending local
routes until the update-delay process is completed, which matches
what testing shows other vendors do..

Ticket: CM-31743
Signed-off-by: Don Slice <dslice@nvidia.com>
3 years agoMerge pull request #7217 from AnuradhaKaruppiah/fix-es-del-regression
Patrick Ruddy [Mon, 26 Oct 2020 10:12:54 +0000 (10:12 +0000)]
Merge pull request #7217 from AnuradhaKaruppiah/fix-es-del-regression

zebra: fix double clearing of zif->es_info.es

3 years agoMerge pull request #7194 from qlyoung/tracing
Mark Stapp [Sat, 24 Oct 2020 20:50:35 +0000 (16:50 -0400)]
Merge pull request #7194 from qlyoung/tracing

Tracing

3 years agoMerge pull request #7374 from sworleys/Revert-Revert-NHG-Dependents
Mark Stapp [Sat, 24 Oct 2020 20:49:09 +0000 (16:49 -0400)]
Merge pull request #7374 from sworleys/Revert-Revert-NHG-Dependents

zebra: Fix the NHG dependents relationship

3 years agoMerge pull request #7377 from donaldsharp/bgp_static_leak
Renato Westphal [Sat, 24 Oct 2020 18:29:34 +0000 (15:29 -0300)]
Merge pull request #7377 from donaldsharp/bgp_static_leak

bgpd: Bgp static routes memory leak

3 years agoMerge pull request #7379 from donaldsharp/isis_mem_leak
Renato Westphal [Sat, 24 Oct 2020 18:28:18 +0000 (15:28 -0300)]
Merge pull request #7379 from donaldsharp/isis_mem_leak

isisd: Fix memory leak on shutdown

3 years agoMerge pull request #7380 from Orange-OpenSource/ospf-sr
Donald Sharp [Sat, 24 Oct 2020 01:28:06 +0000 (21:28 -0400)]
Merge pull request #7380 from Orange-OpenSource/ospf-sr

Add more Segment Routing controls

3 years agoMerge pull request #7382 from sworleys/Fix-Msg-Buff
Mark Stapp [Fri, 23 Oct 2020 22:05:04 +0000 (18:05 -0400)]
Merge pull request #7382 from sworleys/Fix-Msg-Buff

zebra: fix unitialized msg header reading at startup

3 years agolib: add API to load YANG modules on demand
Renato Westphal [Tue, 20 Oct 2020 03:20:48 +0000 (00:20 -0300)]
lib: add API to load YANG modules on demand

Make it possible to load YANG modules outside the main northbound
initialization. The primary use case is to support YANG modules
that are specific to an FRR plugin. Example: only load the PCEP
YANG module when the corresponding FRR plugin is loaded. Other use
cases might arise in the future.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
3 years agolib: combine two YANG schema iteration functions into one
Renato Westphal [Fri, 23 Oct 2020 01:19:10 +0000 (22:19 -0300)]
lib: combine two YANG schema iteration functions into one

Combine yang_snodes_iterate_module() and yang_snodes_iterate_all()
into an unified yang_snodes_iterate() function, where the first
"module" parameter is optional. There's no point in having two
separate YANG schema iteration functions anymore now that they are
too similar.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
3 years agolib: fix iteration over schema nodes of a single YANG module
Renato Westphal [Tue, 20 Oct 2020 02:56:54 +0000 (23:56 -0300)]
lib: fix iteration over schema nodes of a single YANG module

The only safe way to iterate over all schema nodes of a given YANG
module is by iterating over all schema nodes of all YANG modules
and filter out the nodes that belong to other modules.

The original yang_snodes_iterate_module() code did the following:
1 - Iterate over all top-level schema nodes of the given module;
2 - Iterate over all augmentations of the given module.

While that iteration strategy is more efficient, it does't handle
well more complex YANG hierarchies containing nested augmentations
or self-augmenting modules. Any iteration that isn't done on the
resolved YANG data hierarchy is fragile and prone to errors.

Fixes regression introduced by commit 8a923b48513316b where the
gen_northbound_callbacks tool was generating duplicate callbacks
for certain modules.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
3 years agobgpd: clean up trace header style a bit
Quentin Young [Fri, 23 Oct 2020 19:23:12 +0000 (15:23 -0400)]
bgpd: clean up trace header style a bit

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
3 years agobgpd: move packet read tracepoint out of mutex
Quentin Young [Thu, 8 Oct 2020 20:54:37 +0000 (16:54 -0400)]
bgpd: move packet read tracepoint out of mutex

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
3 years agodoc: add developer docs for tracing
Quentin Young [Tue, 29 Sep 2020 00:12:41 +0000 (20:12 -0400)]
doc: add developer docs for tracing

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
3 years agolib, bgpd: convert lttng tracepoints to frrtrace()
Quentin Young [Mon, 28 Sep 2020 22:13:27 +0000 (18:13 -0400)]
lib, bgpd: convert lttng tracepoints to frrtrace()

- 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>
3 years agolib: add trace.h, frrtrace(), support for USDT
Quentin Young [Mon, 28 Sep 2020 21:22:53 +0000 (17:22 -0400)]
lib: add trace.h, frrtrace(), support for USDT

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>
3 years agolib: move trace.h -> libfrr_trace.h
Quentin Young [Mon, 28 Sep 2020 19:49:22 +0000 (15:49 -0400)]
lib: move trace.h -> libfrr_trace.h

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
3 years agolib: add tracepoint for route table get
Quentin Young [Fri, 18 Sep 2020 19:14:09 +0000 (15:14 -0400)]
lib: add tracepoint for route table get

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
3 years agolib: add tracepoints for *malloc, list ops
Quentin Young [Thu, 17 Sep 2020 18:57:36 +0000 (14:57 -0400)]
lib: add tracepoints for *malloc, list ops

- Add tracepoints for FRR malloc and free
- Add tracepoints for basic list operations

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
3 years agolib: add tracepoint for hash insertion
Quentin Young [Wed, 16 Sep 2020 23:29:32 +0000 (19:29 -0400)]
lib: add tracepoint for hash insertion

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>
3 years agobgpd: route processing tracepoints
Quentin Young [Wed, 16 Sep 2020 23:16:35 +0000 (19:16 -0400)]
bgpd: route processing tracepoints

Add tracepoints for route process, input filter and output filter.

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
3 years agobgpd: add basic packet-related tracepoints
Quentin Young [Wed, 16 Sep 2020 00:13:36 +0000 (20:13 -0400)]
bgpd: add basic packet-related tracepoints

Add tracepoints for:
- packet pushed to internal rx queue
- packet dequeued from rx queue and processed

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
3 years agolib: add tracepoints for pthread run, stop
Quentin Young [Tue, 15 Sep 2020 04:28:55 +0000 (00:28 -0400)]
lib: add tracepoints for pthread run, stop

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
3 years agolib: generate trace events for log messages
Quentin Young [Mon, 14 Sep 2020 22:05:47 +0000 (18:05 -0400)]
lib: generate trace events for log messages

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>
3 years agolib: add tracepoints for hash ops, thread events
Quentin Young [Mon, 14 Sep 2020 22:04:33 +0000 (18:04 -0400)]
lib: add tracepoints for hash ops, thread events

Define some initial tracepoints for hash table operations, thread
schedules, and thread cancels

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
3 years agolib, configure.ac: initial LTTng support
Quentin Young [Mon, 14 Sep 2020 22:02:56 +0000 (18:02 -0400)]
lib, configure.ac: initial LTTng support

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>
3 years agolib: #undef _ASSERT_FUNCTION
Quentin Young [Wed, 16 Sep 2020 19:39:41 +0000 (15:39 -0400)]
lib: #undef _ASSERT_FUNCTION

Redefining it has issues depending on header order.

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
3 years agoMerge pull request #7361 from wesleycoakley/alpine-build-fix
Quentin Young [Fri, 23 Oct 2020 19:05:04 +0000 (15:05 -0400)]
Merge pull request #7361 from wesleycoakley/alpine-build-fix

alpine: Remove old docker deps for alpine

3 years agoMerge pull request #7184 from opensourcerouting/anycast-sids-v4
Olivier Dugeon [Fri, 23 Oct 2020 19:03:55 +0000 (21:03 +0200)]
Merge pull request #7184 from opensourcerouting/anycast-sids-v4

isisd: refactor Prefix-SID code + Anycast-SIDs (v2)

3 years agoMerge pull request #6788 from mjstapp/thread_cancel_off
Quentin Young [Fri, 23 Oct 2020 19:02:50 +0000 (15:02 -0400)]
Merge pull request #6788 from mjstapp/thread_cancel_off

*: unify thread/task cancel apis

3 years agozebra: fix unitialized msg header reading at startup
Stephen Worley [Fri, 23 Oct 2020 18:57:29 +0000 (14:57 -0400)]
zebra: fix unitialized msg header reading at startup

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>
3 years agoospfd: Add more Segment Routing controls
Olivier Dugeon [Fri, 23 Oct 2020 15:39:53 +0000 (17:39 +0200)]
ospfd: Add more Segment Routing controls

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>
3 years agotools: add cocci patch for thread cancel api changes
Mark Stapp [Tue, 22 Sep 2020 16:02:28 +0000 (12:02 -0400)]
tools: add cocci patch for thread cancel api changes

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>
3 years ago*: unify thread/event cancel macros
Mark Stapp [Fri, 17 Jul 2020 21:09:51 +0000 (17:09 -0400)]
*: unify thread/event cancel macros

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>
3 years agoisisd: Fix memory leak on shutdown
Donald Sharp [Fri, 23 Oct 2020 00:51:24 +0000 (20:51 -0400)]
isisd: Fix memory leak on shutdown

==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>
3 years agobgpd: Bgp static routes memory leak
Donald Sharp [Fri, 23 Oct 2020 15:09:51 +0000 (11:09 -0400)]
bgpd: Bgp static routes memory leak

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>
3 years agoMerge pull request #7364 from donaldsharp/zebra_nhg_keep
Mark Stapp [Fri, 23 Oct 2020 14:28:31 +0000 (10:28 -0400)]
Merge pull request #7364 from donaldsharp/zebra_nhg_keep

zebra: Do not delete nhg's when retain_mode is engaged

3 years agotests: extend the isisd SR topotest to test Anycast-SIDs as well
Renato Westphal [Wed, 23 Sep 2020 04:49:00 +0000 (01:49 -0300)]
tests: extend the isisd SR topotest to test Anycast-SIDs as well

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>
3 years agoisisd: add support for Anycast-SIDs
Renato Westphal [Sun, 20 Sep 2020 05:42:32 +0000 (02:42 -0300)]
isisd: add support for Anycast-SIDs

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>
3 years agoisisd: fix the TI-LFA repair paths to preserve the original Prefix-SID
Renato Westphal [Fri, 25 Sep 2020 05:45:19 +0000 (02:45 -0300)]
isisd: fix the TI-LFA repair paths to preserve the original Prefix-SID

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>
3 years agoisisd: refactor handling of SR Prefix-SIDs
Renato Westphal [Sun, 20 Sep 2020 05:39:28 +0000 (02:39 -0300)]
isisd: refactor handling of SR Prefix-SIDs

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>
3 years agoisisd: create routes for local destinations
Renato Westphal [Fri, 16 Oct 2020 23:57:37 +0000 (20:57 -0300)]
isisd: create routes for local destinations

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>
3 years agoisisd: give precedence to new-style TLVs when generating routes
Renato Westphal [Fri, 25 Sep 2020 21:37:48 +0000 (18:37 -0300)]
isisd: give precedence to new-style TLVs when generating routes

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>
3 years ago* : update signature of thread_cancel api
Mark Stapp [Mon, 6 Jul 2020 16:55:03 +0000 (12:55 -0400)]
* : update signature of thread_cancel api

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>
3 years agopimd: replace some zlog_warn with zlog_debug
Mark Stapp [Fri, 23 Oct 2020 12:35:57 +0000 (08:35 -0400)]
pimd: replace some zlog_warn with zlog_debug

A pim module had a number of warnings being used instead of
debugs - use debugs.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
3 years agopimd: avoid possible unaligned pointer
Mark Stapp [Fri, 23 Oct 2020 12:34:41 +0000 (08:34 -0400)]
pimd: avoid possible unaligned pointer

Use inet_ntop instead of %pI4 in one place - clang doesn't like
the struct's address being taken that way.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
3 years agoMerge pull request #7345 from opensourcerouting/bgp-aggr-suppress
Donatas Abraitis [Fri, 23 Oct 2020 12:02:57 +0000 (15:02 +0300)]
Merge pull request #7345 from opensourcerouting/bgp-aggr-suppress

bgpd: aggregate-address suppress-map

3 years agoMerge pull request #7365 from mjstapp/fix_ntoa_pimd
Donald Sharp [Fri, 23 Oct 2020 11:31:17 +0000 (07:31 -0400)]
Merge pull request #7365 from mjstapp/fix_ntoa_pimd

pimd: replace inet_ntoa

3 years agoMerge pull request #7372 from mjstapp/fix_ntoa_ripd
Donald Sharp [Fri, 23 Oct 2020 00:56:18 +0000 (20:56 -0400)]
Merge pull request #7372 from mjstapp/fix_ntoa_ripd

ripd, staticd, isisd, babeld: replace inet_ntoa

3 years agoMerge pull request #7367 from mjstapp/fix_ntoa_ldpd
Donald Sharp [Thu, 22 Oct 2020 22:40:15 +0000 (18:40 -0400)]
Merge pull request #7367 from mjstapp/fix_ntoa_ldpd

ldpd: replace inet_ntoa

3 years agoMerge pull request #7358 from mjstapp/fix_ntoa
Donald Sharp [Thu, 22 Oct 2020 22:39:04 +0000 (18:39 -0400)]
Merge pull request #7358 from mjstapp/fix_ntoa

ospfd, zebra: Replace use of inet_ntoa

3 years agoMerge pull request #7340 from ton31337/fix/inet_ntoa_to_pI4_lib
Donald Sharp [Thu, 22 Oct 2020 22:34:03 +0000 (18:34 -0400)]
Merge pull request #7340 from ton31337/fix/inet_ntoa_to_pI4_lib

lib: Convert inet_ntoa to %pI4

3 years agozebra: disable dependent backpointers for backup nexthops
Stephen Worley [Thu, 22 Oct 2020 22:10:44 +0000 (18:10 -0400)]
zebra: disable dependent backpointers for backup nexthops

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>
3 years agoRevert "Revert "zebra: fix NHE dependents backpointer relationship""
Stephen Worley [Thu, 22 Oct 2020 22:09:44 +0000 (18:09 -0400)]
Revert "Revert "zebra: fix NHE dependents backpointer relationship""

This reverts commit a682deea0fc1e2c2dc2de31a358126793f946371.

3 years agoisisd: replace inet_ntoa
Mark Stapp [Thu, 22 Oct 2020 18:30:34 +0000 (14:30 -0400)]
isisd: replace inet_ntoa

Replace use of inet_ntoa, using pI4

Signed-off-by: Mark Stapp <mjs@voltanet.io>
3 years agobabeld: replace inet_ntoa
Mark Stapp [Thu, 22 Oct 2020 18:27:38 +0000 (14:27 -0400)]
babeld: replace inet_ntoa

Replace use of inet_ntoa, using pI4, pFX, or inet_pton.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
3 years agostaticd: replace inet_ntoa
Mark Stapp [Thu, 22 Oct 2020 18:19:10 +0000 (14:19 -0400)]
staticd: replace inet_ntoa

Replace inet_ntoa with pI4

Signed-off-by: Mark Stapp <mjs@voltanet.io>
3 years agoripd: replace inet_ntoa
Mark Stapp [Thu, 22 Oct 2020 18:16:33 +0000 (14:16 -0400)]
ripd: replace inet_ntoa

Replace all uses of inet_ntoa, using pI4, pFX, or inet_pton.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
3 years agoldpd: replace inet_ntoa
Mark Stapp [Thu, 22 Oct 2020 14:46:14 +0000 (10:46 -0400)]
ldpd: replace inet_ntoa

Replace all use of inet_ntoa; use pI4 or inet_ntop instead.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
3 years agoMerge pull request #7369 from eololab/fix-bgp-strings-in-vtsh
Donald Sharp [Thu, 22 Oct 2020 18:41:42 +0000 (14:41 -0400)]
Merge pull request #7369 from eololab/fix-bgp-strings-in-vtsh

bgpd: fix information strings for vtysh

3 years agoMerge pull request #7302 from donaldsharp/eigrp_neighbor_warning
Renato Westphal [Thu, 22 Oct 2020 17:50:54 +0000 (14:50 -0300)]
Merge pull request #7302 from donaldsharp/eigrp_neighbor_warning

eigrpd: Tone down warning when command is not implemented yet

3 years agoospfclient: replace inet_ntoa
Mark Stapp [Thu, 22 Oct 2020 17:41:51 +0000 (13:41 -0400)]
ospfclient: replace inet_ntoa

Replace all use of inet_ntoa; use pI4 (and printfrr).

Signed-off-by: Mark Stapp <mjs@voltanet.io>
3 years agozebra: replace inet_ntoa
Mark Stapp [Wed, 21 Oct 2020 17:57:06 +0000 (13:57 -0400)]
zebra: replace inet_ntoa

Stop using inet_ntoa - use %pI4 or inet_ntop instead

Signed-off-by: Mark Stapp <mjs@voltanet.io>
3 years agoospfd: replace inet_ntoa
Mark Stapp [Wed, 21 Oct 2020 17:56:26 +0000 (13:56 -0400)]
ospfd: replace inet_ntoa

Stop using inet_ntoa, use %pI4 etc or inet_ntop instead

Signed-off-by: Mark Stapp <mjs@voltanet.io>
3 years agobgpd,topotests: log route suppression messages
Rafael Zalamena [Thu, 22 Oct 2020 00:48:43 +0000 (21:48 -0300)]
bgpd,topotests: log route suppression messages

To see the messages activate the BGP debug: `debug bgp updates`.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
3 years agobgpd: route suppression refactory
Rafael Zalamena [Thu, 22 Oct 2020 00:22:04 +0000 (21:22 -0300)]
bgpd: route suppression refactory

Instead of just counting the route suppressions, keep a reference for
all aggregations that are doing it. It should help the with the
following problems:

- Which aggregation suppressed the route.
- Double suppression
- Double unsuppression
- Avoids calling `bgp_process` if already suppressed/unsuppressed.
- Easier code maintenance and understanding

This also fixes a crash when modifying a route map that is
associated with a working aggregate-address.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
3 years agobgpd: fix information strings for vtysh
Emanuele Bovisio [Thu, 22 Oct 2020 14:46:47 +0000 (16:46 +0200)]
bgpd: fix information strings for vtysh

set correct information strings for vtysh.

Signed-off-by: Emanuele Bovisio <emanuele.bovisio@eolo.it>
3 years agopimd: replace inet_ntoa
Mark Stapp [Thu, 22 Oct 2020 14:01:20 +0000 (10:01 -0400)]
pimd: replace inet_ntoa

Replace all use of inet_ntoa, using %pI4 or inet_ntoa instead

Signed-off-by: Mark Stapp <mjs@voltanet.io>
3 years agoeigrpd: Tone down warning when command is not implemented yet
Donald Sharp [Wed, 14 Oct 2020 11:23:02 +0000 (07:23 -0400)]
eigrpd: Tone down warning when command is not implemented yet

Currently eigrp has a bunch of commands that are not fully
implemented yet.  Tone down the yang code change of making
these in your face errors to zlog_warns, so the end-user
can not be freaked out by the message.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agolib: Convert inet_ntoa to %pI4
Donatas Abraitis [Sun, 18 Oct 2020 11:21:26 +0000 (14:21 +0300)]
lib: Convert inet_ntoa to %pI4

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
3 years agoMerge pull request #7343 from ton31337/fix/prefix2str_to_pFX
Donald Sharp [Thu, 22 Oct 2020 12:07:57 +0000 (08:07 -0400)]
Merge pull request #7343 from ton31337/fix/prefix2str_to_pFX

:* Convert prefix2str to %pFX

3 years agozebra: Do not delete nhg's when retain_mode is engaged
Donald Sharp [Thu, 22 Oct 2020 12:02:33 +0000 (08:02 -0400)]
zebra: Do not delete nhg's when retain_mode is engaged

When `-r` is specified to zebra, on shutdown we should
not remove any routes from the fib.  This was a problem
with nhg's on shutdown due to their ref-count behavior.

Introduce a methodology where on shutdown we don't mess
with the nexthop groups in the kernel.  That way on
next startup things will be ok.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agoalpine: Remove old docker deps for alpine
Wesley Coakley [Thu, 22 Oct 2020 06:57:38 +0000 (02:57 -0400)]
alpine: Remove old docker deps for alpine

Remove py-ipaddr and ipsec-tools as deps in the Alpine build container,
as these were both Python 2 libraries and are not used here anymore

`ipsec-tools` is also no longer available in Alpine's test repos and was
causing breakage on this builder

Signed-off-by: Wesley Coakley <wcoakley@nvidia.com>
3 years ago:* Convert prefix2str to %pFX
Donatas Abraitis [Sun, 18 Oct 2020 11:33:54 +0000 (14:33 +0300)]
:* Convert prefix2str to %pFX

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
3 years agoMerge pull request #7360 from donaldsharp/eigrp_printing
Donatas Abraitis [Thu, 22 Oct 2020 05:52:13 +0000 (08:52 +0300)]
Merge pull request #7360 from donaldsharp/eigrp_printing

eigrpd: Replace inet_ntoa with %pI4

3 years agotopotests: test aggregate address suppress map
Rafael Zalamena [Sun, 18 Oct 2020 22:19:21 +0000 (19:19 -0300)]
topotests: test aggregate address suppress map

Add test for new aggregate address option: test aggregate address option
without converged routes, then test again with a different route map
with converged routes.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
3 years agodoc: document new aggregate address option
Rafael Zalamena [Sun, 18 Oct 2020 22:18:37 +0000 (19:18 -0300)]
doc: document new aggregate address option

Add documentation for the newly implement aggregate address command.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
3 years agobgpd: aggregate address suppress more specific
Rafael Zalamena [Sun, 18 Oct 2020 22:17:02 +0000 (19:17 -0300)]
bgpd: aggregate address suppress more specific

Add new aggregate-address option to selectively suppress routes based
on route map results.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
3 years agoMerge pull request #7337 from donaldsharp/bgp_process_workqueue
Russ White [Wed, 21 Oct 2020 23:02:19 +0000 (19:02 -0400)]
Merge pull request #7337 from donaldsharp/bgp_process_workqueue

bgpd: Make the process_queue per bgp process

3 years agoeigrpd: Replace inet_ntoa with %pI4
Donald Sharp [Wed, 21 Oct 2020 22:55:09 +0000 (18:55 -0400)]
eigrpd: Replace inet_ntoa with %pI4

Search and destroy the inet_ntoa usage in eigrp

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agobgpd: Make the process_queue per bgp process
Donald Sharp [Sat, 17 Oct 2020 13:43:14 +0000 (09:43 -0400)]
bgpd: Make the process_queue per bgp process

We currently have a global process queue for handling route
updates in bgp.  This is fine, in general, except there are
places and times where we plug the queue for no new work
during certain peer states of bgp update delay.  If we
happen to be processing multiple bgp instances on startup
why do we want to stop processing in vrf A when vrf B
is in a bit of a pickle?

Also this separation will allow us to start forward thinking
about how to fully integrate pthreads into route processing
in bgp.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agoMerge pull request #7353 from AnuradhaKaruppiah/mh-cleanup-fix-1
Donatas Abraitis [Wed, 21 Oct 2020 19:06:36 +0000 (22:06 +0300)]
Merge pull request #7353 from AnuradhaKaruppiah/mh-cleanup-fix-1

bgpd: fix crash in the MH cleanup handling

3 years agoMerge pull request #7350 from qlyoung/improve-bug-report-template
Mark Stapp [Wed, 21 Oct 2020 17:52:41 +0000 (13:52 -0400)]
Merge pull request #7350 from qlyoung/improve-bug-report-template

.github: improve bug report template

3 years agobgpd: fix crash in the MH cleanup handling
Anuradha Karuppiah [Tue, 20 Oct 2020 16:26:51 +0000 (09:26 -0700)]
bgpd: fix crash in the MH cleanup handling

The MH datastructures were being released before the paths that were
referencing them. Fix is to do the MH cleanup last.

The MH finish function has also been stripped down to only do a
datastructure cleanup i.e. avoid sending route updates etc.

Ticket: 31376

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
4 years agoMerge pull request #7276 from donaldsharp/speedup_isis_topotests
Martin Winter [Wed, 21 Oct 2020 11:30:51 +0000 (13:30 +0200)]
Merge pull request #7276 from donaldsharp/speedup_isis_topotests

tests: add `lsp-gen-interval 2` to isis configuration

4 years agoMerge pull request #7356 from sworleys/Revert-NHG-Dependents
Donatas Abraitis [Wed, 21 Oct 2020 03:57:57 +0000 (06:57 +0300)]
Merge pull request #7356 from sworleys/Revert-NHG-Dependents

Revert "zebra: fix NHE dependents backpointer relationship"

4 years agoRevert "zebra: fix NHE dependents backpointer relationship"
Stephen Worley [Tue, 20 Oct 2020 21:11:35 +0000 (17:11 -0400)]
Revert "zebra: fix NHE dependents backpointer relationship"

This reverts commit f9f9466e04ae9625d8bd8dd3346a221e6430b231.

4 years ago.github: improve bug report template
Quentin Young [Tue, 20 Oct 2020 15:42:03 +0000 (11:42 -0400)]
.github: improve bug report template

- Enclose template help text in HTML comments so that it does not show
up in issues
- Add more help text explaining what is requested
- Yell to increase visibility

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
4 years agoMerge pull request #7348 from mjstapp/fix_router_id_lists
Donald Sharp [Tue, 20 Oct 2020 19:53:52 +0000 (15:53 -0400)]
Merge pull request #7348 from mjstapp/fix_router_id_lists

zebra: clean up all router id lists

4 years agoMerge pull request #7206 from ckishimo/fix7086
Russ White [Tue, 20 Oct 2020 13:28:13 +0000 (09:28 -0400)]
Merge pull request #7206 from ckishimo/fix7086

ospfd: flush type 5 when type 7 is removed

4 years agoMerge pull request #7323 from ton31337/fix/inet_ntoa_to_pFX_master
Donald Sharp [Tue, 20 Oct 2020 13:10:24 +0000 (09:10 -0400)]
Merge pull request #7323 from ton31337/fix/inet_ntoa_to_pFX_master

bgpd: Convert inet_ntoa to %pI4

4 years agoMerge pull request #7311 from donaldsharp/table_lock_count
Donatas Abraitis [Tue, 20 Oct 2020 13:04:15 +0000 (16:04 +0300)]
Merge pull request #7311 from donaldsharp/table_lock_count

Abstract rn->lock accessing and cleanup usage to %pFX and %pRN

4 years agozebra: clean up all router id lists
Mark Stapp [Tue, 20 Oct 2020 12:48:12 +0000 (08:48 -0400)]
zebra: clean up all router id lists

Clean up the ipv6 router-id lists associated with a zvrf - these
were being leaked.

Signed-off-by: Mark Stapp <mjs@voltanet.io>