Philippe Guibert [Thu, 19 Dec 2024 13:23:40 +0000 (14:23 +0100)]
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>
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>
Philippe Guibert [Thu, 19 Dec 2024 08:19:12 +0000 (09:19 +0100)]
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>
Philippe Guibert [Thu, 19 Dec 2024 07:58:02 +0000 (08:58 +0100)]
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>
Philippe Guibert [Thu, 19 Dec 2024 07:36:12 +0000 (08:36 +0100)]
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>
Philippe Guibert [Mon, 23 Sep 2024 13:03:15 +0000 (15:03 +0200)]
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>
Philippe Guibert [Mon, 23 Sep 2024 10:01:20 +0000 (12:01 +0200)]
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>
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>
Philippe Guibert [Thu, 19 Sep 2024 16:04:02 +0000 (18:04 +0200)]
bgpd: add 'bmp import-vrf-view' command
Add a configuration command to import BGP information from
another BGP instance. Specifically, it should be possible for
a user to have a BMP instance configured on the default VRF,
and be able to import the VRF information from the other BGP
VRF instances.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Philippe Guibert [Mon, 23 Sep 2024 11:23:34 +0000 (13:23 +0200)]
bgpd: bmp, rename bmp->targets->bgp with peer->bgp
Some BMP actions require to get the bgp instance of the
given peer. Instead of considering that the BGP BMP instance
is the BGP instance of the peer, let us use directly the
peer->bgp pointer.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
bgpd: Use unique value for BGP_NEXTHOP_EVPN_INCOMPLETE flag
This was reused with BGP_NEXTHOP_ULTIMATE by error.
Fixes: 93fd9cbb5022e0c40827cd6d6ef339624a8b5daa ("bgpd: Validate imported routes next-hop that is in a default VRF") Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Jonathan Voss [Fri, 3 Jan 2025 03:19:30 +0000 (03:19 +0000)]
tools: Add missing rpki keyword to vrf in frr-reload
When reloading the following configuration:
```
vrf red
rpki
rpki cache tcp 172.65.0.2 8282 preference 1
exit
exit-vrf
```
frr-reload.py does not properly enter the `rpki` context
within a `vrf`. Because of this, it fails to apply RPKI
configurations.
Chirag Shah [Wed, 1 Nov 2023 05:11:04 +0000 (22:11 -0700)]
zebra:check DAD freeze action before notifying bgp
If Duplicate Address Detection action is freeze
(permanent or definite time means not warn only mode)
then locally duplicate detected MAC delete notification
is not require to inform,
instead ask BGP to sync previous remote MAC entry.
In freeze case local MAC event is not known to BGP,
instead BGP is pointing to remote VTEP for the MAC.
bgpd: bmp, define hook for route distinguisher updates
At startup, if bmp loc-rib is enabled, the peer_id of the
loc-rib per peer header message has the route distinguisher set to 0:0.
Actually, the route distinguisher has been updated after the peer up
message is sent, and the information is not refreshed.
Create a hook API to handle route distinguisher config events: pre and
post configuration. Use that hook in BMP module to send peer down, and
peer up events when necessary.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Philippe Guibert [Wed, 30 Oct 2024 08:45:47 +0000 (09:45 +0100)]
bgpd: bmp, define hook for router-id updates
At startup, if bmp loc-rib is enabled, the peer_id of the
loc-rib per peer header message has the router-id set to 0.0.0.0.
Actually, the router-id has been updated after the peer up
message is sent, and the information is not refreshed.
Create a hook API to handle router id events: withdraw and
updates. Use that hook in BMP module to send peer down, and
peer up events when necessary.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Philippe Guibert [Wed, 18 Dec 2024 15:31:05 +0000 (16:31 +0100)]
topotests: bgp_bmp, add a test to check for bgp vrf peer loc-rib message
Add a test where, when the vrf interface is flapping, a peer down and a
peer up message are sent. This test, when used with ASAN, detects the
memory leak of the open_tx and open_rx messages of the loc-rib.
Refresh the method of updating the SEQ value when reading the peer
messages: only update to the last matching SEQ value.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Philippe Guibert [Tue, 29 Oct 2024 15:20:18 +0000 (16:20 +0100)]
bgpd: fix do re-send post-policy bgp update when not valid
When a BGP listener configured with BMP receives the first BGP
IPv6 update from a connected BGP IPv6 peer, the BMP collector
receives a withdraw post-policy message.
Actually, the BGP update is not valid, and BMP considers it as a
withdraw message. The BGP upate is not valid, because the nexthop
reachability is unknown at the time of reception, and no other
BMP message is sent.
Fix this by re-sending a BMP post update message when nexthop
tracking becomes successfull. Generalise the re-sending of
messages when nexthop tracking changes.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
bgpd: fix warning of compilation when using bgp_trace
The following warning can be seen:
> In file included from ./bgpd/bgp_trace.h:21,
> from bgpd/bgp_io.c:27:
> bgpd/bgp_io.c: In function ‘read_ibuf_work’:
> bgpd/bgp_io.c:202:53: warning: passing argument 1 of ‘lttng_ust_tracepoint_cb_frr_bgp___packet_read’ from incompatible pointer type [-Wincompatible-pointer-types]
> 202 | frrtrace(2, frr_bgp, packet_read, connection->peer, pkt);
> | ~~~~~~~~~~^~~~~~
> | |
> | struct peer *
> bgpd/bgp_io.c:202:9: note: in expansion of macro ‘frrtrace’
> 202 | frrtrace(2, frr_bgp, packet_read, connection->peer, pkt);
> | ^~~~~~~~
> In file included from ./bgpd/bgp_trace.h:21,
> from bgpd/bgp_io.c:27:
> ./bgpd/bgp_trace.h:57:43: note: expected ‘struct peer_connection *’ but argument is of type ‘struct peer *’
> 57 | TP_ARGS(struct peer_connection *, connection, struct stream *, pkt),
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
Use the appropriate connection parameter when calling the trace.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Yaroslav Kholod [Mon, 23 Dec 2024 15:35:12 +0000 (17:35 +0200)]
BGP: Clean address-family config on daemon restart
When stopping and restarting BGP daemon part of the configuration
remains. It should be cleared.
Particulary those are address-family parametes, like: distance,
ead-es-frag, disable-ead-evi-rx, disable-ead-evi-tx.
Jonathan Voss [Tue, 24 Dec 2024 16:32:13 +0000 (16:32 +0000)]
tools: Add missing formats keyword to segment-routing in frr-reload
When reloading the following configuration:
```
segment-routing
srv6
formats
format usid-f3216
wide-local-id-block explicit start 100
exit
!
format uncompressed-f4024
exit
!
exit
!
exit
!
exit
```
frr-reload.py does not properly enter the `formats` context. Because of this,
it fails with an unknown command error when applying new or updating format
configuration.
Christian Hopps [Sun, 24 Nov 2024 08:06:05 +0000 (03:06 -0500)]
tests: enable failure and fix broken tests
This test was not actually failing when the results didn't match. Fail
now. Also fix the tests that are now found to be failing incorrectly
(wrong expected result).
anlan_cs [Sat, 21 Dec 2024 11:29:32 +0000 (19:29 +0800)]
mgmtd: fix compile error
Compile error with `--disable-ripd`:
```
mgmtd/mgmt_be_adapter.c:86:5: error: "HAVE_RIPD" is not defined, evaluates to 0 [-Werror=undef]
86 | #if HAVE_RIPD
| ^~~~~~~~~
```
I have searched the code, there is only three places need to be fixed.