Commit Graph

38268 Commits

Author SHA1 Message Date
Enke Chen
b89e66a3bc bgpd: use igpmetric in bgp_aigp_metric_total()
Use igpmetric from bgp_path_info in bgp_igp_metric_total() to be
consistent with all other cases, e.g., as in bgp_path_info_cmp().

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
2025-01-09 12:02:02 -08:00
Donald Sharp
414bc26bc0 tests: bgp_srv6l3vpn_to_bgp_vrf3 needs more time
The test starts with checking for rib insertion
of routes that may take some time after system
startup to come up.  Under heavy load this may
cause this test to just fail.  Give it more time.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-01-09 13:43:58 -05:00
Louis Scalbert
5100d842f6 lib: remove interface dead code
Remove interface dead code.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-01-09 18:38:28 +01:00
Louis Scalbert
8ccf60921b bgpd: fix crash in displaying json orf prefix-list
bgpd crashes when there is several entries in the prefix-list. No
backtrace is provided because the issue was catched from a code review.

Fixes: 856ca177c4 ("Added json formating support to show-...-neighbors-... bgp commands.")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-01-09 18:35:18 +01:00
Louis Scalbert
b7e843d7e8 bgpd: fix bgp orf prefix-list json prefix
0x<address>FX was displayed instead of the prefix.

Fixes: b219dda129 ("lib: Convert usage of strings to %pFX and %pRN")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-01-09 18:35:18 +01:00
Donald Sharp
97fa24e70b zebra: Fix leaked nhe
During route processing in zebra, Zebra will create a nexthop
group that matches the nexthops passed down from the routing
protocol.  Then Zebra will look to see if it can re-use a
nhe from a previous version of the route entry( say a interface
goes down ).  If Zebra decides to re-use an nhe it was just dropping
the route entry created.  Which led to nexthop group's that had
a refcount of 0 and in some cases these nexthop groups were installed
into the kernel.

Add a bit of code to see if the returned entry is not being used
and it has no reference count and if so, properly dispose of it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-01-09 12:34:50 -05:00
Donald Sharp
b46d3a1a42 tests: bgp_srv6_sid_reachability should give more time
The test starts right in on check_pings with a 10 second
time out.  Any type of delay on startup is going to cause
problems.  Give the first check_ping significant time
for the test to be fully brought up.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-01-09 10:31:07 -05:00
Jafar Al-Gharaibeh
465d286819
Merge pull request #17798 from mjstapp/fix_remove_clear_thread
libs: remove deprecated 'clear thread' cli
2025-01-09 09:01:33 -06:00
Enke Chen
43c5670141 bgpd: apply route-map for aggregate before attribute comparison
Currently when re-evaluating an aggregate route, the full attribute of
the aggregate route is not compared with the existing one in the BGP
table. That can result in unnecessary churns (un-install and then
install) of the aggregate route when a more specific route is added or
deleted, or when the route-map for the aggregate changes. The churn
would impact route installation and route advertisement.

The fix is to apply the route-map for the aggregate first and then
compare the attribute.

Here is an example of the churn:

debug bgp aggregate prefix 5.5.5.0/24
!
route-map set-comm permit 10
 set community 65004:200
!
router bgp 65001
 address-family ipv4 unicast
  redistribute static
  aggregate-address 5.5.5.0/24 route-map set-comm
!

Step 1:
  ip route 5.5.5.1/32 Null0

Jan  8 10:28:49 enke-vm1 bgpd[285786]: [J7PXJ-A7YA2] bgp_aggregate_install: aggregate 5.5.5.0/24, count 1
Jan  8 10:28:49 enke-vm1 bgpd[285786]: [Y444T-HEVNG]   aggregate 5.5.5.0/24: installed

Step 2:
  ip route 5.5.5.2/32 Null0

Jan  8 10:29:03 enke-vm1 bgpd[285786]: [J7PXJ-A7YA2] bgp_aggregate_install: aggregate 5.5.5.0/24, count 2
Jan  8 10:29:03 enke-vm1 bgpd[285786]: [S2EH5-EQSX6]   aggregate 5.5.5.0/24: existing, removed
Jan  8 10:29:03 enke-vm1 bgpd[285786]: [Y444T-HEVNG]   aggregate 5.5.5.0/24: installed
---

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
2025-01-08 17:34:29 -08:00
Donatas Abraitis
929591cdb0 tests: Check if allowas-in works when importing between local VRFs
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-01-08 19:22:27 +02:00
Donatas Abraitis
0dd15189f9 bgpd: Respect allowas-in value from the source VRF's peer
If the peer which has allowas-in enabled and then reimports the routes to another
local VRF, respect that value.

