]> git.puffer.fish Git - matthieu/frr.git/log
matthieu/frr.git
3 months agobgpd: rework bmp end of rib processing
Philippe Guibert [Mon, 16 Dec 2024 11:12:53 +0000 (12:12 +0100)]
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>
3 months agobgpd: fix access to invalid memory zone
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>
3 months agobgpd, topotests: bmp imported bgp, send peer up events when config param changed
Philippe Guibert [Mon, 2 Dec 2024 14:23:56 +0000 (15:23 +0100)]
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>
3 months agobgpd, topotests: bmp, send peer down when unconfiguring imported vrf
Philippe Guibert [Tue, 12 Nov 2024 07:46:24 +0000 (08:46 +0100)]
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>
3 months agobgpd, topotests: bmp imported bgp, add loc-rib peer up support when vrf flaps
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>
3 months agobgpd, topotests: bmp imported bgp, add loc-rib peer up support when router-id changes
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>
3 months agobgpd, topotests: bmp, add loc-rib peer up event for imported bgp
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>
3 months agobgpd: modify bmp_bgp_update_vrf_status() API
Philippe Guibert [Thu, 7 Nov 2024 09:30:03 +0000 (10:30 +0100)]
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>
3 months agobgpd: bmp, fix memory leak in peer messages
Philippe Guibert [Tue, 17 Dec 2024 17:13:59 +0000 (18:13 +0100)]
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>
3 months agotopotests: bgp_bmp, add test for import-vrf-view service
Philippe Guibert [Mon, 28 Oct 2024 17:52:58 +0000 (18:52 +0100)]
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>
3 months agobgpd: bmp, handle imported bgp instances for bmp statistics
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>
3 months agobgpd: bmp, handle imported bgp instances in bmp_send_peerup()
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>
3 months agobgpd: bmp, handle imported bgp instances in bmp_mirror
Philippe Guibert [Fri, 20 Sep 2024 14:50:07 +0000 (16:50 +0200)]
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>
3 months agobgpd: bmp, handle imported bgp instances in bmp_process
Philippe Guibert [Fri, 20 Sep 2024 11:47:17 +0000 (13:47 +0200)]
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>
3 months agobgpd: bmp, handle imported bgp instances for peer up/down events
Philippe Guibert [Thu, 7 Nov 2024 13:28:39 +0000 (14:28 +0100)]
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>
3 months agobgpd: bmp, handle imported bgp instances for route updates
Philippe Guibert [Fri, 20 Sep 2024 06:47:56 +0000 (08:47 +0200)]
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>
3 months agobgpd: bmp, rework the bmp_route_update() function
Philippe Guibert [Thu, 19 Sep 2024 16:35:50 +0000 (18:35 +0200)]
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>
3 months agobgpd: add 'bmp import-vrf-view' command
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>
3 months agobgpd: bmp, rename bmp->targets->bgp with peer->bgp
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>
3 months agoMerge pull request #17733 from pguibert6WIND/bmp_event_changes
Russ White [Tue, 7 Jan 2025 14:06:43 +0000 (09:06 -0500)]
Merge pull request #17733 from pguibert6WIND/bmp_event_changes

BMP handling of BGP configuration changes

3 months agoMerge pull request #17771 from opensourcerouting/fix/show_ifindex_bgp
Russ White [Tue, 7 Jan 2025 14:03:33 +0000 (09:03 -0500)]
Merge pull request #17771 from opensourcerouting/fix/show_ifindex_bgp

bgpd: Show ifindex for every BGP nexthop cache entry

3 months agoMerge pull request #17773 from LabNConsulting/chopps/more-oper-test-fix
Russ White [Tue, 7 Jan 2025 14:02:41 +0000 (09:02 -0500)]
Merge pull request #17773 from LabNConsulting/chopps/more-oper-test-fix

tests: improve test reliability

3 months agoMerge pull request #17774 from famfo/doc/alpine
Russ White [Tue, 7 Jan 2025 14:01:29 +0000 (09:01 -0500)]
Merge pull request #17774 from famfo/doc/alpine

doc: fix building for alpine package path

3 months agoMerge pull request #17779 from anlancs/ospfd/fix-wrong-check-summary
Russ White [Tue, 7 Jan 2025 13:56:36 +0000 (08:56 -0500)]
Merge pull request #17779 from anlancs/ospfd/fix-wrong-check-summary

ospfd: fix wrong check for two commands

3 months agoMerge pull request #17667 from opensourcerouting/fix/withdraw_routes_regarless_of_coa...
Russ White [Tue, 7 Jan 2025 13:54:52 +0000 (08:54 -0500)]
Merge pull request #17667 from opensourcerouting/fix/withdraw_routes_regarless_of_coalescing_timer_to_expire_path_info_unusable

bgpd: Withdraw routes without waiting for the coalescing timer to expire

3 months agoMerge pull request #17474 from sougata-github-nvidia/rib_ip_protocol_cleanup
Russ White [Tue, 7 Jan 2025 13:45:07 +0000 (08:45 -0500)]
Merge pull request #17474 from sougata-github-nvidia/rib_ip_protocol_cleanup

zebra: Fix ip protocol route-map issue.

3 months agoMerge pull request #17431 from krishna-samy/bgpd_json_commits
Russ White [Tue, 7 Jan 2025 13:43:55 +0000 (08:43 -0500)]
Merge pull request #17431 from krishna-samy/bgpd_json_commits

bgpd: show json output changes to optimize various show commands

3 months agoMerge pull request #17780 from enkechen-panw/allowas-fix
Donatas Abraitis [Tue, 7 Jan 2025 11:13:36 +0000 (13:13 +0200)]
Merge pull request #17780 from enkechen-panw/allowas-fix

bgpd: fix a bug in peer_allowas_in_set()

3 months agobgpd: fix a bug in peer_allowas_in_set()
Enke Chen [Tue, 7 Jan 2025 05:01:14 +0000 (21:01 -0800)]
bgpd: fix a bug in peer_allowas_in_set()

Fix a bug in peer_allowas_in_set() so that the config takes effect
for peer-group members.

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
3 months agoospfd: fix wrong check for two commands
anlan_cs [Tue, 7 Jan 2025 02:55:02 +0000 (10:55 +0800)]
ospfd: fix wrong check for two commands

The users would know the failure of some case for the two commands, just
return the error ```CMD_WARNING_CONFIG_FAILED```.

Signed-off-by: anlan_cs <anlan_cs@126.com>
3 months agoMerge pull request #17770 from opensourcerouting/fix/BGP_NEXTHOP_EVPN_INCOMPLETE
Donald Sharp [Mon, 6 Jan 2025 18:25:02 +0000 (13:25 -0500)]
Merge pull request #17770 from opensourcerouting/fix/BGP_NEXTHOP_EVPN_INCOMPLETE

bgpd: Use unique value for BGP_NEXTHOP_EVPN_INCOMPLETE flag

3 months agodoc: fix building-for-alpine package path
famfo [Mon, 6 Jan 2025 15:23:41 +0000 (16:23 +0100)]
doc: fix building-for-alpine package path

Signed-off-by: famfo <famfo@famfo.xyz>
3 months agotests: improve test reliability
Christian Hopps [Sun, 24 Nov 2024 08:06:05 +0000 (03:06 -0500)]
tests: improve test reliability

Test for presence of IPv6 kernel routes too.

Signed-off-by: Christian Hopps <chopps@labn.net>
3 months agobgpd: Show ifindex for every BGP nexthop cache entry
Donatas Abraitis [Sun, 5 Jan 2025 19:56:44 +0000 (21:56 +0200)]
bgpd: Show ifindex for every BGP nexthop cache entry

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
3 months agobgpd: Use unique value for BGP_NEXTHOP_EVPN_INCOMPLETE flag
Donatas Abraitis [Sun, 5 Jan 2025 19:42:18 +0000 (21:42 +0200)]
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>
3 months agozebra: Fix ip protocol route-map issue.
Sougata Barik [Wed, 30 Oct 2024 09:30:32 +0000 (02:30 -0700)]
zebra: Fix ip protocol route-map issue.

"ip/ipv6 protocol any route-map <route map>" cli is setting
wrong route type ( ZEBRA_ROUTE_MAX ), It should set route type
ZEBRA_ROUTE_ALL.

Ticket: #4101560

Signed-off-by: Sougata Barik <sougatab@nvidia.com>
3 months agoMerge pull request #17752 from raja-rajasekar/rajasekarr/comp_issue
Jafar Al-Gharaibeh [Mon, 6 Jan 2025 02:15:20 +0000 (20:15 -0600)]
Merge pull request #17752 from raja-rajasekar/rajasekarr/comp_issue

zebra: fix dpdk compilation error

3 months agoMerge pull request #17750 from jvoss/vrf_rpki
Donatas Abraitis [Sat, 4 Jan 2025 11:52:40 +0000 (13:52 +0200)]
Merge pull request #17750 from jvoss/vrf_rpki

tools: Add missing rpki keyword to vrf in frr-reload

3 months agoMerge pull request #17715 from ykholod/master-17413-1
Donatas Abraitis [Sat, 4 Jan 2025 11:51:03 +0000 (13:51 +0200)]
Merge pull request #17715 from ykholod/master-17413-1

babel: Clean babel related config on daemon stop

3 months agoMerge pull request #17762 from anlancs/fix/ospf-minor-word
Donatas Abraitis [Sat, 4 Jan 2025 11:49:22 +0000 (13:49 +0200)]
Merge pull request #17762 from anlancs/fix/ospf-minor-word

ospfd: Correct one word

3 months agozebra: fix dpdk compilation error
Rajasekar Raja [Fri, 3 Jan 2025 07:15:12 +0000 (23:15 -0800)]
zebra: fix dpdk compilation error

Fixing compilation error in a switch statement case

Fixes :aa4786642c9a65c282d0fd5247a35b0f14fa1c3c

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
3 months agoospfd: Correct one word
anlan_cs [Fri, 3 Jan 2025 14:55:40 +0000 (22:55 +0800)]
ospfd: Correct one word