This was working with < 10.2 releases.

Fixes: d4426b62d2 ("bgpd: copy source vrf ASN to leaked route and block loops")

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-01-08 19:16:04 +02:00
Enke Chen
b0f96fc247 Revert "bgpd: Reinstall aggregated routes if using route-maps and it was changed"
This reverts commit ee1986f1b5.

The fix is incomplete, and is no longer needed with the fix that applies
the route-map for an aggregate and then compares the attribute.

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
2025-01-08 09:13:11 -08:00
Donald Sharp
3d7dbcf6c6
Merge pull request #17795 from gromit1811/bugfix_priv_syscaps_alloc
lib: Fix privs syscaps (pset_t) allocation
2025-01-08 10:20:11 -05:00
Mark Stapp
cb119907f0 libs: remove deprecated 'clear thread' cli
Remove a deprecated 'clear thread cpu' command.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-01-08 10:17:51 -05:00
Donald Sharp
068a637a46
Merge pull request #17778 from enkechen-panw/aggr-fix
bgpd: add a debug command for route aggregation
2025-01-08 08:57:54 -05:00
Lou Berger
e2b5eed59f doc: update redhat packaging doc with new options and use of Rocky 8 (Centos 8 is no more)
Signed-off-by: Lou Berger <lberger@labn.net>
2025-01-08 12:49:00 +00:00
Lou Berger
d89f21fc06 redhat: Add option to build pkg without docs and rpki support, allow for different system environments by including all built .so files
Simplify file list by using wildcards to include any built %{_libdir}/frr/modules/*.so and +%{_libdir}/libfrr*.so*

Signed-off-by: Lou Berger <lberger@labn.net>
2025-01-08 12:47:34 +00:00
Martin Buck
59ee9d2a79 lib: Handle call to zlog_5424_cycle() without valid FD properly
In zlog_5424_cycle(), struct zlt_5424 *zlt only points to valid memory when
the passed file descriptor is >= 0 (and passing -1 seems to be a supported
use case). So we shouldn't try to compute the address of its zt member when
zlt is NULL.

Signed-off-by: Martin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
2025-01-08 13:30:40 +01:00
Martin Buck
9951da394a lib: Try to open 5424 log destination when changing log threshold
When changing the log threshold (prio_min) using zlog_5424_apply_meta(), try
to open the log destination using zlog_5424_open() if we haven't done so
before. Without this, we might never open the destination at all, because
when zlog_5424_apply_dst() gets called (which so far was the only initial
caller of zlog_5424_open()), chances are that prio_min is still at its
initial value of ZLOG_DISABLED, causing it to skip the call to
zlog_5424_open().

Signed-off-by: Martin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
2025-01-08 13:30:40 +01:00
Martin Buck
4ed9147d98 lib: Fix privs syscaps (pset_t) allocation
Don't over-allocate syscaps in zcaps2sys(): This is just a single struct
(pset_t) with a count and a pointer to an array of capabilities, not an
array. So only allocate a single pset_t, not num copies of it.

The allocation size of syscaps->caps then needs to be based on the number of
Linux capabilities (count), but that is already handled properly a few lines
below.

Note that this fix is mostly cosmetic and for correctness. There was no
potential for memory corruption, because num is guaranteed to be nonzero. So
at least the one required pset_t was always allocated (but potentially much
more).

Signed-off-by: Martin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
2025-01-08 10:38:56 +01:00
Enke Chen
2a19daa830 bgpd: add debugging command for route aggregation
Add a new debugging command:

  debug bgp aggregate [prefix <A.B.C.D/M|X:X::X:X/M>]

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
2025-01-07 22:52:41 -08:00
Russ White
21fe1f4d83
Merge pull request #17707 from gromit1811/pr16811_rebased
tests: cleanup ospf6 ecmp inter area
2025-01-07 16:14:15 -05:00
Donald Sharp
cc07a4a200
Merge pull request #17772 from LabNConsulting/chopps/fix-oper-walk
improve error handling of operational state walk callback
2025-01-07 13:52:37 -05:00
Donald Sharp
96ab6ae32b
Merge pull request #17781 from LabNConsulting/chopps/fix-keyless-list-query
fix xpath query on keyless list with positional predicate
2025-01-07 13:17:37 -05:00
Donald Sharp
0a52c233d3
Merge pull request #17782 from LabNConsulting/chopps/new-notify-msg-fmt
New YANG notify msg fmt
2025-01-07 13:15:40 -05:00
Donald Sharp
1a7923e7bc
Merge pull request #17783 from LabNConsulting/chopps/new-oper-get-callback
Add new oper state get callback
2025-01-07 13:11:26 -05:00
Russ White
8168dd931d
Merge pull request #17725 from opensourcerouting/fix/full_no_form_for_area-password
isisd: Allow full `no` form for `domain-password` and `area-password`
2025-01-07 09:41:39 -05:00
Russ White
6060d8b347
Merge pull request #17723 from opensourcerouting/fix/bgpd_metric_worse
bgpd: Respect `bgp bestpath missing-as-worst` for `table-map` as well
2025-01-07 09:41:08 -05:00
Russ White
8ed117ae19
Merge pull request #17700 from Andrew-Dickinson/fix-socket-gc
ospfclient: fix crash due to streamwriter garbage collect
2025-01-07 09:38:05 -05:00
Philippe Guibert
9f2932d106 doc: add bmp import-vrf-view on the bmp user guide
Add the bmp import-vrf-view command on the bmp user guide.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-07 15:35:32 +01:00
Philippe Guibert
51cedaa30c topotests: bmp, test syncro for pre/post-policy of imported bgps
Add a test that controls that the configuration of an imported
BGP instance triggers a re-syncronisation.
Ensure that changing an attribute like route distinguisher
triggers also a re-syncronisation.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-07 15:35:32 +01:00
Philippe Guibert
ffdb4cd0f5 bgpd: bmp, handle imported bgp instances in bmp end of rib
Modify the bmp_eor() function to send end of rib messages for each peer
of the current BGP instance.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-07 15:35:32 +01:00
Philippe Guibert
b79574b5c6 bgpd: add sync for monitored afi/safi of imported bgps
If an imported BGP is configured after BGP updates have been
received, then BMP will not detect those updates in the
monitor messages.

Syncronisation is also needed for separate instances.
For each imported bgp instance, syncronisation is re-done
for monitored afi/safis for ALL available instances.
- upon configuring an afi/safi (as previously)
- when configuring an imported view

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-07 15:35:32 +01:00
Philippe Guibert
d34fe66a5d bgpd: rework bmp end of rib processing
Move the end of rib processing code of a given BGP instance in a
separate function. This code prepares the next commit, it avoids
having the following warning:
> WARNING: Too many leading tabs - consider code refactoring

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-07 15:35:32 +01:00
Philippe Guibert
3e05ba06e6 bgpd: fix access to invalid memory zone
> ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f73891cb146 bp 0x7ffca86584c0 sp 0x7ffca8658490 T0)
> ==837617==The signal is caused by a READ memory access.
> ==837617==Hint: address points to the zero page.
>     #0 0x7f73891cb146 in bmp_targets_const_next bgpd/bgp_bmp.c:149
>     #1 0x7f73891cb1a5 in bmp_targets_next bgpd/bgp_bmp.c:149
>     #2 0x7f73891e875a in _bmp_vrf_state_changed_internal bgpd/bgp_bmp.c:3520
>     #3 0x7f73891e8922 in bmp_vrf_itf_state_changed bgpd/bgp_bmp.c:3566
>     #4 0x55e511af8d1b in hook_call_bgp_vrf_status_changed bgpd/bgp_zebra.c:64
>     #5 0x55e511afa304 in bgp_ifp_up bgpd/bgp_zebra.c:234
>     #6 0x7f738981c193 in hook_call_if_up lib/if.c:57
>     #7 0x7f738981d09a in if_up_via_zapi lib/if.c:203
>     #8 0x7f73899d6f54 in zclient_interface_up lib/zclient.c:2671
>     #9 0x7f73899e3e5a in zclient_read lib/zclient.c:4624
>     #10 0x7f738998078d in event_call lib/event.c:1996
>     #11 0x7f7389848933 in frr_run lib/libfrr.c:1232
>     #12 0x55e5117f7ae1 in main bgpd/bgp_main.c:557
>     #13 0x7f7389229d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
>     #14 0x7f7389229e3f in __libc_start_main_impl ../csu/libc-start.c:392
>     #15 0x55e5117f4234 in _start (/usr/lib/frr/bgpd+0x2ec234)

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-07 15:35:32 +01:00
Philippe Guibert
6c7b2abc01 bgpd, topotests: bmp imported bgp, send peer up events when config param changed
When a BGP instance is created or becomes valid, and when a parameter
is updated (router-id, route distinguisher), the peer up messages other
than loc rib peer up messages, are sent. Add a test that controls if
peer down and peer up messages are sent accordingly with correct route
distinguisher values.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-07 15:35:32 +01:00
Philippe Guibert
ca7699f4ae bgpd, topotests: bmp, send peer down when unconfiguring imported vrf
When unconfiguring an imported BGP instance, a peer down
should be sent to notify BMP collector that the BGP instance
is leaving.

Add a test that controls the presence of the peer down loc-rib
message.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-07 15:35:32 +01:00
Philippe Guibert
62891717e3 bgpd, topotests: bmp imported bgp, add loc-rib peer up support when vrf flaps
Add the emission of a loc-rib peer up event for an imported bgp instance
when vrf state changes. Add a test to control in the BMP collector
that the peer up message is the one from that BGP instance.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-07 15:35:31 +01:00
Philippe Guibert
2bd5cd1b81 bgpd, topotests: bmp imported bgp, add loc-rib peer up support when router-id changes
Add the emission of a loc-rib peer up event for an imported bgp instance
at route-id reconfiguration. Add a test to control in the BMP collector
that the peer up message is the one from that BGP instance.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-07 15:35:31 +01:00
Philippe Guibert
ab31e964e4 bgpd, topotests: bmp, add loc-rib peer up event for imported bgp
Add the emission of a loc-rib peer up event for an imported bgp instance
at import-vrf configuration. Add a test to control in the BMP collector
that the peer up message is the one from that BGP instance.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-07 15:35:31 +01:00
Philippe Guibert
b68b4aa70e bgpd: modify bmp_bgp_update_vrf_status() API
The bgpbmp parameter is not used. Instead the bgp pointer, and
the vrf state are used.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-07 15:35:31 +01:00
Philippe Guibert
3e63abfc95 bgpd: bmp, fix memory leak in peer messages
The following memory leak is observed when running bgp_bmp test.

> ==614841==ERROR: LeakSanitizer: detected memory leaks
>
> Direct leak of 81 byte(s) in 1 object(s) allocated from:
>     #0 0x7f0e9f2b4887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
>     #1 0x7f0e9ec771f8 in qmalloc lib/memory.c:101
>     #2 0x7f0e9e5a2f89 in bmp_bgp_peer_vrf bgpd/bgp_bmp.c:2211
>     #3 0x7f0e9e5a31a8 in bmp_bgp_update_vrf_status bgpd/bgp_bmp.c:2247
>     #4 0x7f0e9e5b0325 in bmp_bgp_attribute_updated_instance bgpd/bgp_bmp.c:3476
>     #5 0x7f0e9e5b0661 in bmp_bgp_attribute_updated bgpd/bgp_bmp.c:3526
>     #6 0x7f0e9e5b08ae in bmp_routerid_update bgpd/bgp_bmp.c:3547
>     #7 0x55cdc4bcbd88 in hook_call_bgp_routerid_update bgpd/bgpd.c:89
>     #8 0x55cdc4bccf0b in bgp_router_id_set bgpd/bgpd.c:305
>     #9 0x55cdc4bcd87d in bgp_router_id_zebra_bump bgpd/bgpd.c:393
>     #10 0x55cdc4ba87d5 in bgp_router_id_update bgpd/bgp_zebra.c:99
>     #11 0x7f0e9ede3f0b in zclient_read lib/zclient.c:4626
>     #12 0x7f0e9ed8074d in event_call lib/event.c:1996
>     #13 0x7f0e9ec48933 in frr_run lib/libfrr.c:1232
>     #14 0x55cdc48a9a27 in main bgpd/bgp_main.c:555
>     #15 0x7f0e9e629d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
>
> Direct leak of 81 byte(s) in 1 object(s) allocated from:
>     #0 0x7f0e9f2b4887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
>     #1 0x7f0e9ec771f8 in qmalloc lib/memory.c:101
>     #2 0x7f0e9e5a2ed8 in bmp_bgp_peer_vrf bgpd/bgp_bmp.c:2207
>     #3 0x7f0e9e5a31a8 in bmp_bgp_update_vrf_status bgpd/bgp_bmp.c:2247
>     #4 0x7f0e9e5b0325 in bmp_bgp_attribute_updated_instance bgpd/bgp_bmp.c:3476
>     #5 0x7f0e9e5b0661 in bmp_bgp_attribute_updated bgpd/bgp_bmp.c:3526
>     #6 0x7f0e9e5b08ae in bmp_routerid_update bgpd/bgp_bmp.c:3547
>     #7 0x55cdc4bcbd88 in hook_call_bgp_routerid_update bgpd/bgpd.c:89
>     #8 0x55cdc4bccf0b in bgp_router_id_set bgpd/bgpd.c:305
>     #9 0x55cdc4bcd87d in bgp_router_id_zebra_bump bgpd/bgpd.c:393
>     #10 0x55cdc4ba87d5 in bgp_router_id_update bgpd/bgp_zebra.c:99
>     #11 0x7f0e9ede3f0b in zclient_read lib/zclient.c:4626
>     #12 0x7f0e9ed8074d in event_call lib/event.c:1996
>     #13 0x7f0e9ec48933 in frr_run lib/libfrr.c:1232
>     #14 0x55cdc48a9a27 in main bgpd/bgp_main.c:555
>     #15 0x7f0e9e629d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
>
> Direct leak of 64 byte(s) in 1 object(s) allocated from:
>     #0 0x7f0e9f2b4a57 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
>     #1 0x7f0e9ec77235 in qcalloc lib/memory.c:106
>     #2 0x7f0e9e5a498d in bmp_imported_bgp_get bgpd/bgp_bmp.c:2441
>     #3 0x7f0e9e5acbed in bmp_import_vrf_magic bgpd/bgp_bmp.c:2855
>     #4 0x7f0e9e5a7f97 in bmp_import_vrf bgpd/bgp_bmp_clippy.c:147
>     #5 0x7f0e9ebb1178 in cmd_execute_command_real lib/command.c:1003
>     #6 0x7f0e9ebb1505 in cmd_execute_command lib/command.c:1062
>     #7 0x7f0e9ebb21d7 in cmd_execute lib/command.c:1228
>     #8 0x7f0e9ed90bf0 in vty_command lib/vty.c:626
>     #9 0x7f0e9ed95ad5 in vty_execute lib/vty.c:1389
>     #10 0x7f0e9ed9c01e in vtysh_read lib/vty.c:2408
>     #11 0x7f0e9ed8074d in event_call lib/event.c:1996
>     #12 0x7f0e9ec48933 in frr_run lib/libfrr.c:1232
>     #13 0x55cdc48a9a27 in main bgpd/bgp_main.c:555
>     #14 0x7f0e9e629d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
>
> Direct leak of 6 byte(s) in 1 object(s) allocated from:
>     #0 0x7f0e9f25b9a7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
>     #1 0x7f0e9ec772fa in qstrdup lib/memory.c:118
>     #2 0x55cdc4b57d54 in af_rd_vpn_export_magic bgpd/bgp_vty.c:9814
>     #3 0x55cdc4b288d7 in af_rd_vpn_export bgpd/bgp_vty_clippy.c:3493
>     #4 0x7f0e9ebb1178 in cmd_execute_command_real lib/command.c:1003
>     #5 0x7f0e9ebb1505 in cmd_execute_command lib/command.c:1062
>     #6 0x7f0e9ebb21d7 in cmd_execute lib/command.c:1228
>     #7 0x7f0e9ed90bf0 in vty_command lib/vty.c:626
>     #8 0x7f0e9ed95ad5 in vty_execute lib/vty.c:1389
>     #9 0x7f0e9ed9c01e in vtysh_read lib/vty.c:2408
>     #10 0x7f0e9ed8074d in event_call lib/event.c:1996
>     #11 0x7f0e9ec48933 in frr_run lib/libfrr.c:1232
>     #12 0x55cdc48a9a27 in main bgpd/bgp_main.c:555
>     #13 0x7f0e9e629d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
>
> Indirect leak of 5 byte(s) in 1 object(s) allocated from:
>     #0 0x7f0e9f25b9a7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
>     #1 0x7f0e9ec772fa in qstrdup lib/memory.c:118
>     #2 0x7f0e9e5a49ae in bmp_imported_bgp_get bgpd/bgp_bmp.c:2443
>     #3 0x7f0e9e5acbed in bmp_import_vrf_magic bgpd/bgp_bmp.c:2855
>     #4 0x7f0e9e5a7f97 in bmp_import_vrf bgpd/bgp_bmp_clippy.c:147
>     #5 0x7f0e9ebb1178 in cmd_execute_command_real lib/command.c:1003
>     #6 0x7f0e9ebb1505 in cmd_execute_command lib/command.c:1062
>     #7 0x7f0e9ebb21d7 in cmd_execute lib/command.c:1228
>     #8 0x7f0e9ed90bf0 in vty_command lib/vty.c:626
>     #9 0x7f0e9ed95ad5 in vty_execute lib/vty.c:1389
>     #10 0x7f0e9ed9c01e in vtysh_read lib/vty.c:2408
>     #11 0x7f0e9ed8074d in event_call lib/event.c:1996
>     #12 0x7f0e9ec48933 in frr_run lib/libfrr.c:1232
>     #13 0x55cdc48a9a27 in main bgpd/bgp_main.c:555
>     #14 0x7f0e9e629d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
>
> SUMMARY: AddressSanitizer: 237 byte(s) leaked in 5 allocation(s).

Fix this by freeing the missing memory block that helps building the
open message to send to remote bmp collector.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-07 15:35:31 +01:00
Philippe Guibert
f52e963b98 topotests: bgp_bmp, add test for import-vrf-view service
Add a test with a new peer defined in a VRF, and where
the BGP updates are imported in the BMP instance of the
default BGP instance.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-07 15:35:31 +01:00
Philippe Guibert
5fda10f4b8 bgpd: bmp, handle imported bgp instances for bmp statistics
Only the BMP statistics of the current BGP instance are handled.
Extend the transmission of BMP statistics for imported BGP instances.
-  Separate the bmp_stats() function in two, and pass the bgp
instance to process its bgp peers, as a separate parameter.
- Pass the BGP peers from imported instances as parameter

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-07 15:35:31 +01:00
Philippe Guibert
841ae62a89 bgpd: bmp, handle imported bgp instances in bmp_send_peerup()
When a BMP target comes up, only the peer up events of the
current BGP instance are sent.
- Apply the peer up event for external peers that are imported
by the BMP target.
- handle the peer up event when an imported vrf is
configured in a target.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-07 15:35:31 +01:00
Philippe Guibert
b1ebe54b29 bgpd: bmp, handle imported bgp instances in bmp_mirror
Modify the bmp_mirror() function to export the route update information
to all BMP instances importing it.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-07 15:35:31 +01:00
Philippe Guibert
ee605d80ab bgpd: bmp, handle imported bgp instances in bmp_process
Modify the bmp_process() function to export the route update information
to all BMP instances importing it.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-07 15:35:31 +01:00
Philippe Guibert
f8a6933111 bgpd: bmp, handle imported bgp instances for peer up/down events
Only the peer transition events of the local BGP instance where BMP
is configured, were handled.
Add the support for peers from imported BGP instances:
- Add an internal API bmp_send_bt() function to handle stream
emission per bmp target
- Modify the BMP peer transition code to export the peer status
notifications to all BMP instances importing it.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-07 15:35:31 +01:00
Philippe Guibert
c032d53255 bgpd: bmp, handle imported bgp instances for route updates
Upon route update, the list of available BGP instances that
import the BGP instance where this updates comes from, is checked.

For each eligible BGP instance, the route update is sent.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-07 15:35:31 +01:00
Philippe Guibert
c2c95b29ba bgpd: bmp, rework the bmp_route_update() function
Separate the bmp_route_update() function in two, by passing
the bgpbmp structure to the internal function instead of
the bgp instance.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-07 15:35:31 +01:00