Signed-off-by: anlan_cs <anlan_cs@126.com>
3 months agoMerge pull request #17732 from opensourcerouting/fix/isisd_detail_json
Mark Stapp [Fri, 3 Jan 2025 12:37:05 +0000 (07:37 -0500)]
Merge pull request #17732 from opensourcerouting/fix/isisd_detail_json

isisd: Show correct level information for `show isis interface detail json`

3 months agoMerge pull request #17737 from chiragshah6/fdev7
Donatas Abraitis [Fri, 3 Jan 2025 07:34:54 +0000 (09:34 +0200)]
Merge pull request #17737 from chiragshah6/fdev7

zebra:check DAD freeze action before notifying bgp

3 months agotools: Add missing rpki keyword to vrf in frr-reload
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.

Signed-off-by: Jonathan Voss <jvoss@onvox.net>
3 months agoMerge pull request #17726 from guoguojia2021/static_fix
Donatas Abraitis [Thu, 2 Jan 2025 11:22:54 +0000 (13:22 +0200)]
Merge pull request #17726 from guoguojia2021/static_fix

staticd: Reduce the frequency of adding routes

3 months agobabel: Clean babel related config on daemon stop
Yaroslav Kholod [Mon, 23 Dec 2024 11:06:57 +0000 (13:06 +0200)]
babel: Clean babel related config on daemon stop

When deactivating babel no router babel and later re-enabling it router babel the previous configuration is still in place.

Steps to reproduce:

    Enable babel
    Configure babel
    Disable babel with "no router babel"
    Verify config

Expected correct behavior: No config present

Signed-off-by: Yaroslav Kholod <y.kholod@vyos.io>
3 months agoMerge pull request #17716 from ykholod/master-17463
Donatas Abraitis [Wed, 1 Jan 2025 19:16:39 +0000 (21:16 +0200)]
Merge pull request #17716 from ykholod/master-17463

bgpd: Clean address-family config on daemon restart

3 months agoMerge pull request #17728 from dmytroshytyi-6WIND/bgp_rpki_state
Donatas Abraitis [Wed, 1 Jan 2025 19:15:42 +0000 (21:15 +0200)]
Merge pull request #17728 from dmytroshytyi-6WIND/bgp_rpki_state

bgpd: add rpki current state

3 months agoMerge pull request #17731 from raja-rajasekar/rajasekarr/stale_nhg_link_flap_4200788
Donatas Abraitis [Tue, 31 Dec 2024 13:39:40 +0000 (15:39 +0200)]
Merge pull request #17731 from raja-rajasekar/rajasekarr/stale_nhg_link_flap_4200788

zebra: Fix resetting valid flags for NHG dependents

3 months agoMerge pull request #17719 from jvoss/srv6_format
Donatas Abraitis [Tue, 31 Dec 2024 13:33:21 +0000 (15:33 +0200)]
Merge pull request #17719 from jvoss/srv6_format

tools: Add missing formats keyword to segment-routing in frr-reload

3 months agozebra:check DAD freeze action before notifying bgp
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.

Ticket: #3652383
Issue: 3652383

Signed-off-by: Chirag Shah <chirag@nvidia.com>
3 months agozebra: Fix resetting valid flags for NHG dependents
Donald Sharp [Sun, 29 Dec 2024 06:40:37 +0000 (22:40 -0800)]
zebra: Fix resetting valid flags for NHG dependents

Upon if_down, we don't reset the valid flag for dependents
and unset the INSTALLED flag.

So when its time for the NHG to be deleted (routes dereferenced),
zebra deletes it since refcnt goes to 0, but stale NHG remains in kernel.

Ticket :#4200788

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
3 months agotopotests: bgp_bmp, add peer message test when RD changes
Philippe Guibert [Mon, 30 Dec 2024 09:41:32 +0000 (10:41 +0100)]
topotests: bgp_bmp, add peer message test when RD changes

Add a test to control the peer up and down message sent when the route
distinguisher is updated.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
3 months agotopotests: bmp_collector, fix display peer distinguisher IP:AS2B
Philippe Guibert [Tue, 3 Dec 2024 07:30:54 +0000 (08:30 +0100)]
topotests: bmp_collector, fix display peer distinguisher IP:AS2B

The peer distinguisher format was badly displayed when a per peer
header is sent with an IP:AS2B format.

>  {"peer_type": "loc-rib instance", "is_filtered": false, "policy": "loc-rib",
> "peer_distinguisher": "None:2", ...

The IP header is incorrectly read. Fix it.

> {"peer_type": "loc-rib instance", "is_filtered": false, "policy": "loc-rib",
> "peer_distinguisher": "3.3.3.5:2", ...

Fixes: 875511c46676 ("topotests: add basic bmp collector")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
3 months agotopotests: bgp_bmp, add peer up message test when router-id changes
Philippe Guibert [Thu, 19 Dec 2024 08:01:12 +0000 (09:01 +0100)]
topotests: bgp_bmp, add peer up message test when router-id changes

Add a test to control the value of the peer bgp id of loc-rib peer up
messages when the bgp router-id is reconfigured.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
3 months agobgpd: bmp, define hook for route distinguisher updates
Philippe Guibert [Sun, 3 Nov 2024 21:44:55 +0000 (22:44 +0100)]
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>
3 months agobgpd: bmp, define hook for router-id updates
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>
3 months agobgpd: bmp_route_update, replace bgp_bmp_get with bgp_bmp_find
Philippe Guibert [Tue, 29 Oct 2024 21:28:01 +0000 (22:28 +0100)]
bgpd: bmp_route_update, replace bgp_bmp_get with bgp_bmp_find

There is no need to create the bgp bmp instance, while there
is no bmp target to send data to.
Rewrite the code by using bgp_bmp_find() API instead.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
3 months agotopotests: bgp_bmp, add a test to check for bgp vrf peer loc-rib message
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>
3 months agobgpd: fix memory leak when updating peer up loc rib events
Philippe Guibert [Wed, 18 Dec 2024 15:04:06 +0000 (16:04 +0100)]
bgpd: fix memory leak when updating peer up loc rib events

The following memory leak can be observed when turning off and on the
BGP vrf interface.

> ==706056==ERROR: LeakSanitizer: detected memory leaks
>
> Direct leak of 78 byte(s) in 1 object(s) allocated from:
>     #0 0x7fbf5f6b4887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
>     #1 0x7fbf5f0771f8 in qmalloc lib/memory.c:101
>     #2 0x7fbf5bdde610 in bmp_bgp_peer_vrf bgpd/bgp_bmp.c:2042
>     #3 0x7fbf5bdde8aa in bmp_bgp_update_vrf_status bgpd/bgp_bmp.c:2079
>     #4 0x7fbf5bdeaa1c in bmp_vrf_itf_state_changed bgpd/bgp_bmp.c:3204
>     #5 0x562740f0d83f in hook_call_bgp_vrf_status_changed bgpd/bgp_zebra.c:64
>     #6 0x562740f0ee28 in bgp_ifp_up bgpd/bgp_zebra.c:234
>     #7 0x7fbf5f01c193 in hook_call_if_up lib/if.c:57
>     #8 0x7fbf5f01d09a in if_up_via_zapi lib/if.c:203
>     #9 0x7fbf5f1d6f54 in zclient_interface_up lib/zclient.c:2671
>     #10 0x7fbf5f1e3e5a in zclient_read lib/zclient.c:4624
>     #11 0x7fbf5f18078d in event_call lib/event.c:1996
>     #12 0x7fbf5f048933 in frr_run lib/libfrr.c:1232
>     #13 0x562740c0cae1 in main bgpd/bgp_main.c:557
>     #14 0x7fbf5ea29d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
>
> Direct leak of 78 byte(s) in 1 object(s) allocated from:
>     #0 0x7fbf5f6b4887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
>     #1 0x7fbf5f0771f8 in qmalloc lib/memory.c:101
>     #2 0x7fbf5bdde610 in bmp_bgp_peer_vrf bgpd/bgp_bmp.c:2042
>     #3 0x7fbf5bdde8aa in bmp_bgp_update_vrf_status bgpd/bgp_bmp.c:2079
>     #4 0x7fbf5bdd4839 in bmp_send_peerup_vrf bgpd/bgp_bmp.c:627
>     #5 0x7fbf5bddb0d3 in bmp_wrfill bgpd/bgp_bmp.c:1590
>     #6 0x7fbf5f10841f in pullwr_run lib/pullwr.c:197
>     #7 0x7fbf5f18078d in event_call lib/event.c:1996
>     #8 0x7fbf5f048933 in frr_run lib/libfrr.c:1232
>     #9 0x562740c0cae1 in main bgpd/bgp_main.c:557
>     #10 0x7fbf5ea29d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Fix this by freeing the previous open_tx and open_rx contexts before
setting up the new one. Also at deletion of peer, free the open_rx
context.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
3 months agobgpd: fix do re-send post-policy bgp update when not valid
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.

> {"peer_type": "route distinguisher instance", "policy": "post-policy",
> "ipv6": true, "peer_ip": "192:167::3", "peer_distinguisher": "444:1",
> "peer_asn": 65501, "peer_bgp_id": "192.168.1.3", "timestamp":
> "2024-10-29 11:44:47.111962", "bmp_log_type": "withdraw", "afi": 2,
> "safi": 1, "ip_prefix": "2001::1125/128", "seq": 22}
> {"peer_type": "route distinguisher instance", "policy": "pre-policy",
> "ipv6": true, "peer_ip": "192:167::3", "peer_distinguisher": "444:1",
> "peer_asn": 65501, "peer_bgp_id": "192.168.1.3", "timestamp":
> "2024-10-29 11:44:47.111963", "bmp_log_type": "update", "origin":
> "IGP", "as_path": "", "afi": 2, "safi": 1, "nxhp_ip": "192:167::3",
> "nxhp_link-local": "fe80::7063:d8ff:fedb:9e11", "ip_prefix": "2001::1125/128", "seq": 23}

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>
3 months agobgpd: fix warning of compilation when using bgp_trace
Philippe Guibert [Fri, 8 Nov 2024 08:48:11 +0000 (09:48 +0100)]
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>
3 months agobgpd: bmp, fix address sanitizer issue
Philippe Guibert [Tue, 29 Oct 2024 21:24:47 +0000 (22:24 +0100)]
bgpd: bmp, fix address sanitizer issue

The following ASAN error can be seen.

> ERROR: AddressSanitizer: attempting to call malloc_usable_size() for pointer which is not owned: 0x608000036c20
>     #0 0x7f3d7a4b5425 in __interceptor_malloc_usable_size ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:198
>     #1 0x7f3d7a426a16 in __sanitizer::BufferedStackTrace::Unwind(unsigned long, unsigned long, void*, bool, unsigned int) ../../../../src/libsanitizer/sanitizer_common
> /sanitizer_stacktrace.h:122
>     #2 0x7f3d7a426a16 in __asan::asan_malloc_usable_size(void const*, unsigned long, unsigned long) ../../../../src/libsanitizer/asan/asan_allocator.cpp:1074
>     #3 0x7f3d7a03f330 in mt_count_free lib/memory.c:78
>     #4 0x7f3d7a03f330 in qfree lib/memory.c:130
>     #5 0x7f3d76ccf89b in bmp_peer_status_changed bgpd/bgp_bmp.c:982
>     #6 0x560ae2aa6a94 in hook_call_peer_status_changed bgpd/bgp_fsm.c:47
>     #7 0x560ae2aa6a94 in bgp_fsm_change_status bgpd/bgp_fsm.c:1287
>     #8 0x560ae2c4f2e5 in peer_delete bgpd/bgpd.c:2777
>     #9 0x560ae2c58d24 in bgp_delete bgpd/bgpd.c:4140
>     #10 0x560ae2bbb47e in no_router_bgp bgpd/bgp_vty.c:1764
>     #11 0x7f3d79fb74ed in cmd_execute_command_real lib/command.c:1003
>     #12 0x7f3d79fb78a3 in cmd_execute_command lib/command.c:1062
>     #13 0x7f3d79fb7e03 in cmd_execute lib/command.c:1228
>     #14 0x7f3d7a107b53 in vty_command lib/vty.c:625
>     #15 0x7f3d7a109902 in vty_execute lib/vty.c:1388
>     #16 0x7f3d7a10cc32 in vtysh_read lib/vty.c:2400
>     #17 0x7f3d7a0f848b in event_call lib/event.c:2019
>     #18 0x7f3d7a01e627 in frr_run lib/libfrr.c:1232
>     #19 0x560ae29e0037 in main bgpd/bgp_main.c:555
>     #20 0x7f3d79a29d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
>     #21 0x7f3d79a29e3f in __libc_start_main_impl ../csu/libc-start.c:392
>     #22 0x560ae29e4ef4 in _start (/usr/lib/frr/bgpd+0x2eeef4)
>
> 0x608000036c20 is located 0 bytes inside of 81-byte region [0x608000036c20,0x608000036c71)
> freed by thread T0 here:
>     #0 0x7f3d7a4b4537 in __interceptor_free ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:127
>     #1 0x7f3d76ccf85f in bmp_peer_status_changed bgpd/bgp_bmp.c:981
>     #2 0x560ae2aa6a94 in hook_call_peer_status_changed bgpd/bgp_fsm.c:47
>     #3 0x560ae2aa6a94 in bgp_fsm_change_status bgpd/bgp_fsm.c:1287
>     #4 0x560ae2c4f2e5 in peer_delete bgpd/bgpd.c:2777
>     #5 0x560ae2c58d24 in bgp_delete bgpd/bgpd.c:4140
>     #6 0x560ae2bbb47e in no_router_bgp bgpd/bgp_vty.c:1764
>     #7 0x7f3d79fb74ed in cmd_execute_command_real lib/command.c:1003
>     #8 0x7f3d79fb78a3 in cmd_execute_command lib/command.c:1062
>     #9 0x7f3d79fb7e03 in cmd_execute lib/command.c:1228
>     #10 0x7f3d7a107b53 in vty_command lib/vty.c:625
>     #11 0x7f3d7a109902 in vty_execute lib/vty.c:1388
>     #12 0x7f3d7a10cc32 in vtysh_read lib/vty.c:2400
>     #13 0x7f3d7a0f848b in event_call lib/event.c:2019
>     #14 0x7f3d7a01e627 in frr_run lib/libfrr.c:1232
>     #15 0x560ae29e0037 in main bgpd/bgp_main.c:555
>     #16 0x7f3d79a29d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
>
> previously allocated by thread T0 here:
>     #0 0x7f3d7a4b4887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
>     #1 0x7f3d7a03f0e9 in qmalloc lib/memory.c:101
>     #2 0x7f3d76cd0166 in bmp_bgp_peer_vrf bgpd/bgp_bmp.c:2194
>     #3 0x7f3d76cd0166 in bmp_bgp_update_vrf_status bgpd/bgp_bmp.c:2236
>     #4 0x7f3d76cd29b8 in bmp_vrf_state_changed bgpd/bgp_bmp.c:3479
>     #5 0x560ae2c45b34 in hook_call_bgp_instance_state bgpd/bgpd.c:88
>     #6 0x560ae2c4d158 in bgp_instance_up bgpd/bgpd.c:3936
>     #7 0x560ae29e5ed1 in bgp_vrf_enable bgpd/bgp_main.c:299
>     #8 0x7f3d7a0ff8b1 in vrf_enable lib/vrf.c:286
>     #9 0x7f3d7a0ff8b1 in vrf_enable lib/vrf.c:275
>     #10 0x7f3d7a12ab66 in zclient_vrf_add lib/zclient.c:2561
>     #11 0x7f3d7a12eb43 in zclient_read lib/zclient.c:4624
>     #12 0x7f3d7a0f848b in event_call lib/event.c:2019
>     #13 0x7f3d7a01e627 in frr_run lib/libfrr.c:1232
>     #14 0x560ae29e0037 in main bgpd/bgp_main.c:555
>     #15 0x7f3d79a29d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
3 months agoMerge pull request #17734 from opensourcerouting/fix/show_discarded_withdrawn_routes
Donald Sharp [Mon, 30 Dec 2024 13:20:25 +0000 (08:20 -0500)]
Merge pull request #17734 from opensourcerouting/fix/show_discarded_withdrawn_routes

bgpd: Show prefix-related stats per neighbor

3 months agoBGP: Clean address-family config on daemon restart
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.

Signed-off-by: Yaroslav Kholod <y.kholod@vyos.io>
3 months agotests: Check prefix statistics for path-attribute discard/withdraw
Donatas Abraitis [Mon, 30 Dec 2024 10:27:00 +0000 (12:27 +0200)]
tests: Check prefix statistics for path-attribute discard/withdraw

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
3 months agobgpd: Show prefix-related stats per neighbor
Donatas Abraitis [Mon, 30 Dec 2024 10:26:19 +0000 (12:26 +0200)]
bgpd: Show prefix-related stats per neighbor

E.g.:

```
  Prefix statistics:
    Inbound filtered: 0
    AS-PATH loop: 0
    Originator loop: 0
    Cluster loop: 0
    Invalid next-hop: 0
    Withdrawn: 0
    Attributes discarded: 3
```

JSON:

```
    "prefixStats":{
      "inboundFiltered":0,
      "aspathLoop":0,
      "originatorLoop":0,
      "clusterLoop":0,
      "invalidNextHop":0,
      "withdrawn":0,
      "attributesDiscarded":3
    },
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
3 months agotests: add bgp rpki topo1 rpkiValidationState
Dmytro Shytyi [Thu, 26 Dec 2024 13:22:41 +0000 (14:22 +0100)]
tests: add bgp rpki topo1 rpkiValidationState

Topotest to verify the next key-value "rpkiValidationState": "valid"

Signed-off-by: Dmytro Shytyi <dmytro.shytyi@6wind.com>
3 months agoisisd: Show correct level information for `show isis interface detail json`
Donatas Abraitis [Mon, 30 Dec 2024 08:31:44 +0000 (10:31 +0200)]
isisd: Show correct level information for `show isis interface detail json`

Having this configuration:

```
!
interface r1-eth0
 ip address 10.0.0.1/30
 ip router isis 1
 isis priority 44 level-1
 isis priority 88 level-2
 isis csnp-interval 90 level-1
 isis csnp-interval 99 level-2
 isis psnp-interval 70 level-1
 isis psnp-interval 50 level-2
 isis hello-interval level-1 120
 isis hello-interval level-2 150

!
interface r1-eth1
 ip address 10.0.0.10/30
 ip router isis 1
!
interface lo
 ip address 192.0.2.1/32
 ip router isis 1
 isis passive
!
router isis 1
net 49.0000.0000.0000.0001.00
 metric-style wide
```

Produces:

```
{
 "areas":[
   {
     "area":"1",
     "circuits":[
       {
         "circuit":2,
         "interface":{
           "name":"r1-eth0",
           "state":"Up",
           "is-passive":"active",
           "circuit-id":"0x2",
           "type":"lan",
           "level":"L1L2",
           "snpa":"6e28.9c92.da5e",
           "levels":[
             {
               "level":"L1",
               "metric":10,
               "active-neighbors":1,
               "hello-interval":120,
               "holddown":{
                 "count":10,
                 "pad":"yes"
               },
               "cnsp-interval":90,
               "psnp-interval":70,
               "lan":{
                 "priority":44,
                 "is-dis":"no"
               }
             },
             {
               "level":"L2",
               "metric":10,
               "active-neighbors":1,
               "hello-interval":120, <<<<<<<<<<<<<<<<<<
               "holddown":{
                 "count":10,
                 "pad":"yes"
               },
               "cnsp-interval":90, <<<<<<<<<<<<<<<<<<
               "psnp-interval":70, <<<<<<<<<<<<<<<<<<
               "lan":{
                 "priority":44, <<<<<<<<<<<<<<<<<<
                 "is-dis":"no"
               }
             }
           ],
...
```

Fixes: 9fee4d4c6038ef6b14e9f509d6b04d189660c4cd ("isisd: Add json to show isis interface command.")
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
4 months agobgpd: display rpki state in 'show bgp ipvX detail'
Philippe Guibert [Fri, 20 Dec 2024 07:47:04 +0000 (08:47 +0100)]
bgpd: display rpki state in 'show bgp ipvX detail'

The rpki current state was ignored when calling for the 'show bgp ipvX
detail' command. Handle the support for this, with json support too.

> "rpkiValidationState" : "valid",
> "rpkiValidationState" : "invalid",
> "rpkiValidationState" : "not used",
> "rpkiValidationState" : "not found",

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Dmytro Shytyi <dmytro.shytyi@6wind.com>
4 months agoMerge pull request #17720 from jvoss/srv6_cli
Igor Ryzhov [Fri, 27 Dec 2024 11:17:03 +0000 (13:17 +0200)]
Merge pull request #17720 from jvoss/srv6_cli

isisd: fix srv6 exit statements

4 months agostaticd: Reduce the frequency of adding routes
guozhongfeng.gzf [Fri, 27 Dec 2024 04:16:17 +0000 (12:16 +0800)]
staticd: Reduce the frequency of adding routes

Signed-off-by: guozhongfeng.gzf <guozhongfeng.gzf@alibaba-inc.com>
4 months agoMerge pull request #17718 from cscarpitta/fix/fix-srv6-static-route-pytestmark
Donatas Abraitis [Thu, 26 Dec 2024 12:17:21 +0000 (14:17 +0200)]
Merge pull request #17718 from cscarpitta/fix/fix-srv6-static-route-pytestmark

tests: Fix markers in `srv6_static_route` topotest

4 months agoisisd: fix srv6 exit statements
Jonathan Voss [Tue, 24 Dec 2024 23:26:37 +0000 (23:26 +0000)]
isisd: fix srv6 exit statements

Fix missing and misplaced `exit` statements to `show running-config` output.

Before:
```
router isis ISIS_CORE
 [...]
 segment-routing srv6
  locator ISIS_LOC
 exit    <<<<<<< always placed after locator
  node-msd
    [...]
  exit    <<<<<<< missng
  interface dum6
exit
```

After:
```
router isis ISIS_CORE
 [...]
 segment-routing srv6
  locator ISIS_LOC
  node-msd
   [...]
  exit
  interface dum6
 exit
exit
```

Related #16694

Signed-off-by: Jonathan Voss <jvoss@onvox.net>
4 months agoMerge pull request #17647 from LabNConsulting/fix-oper-test
Jafar Al-Gharaibeh [Tue, 24 Dec 2024 18:35:32 +0000 (12:35 -0600)]
Merge pull request #17647 from LabNConsulting/fix-oper-test

tests: enable test failure detection and fix resulting failures

4 months agotools: Add missing formats keyword to segment-routing in frr-reload
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.

Signed-off-by: Jonathan Voss <jvoss@onvox.net>
4 months agotests: Fix markers in `srv6_static_route` topotest
Carmine Scarpitta [Tue, 24 Dec 2024 09:38:37 +0000 (10:38 +0100)]
tests: Fix markers in `srv6_static_route` topotest

`srv6_static_route` is a pure staticd topotest. It does not have any
dependency on bgpd and sharpd.

Let's fix the pytestmark to include only staticd.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
4 months agomgmtd: fix memory leak in FE adapter
Christian Hopps [Sun, 15 Dec 2024 01:54:33 +0000 (20:54 -0500)]
mgmtd: fix memory leak in FE adapter

Signed-off-by: Christian Hopps <chopps@labn.net>
4 months agotests: enable failure and fix broken tests
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).

Signed-off-by: Christian Hopps <chopps@labn.net>
4 months agoMerge pull request #17580 from varuntumbe/dev/label_pool_release_fix
Donatas Abraitis [Mon, 23 Dec 2024 12:48:21 +0000 (14:48 +0200)]
Merge pull request #17580 from varuntumbe/dev/label_pool_release_fix

BGP Labelpool : Releasing the label in labelpool when VPN session gets removed

4 months agoMerge pull request #17711 from cscarpitta/fix/remove-srv6-locator-alloc-failure-tests
Donatas Abraitis [Mon, 23 Dec 2024 07:45:14 +0000 (09:45 +0200)]
Merge pull request #17711 from cscarpitta/fix/remove-srv6-locator-alloc-failure-tests

zebra: Remove tests for `srv6_locator_alloc` failure

4 months agozebra: Remove tests for `srv6_locator_alloc` failure
Carmine Scarpitta [Sun, 22 Dec 2024 08:01:59 +0000 (09:01 +0100)]
zebra: Remove tests for `srv6_locator_alloc` failure

`srv6_locator_alloc` can never fail. Let's remove the tests for
allocation failure.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
4 months agoMerge pull request #17684 from opensourcerouting/fix/json_time_no_newline
Jafar Al-Gharaibeh [Sun, 22 Dec 2024 04:59:58 +0000 (22:59 -0600)]
Merge pull request #17684 from opensourcerouting/fix/json_time_no_newline

bgpd, lib: Use frrstr_time() when using ctime_r()

4 months agoMerge pull request #17706 from cscarpitta/fix/convert-to-ipv6-max-bytelen
Jafar Al-Gharaibeh [Sun, 22 Dec 2024 04:56:47 +0000 (22:56 -0600)]
Merge pull request #17706 from cscarpitta/fix/convert-to-ipv6-max-bytelen

bgpd: Convert 16 to IPV6_MAX_BYTELEN

4 months agoMerge pull request #17705 from opensourcerouting/fix/enforce-first-as_peer-group
Jafar Al-Gharaibeh [Sun, 22 Dec 2024 04:54:50 +0000 (22:54 -0600)]
Merge pull request #17705 from opensourcerouting/fix/enforce-first-as_peer-group

bgpd: Fix enforce-first-as per peer-group removal

4 months agobgpd: Replace 16 integer with IPV6_MAX_BYTELEN
Carmine Scarpitta [Sun, 22 Dec 2024 01:09:44 +0000 (02:09 +0100)]
bgpd: Replace 16 integer with IPV6_MAX_BYTELEN

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
4 months agobgpd: Replace 16 integer with IPV6_MAX_BYTELEN
Carmine Scarpitta [Sun, 22 Dec 2024 01:02:09 +0000 (02:02 +0100)]
bgpd: Replace 16 integer with IPV6_MAX_BYTELEN

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
4 months agoMerge pull request #17703 from cscarpitta/fix/fix-srv6-locator-doc
Donatas Abraitis [Sat, 21 Dec 2024 15:14:42 +0000 (17:14 +0200)]
Merge pull request #17703 from cscarpitta/fix/fix-srv6-locator-doc

doc: Fix SRv6 locator documentation

4 months agoMerge pull request #17704 from anlancs/fix/mgmtd-compile-error
Donatas Abraitis [Sat, 21 Dec 2024 15:14:06 +0000 (17:14 +0200)]
Merge pull request #17704 from anlancs/fix/mgmtd-compile-error

mgmtd: fix compile error

4 months agotests: Check if enforce-first-as is working with peer-groups
Donatas Abraitis [Sat, 21 Dec 2024 15:08:01 +0000 (17:08 +0200)]
tests: Check if enforce-first-as is working with peer-groups

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
4 months agobgpd: Fix `enforce-first-as` per peer-group removal
Donatas Abraitis [Sat, 21 Dec 2024 15:03:14 +0000 (17:03 +0200)]
bgpd: Fix `enforce-first-as` per peer-group removal

If we do `no neighbor PG enforce-first-as`, it wasn't working because the flag
was inherited incorrectly for the members of the peer-group.

Fixes: 322462920e2a2c8b73191c6eb5157d64cf4a593e ("bgpd: Enable enforce-first-as by default")
Closes: https://github.com/FRRouting/frr/issues/17702
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
4 months agomgmtd: fix compile error
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.

Signed-off-by: anlan_cs <anlan_cs@126.com>
4 months agodoc: Show the valid range of SRv6 locator node-len
Carmine Scarpitta [Sat, 21 Dec 2024 08:30:57 +0000 (09:30 +0100)]
doc: Show the valid range of SRv6 locator node-len

The documentation should provide the valid range of SRv6 locator
node-len parameter, rather than the default value.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
4 months agodoc: Show the valid range of SRv6 locator block-len
Carmine Scarpitta [Sat, 21 Dec 2024 08:29:55 +0000 (09:29 +0100)]
doc: Show the valid range of SRv6 locator block-len

The documentation should provide the valid range of SRv6 locator
block-len parameter, rather than the default value.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
4 months agodoc: Fix the order of SRv6 locator parameters
Carmine Scarpitta [Sat, 21 Dec 2024 08:26:44 +0000 (09:26 +0100)]
doc: Fix the order of SRv6 locator parameters

Align the order of the SRv6 locator parameters with the actual implementation:

```
"prefix X:X::X:X/M$prefix [block-len (16-64)$block_bit_len]  \
        [node-len (16-64)$node_bit_len] [func-bits (0-64)$func_bit_len]"
```

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
4 months agoMerge pull request #17674 from opensourcerouting/fix/bgp_show_advertised_routes_detail
Jafar Al-Gharaibeh [Fri, 20 Dec 2024 20:01:34 +0000 (14:01 -0600)]
Merge pull request #17674 from opensourcerouting/fix/bgp_show_advertised_routes_detail

bgpd: Fix show neighbor X advertised-routes detail

4 months agoMerge pull request #17672 from raja-rajasekar/rajasekarr/batch_huge_cfg
Jafar Al-Gharaibeh [Fri, 20 Dec 2024 20:00:02 +0000 (14:00 -0600)]
Merge pull request #17672 from raja-rajasekar/rajasekarr/batch_huge_cfg

lib: Fix to optimize the time taken while batching huge configs

4 months agoMerge pull request #17619 from donaldsharp/bgp_metaq_upstream
Jafar Al-Gharaibeh [Fri, 20 Dec 2024 19:59:15 +0000 (13:59 -0600)]
Merge pull request #17619 from donaldsharp/bgp_metaq_upstream

bgpd: add meta queue in bgp

4 months agoMerge pull request #17685 from ykholod/master-17413
Jafar Al-Gharaibeh [Fri, 20 Dec 2024 19:57:47 +0000 (13:57 -0600)]
Merge pull request #17685 from ykholod/master-17413

babel: Clean babel config on babel daemon stop