]> git.puffer.fish Git - mirror/frr.git/log
mirror/frr.git
21 months agoMerge pull request #13333 from donaldsharp/vrf_bitmap_cleanup
Donatas Abraitis [Tue, 4 Jul 2023 19:11:11 +0000 (22:11 +0300)]
Merge pull request #13333 from donaldsharp/vrf_bitmap_cleanup

*: Rearrange vrf_bitmap_X api to reduce memory footprint

21 months agoMerge pull request #13554 from ryndia/fix_leak
Donatas Abraitis [Tue, 4 Jul 2023 18:45:36 +0000 (21:45 +0300)]
Merge pull request #13554 from ryndia/fix_leak

bgpd: free bgp vpn policy

21 months agoMerge pull request #13467 from patrasar/pimv6_state_fix
Donatas Abraitis [Tue, 4 Jul 2023 18:37:20 +0000 (21:37 +0300)]
Merge pull request #13467 from patrasar/pimv6_state_fix

pim6d: "show ipv6 pim state" not displaying when OIL is empty

21 months agoMerge pull request #13889 from chiragshah6/fdev2
Igor Ryzhov [Tue, 4 Jul 2023 18:06:15 +0000 (21:06 +0300)]
Merge pull request #13889 from chiragshah6/fdev2

tools: fix pim interface config deletion

21 months agoMerge pull request #13892 from ryndia/fix_ospf6_lsa_leak
Donatas Abraitis [Tue, 4 Jul 2023 16:19:51 +0000 (19:19 +0300)]
Merge pull request #13892 from ryndia/fix_ospf6_lsa_leak

ospf6d: unlock lsa

21 months agobgpd: free bgp vpn policy 13554/head
ryndia [Tue, 27 Jun 2023 06:59:09 +0000 (10:59 +0400)]
bgpd: free bgp vpn policy

The bgp vpn policy had some attribute not free when the function bgp_free was called leading to memory leak as shown below.

./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251:Direct leak of 592 byte(s) in 2 object(s) allocated from:
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #0 0x7f4b7ae92037 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #1 0x7f4b7aa96e38 in qcalloc lib/memory.c:105
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #2 0x7f4b7aa9bec9 in srv6_locator_chunk_alloc lib/srv6.c:135
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #3 0x56396f8e56f8 in ensure_vrf_tovpn_sid_per_af bgpd/bgp_mplsvpn.c:752
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #4 0x56396f8e608a in ensure_vrf_tovpn_sid bgpd/bgp_mplsvpn.c:846
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #5 0x56396f8e075d in vpn_leak_postchange bgpd/bgp_mplsvpn.h:259
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #6 0x56396f8f3e5b in vpn_leak_postchange_all bgpd/bgp_mplsvpn.c:3397
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #7 0x56396fa920ef in bgp_zebra_process_srv6_locator_chunk bgpd/bgp_zebra.c:3238
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #8 0x7f4b7abb2913 in zclient_read lib/zclient.c:4134
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #9 0x7f4b7ab62010 in thread_call lib/thread.c:1991
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #10 0x7f4b7aa5a418 in frr_run lib/libfrr.c:1185
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #11 0x56396f7d756d in main bgpd/bgp_main.c:505
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #12 0x7f4b7a479d09 in __libc_start_main ../csu/libc-start.c:308
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251:Direct leak of 32 byte(s) in 2 object(s) allocated from:
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #0 0x7f4b7ae92037 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #1 0x7f4b7aa96e38 in qcalloc lib/memory.c:105
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #2 0x56396f8e31b8 in vpn_leak_zebra_vrf_sid_update_per_af bgpd/bgp_mplsvpn.c:386
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #3 0x56396f8e3ae8 in vpn_leak_zebra_vrf_sid_update bgpd/bgp_mplsvpn.c:448
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #4 0x56396f8e09b0 in vpn_leak_postchange bgpd/bgp_mplsvpn.h:271
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #5 0x56396f8f3e5b in vpn_leak_postchange_all bgpd/bgp_mplsvpn.c:3397
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #6 0x56396fa920ef in bgp_zebra_process_srv6_locator_chunk bgpd/bgp_zebra.c:3238
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #7 0x7f4b7abb2913 in zclient_read lib/zclient.c:4134
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #8 0x7f4b7ab62010 in thread_call lib/thread.c:1991
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #9 0x7f4b7aa5a418 in frr_run lib/libfrr.c:1185
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #10 0x56396f7d756d in main bgpd/bgp_main.c:505
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #11 0x7f4b7a479d09 in __libc_start_main ../csu/libc-start.c:308
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251:Direct leak of 32 byte(s) in 2 object(s) allocated from:
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #0 0x7f4b7ae92037 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #1 0x7f4b7aa96e38 in qcalloc lib/memory.c:105
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #2 0x56396f8e5730 in ensure_vrf_tovpn_sid_per_af bgpd/bgp_mplsvpn.c:753
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #3 0x56396f8e608a in ensure_vrf_tovpn_sid bgpd/bgp_mplsvpn.c:846
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #4 0x56396f8e075d in vpn_leak_postchange bgpd/bgp_mplsvpn.h:259
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #5 0x56396f8f3e5b in vpn_leak_postchange_all bgpd/bgp_mplsvpn.c:3397
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #6 0x56396fa920ef in bgp_zebra_process_srv6_locator_chunk bgpd/bgp_zebra.c:3238
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #7 0x7f4b7abb2913 in zclient_read lib/zclient.c:4134
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #8 0x7f4b7ab62010 in thread_call lib/thread.c:1991
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #9 0x7f4b7aa5a418 in frr_run lib/libfrr.c:1185
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #10 0x56396f7d756d in main bgpd/bgp_main.c:505
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-    #11 0x7f4b7a479d09 in __libc_start_main ../csu/libc-start.c:308
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-
./bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.bgpd.asan.603251-SUMMARY: AddressSanitizer: 656 byte(s) leaked in 6 allocation(s).

Signed-off-by: ryndia <dindyalsarvesh@gmail.com>
21 months agoMerge pull request #13894 from donaldsharp/route_map_applied_wrong
Donatas Abraitis [Tue, 4 Jul 2023 08:34:20 +0000 (11:34 +0300)]
Merge pull request #13894 from donaldsharp/route_map_applied_wrong

lib: Add two places we were not counting route-map applied

21 months agoMerge pull request #13921 from donaldsharp/ospf_vty_guard_json
Donatas Abraitis [Tue, 4 Jul 2023 05:51:51 +0000 (08:51 +0300)]
Merge pull request #13921 from donaldsharp/ospf_vty_guard_json

ospfd: Ensure `show ip ospf interface` json code is guarded

21 months agobgpd: All paths bgp_vrf have already been derefed 13921/head
Donald Sharp [Mon, 3 Jul 2023 17:00:07 +0000 (13:00 -0400)]
bgpd: All paths bgp_vrf have already been derefed

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
21 months agoospfd: Ensure `show ip ospf interface` json code is guarded
Donald Sharp [Mon, 3 Jul 2023 16:55:48 +0000 (12:55 -0400)]
ospfd: Ensure `show ip ospf interface` json code is guarded

When not using json, do not allocate json memory.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
21 months agoMerge pull request #13916 from pguibert6WIND/vpnv4_asbr_test_complement
Donald Sharp [Mon, 3 Jul 2023 12:34:01 +0000 (08:34 -0400)]
Merge pull request #13916 from pguibert6WIND/vpnv4_asbr_test_complement

topotests: bgp_vpnv4_asbr, wait that mpls entry is installed

21 months agolib: Add two places we were not counting route-map applied 13894/head
Donald Sharp [Fri, 30 Jun 2023 13:56:51 +0000 (09:56 -0400)]
lib: Add two places we were not counting route-map applied

There were a couple of places where it was possible a route-map
was applied( and DENIED ) but the count for the number of times
the application happen was not incremented.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
21 months agoospf6d: unlock lsa 13892/head
ryndia [Fri, 30 Jun 2023 11:02:27 +0000 (15:02 +0400)]
ospf6d: unlock lsa

The function ospf6_router_lsa_contains_adj(), ospf6_gr_check_adjs() and ospf6_find_interf_prefix_lsa() iterate through LSDB and lock each LSA. During testing, it was discovered that the lock count did not reach zero upon termination. The stack trace below indicates the leak. To resolve this issue, it was found that unlocking the LSA before returning from the functions solves the problem. This suggests that there was a missing unlock that caused the lock count to remain nonzero.

=================================================================
==22565==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 400 byte(s) in 2 object(s) allocated from:
    #0 0x7fa744ccea37 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7fa744867562 in qcalloc ../lib/memory.c:105
    #2 0x555cdbb37506 in ospf6_lsa_alloc ../ospf6d/ospf6_lsa.c:710
    #3 0x555cdbb375d6 in ospf6_lsa_create ../ospf6d/ospf6_lsa.c:725
    #4 0x555cdbaf1008 in ospf6_receive_lsa ../ospf6d/ospf6_flood.c:912
    #5 0x555cdbb48ceb in ospf6_lsupdate_recv ../ospf6d/ospf6_message.c:1621
    #6 0x555cdbb4ac90 in ospf6_read_helper ../ospf6d/ospf6_message.c:1896
    #7 0x555cdbb4aecc in ospf6_receive ../ospf6d/ospf6_message.c:1925
    #8 0x7fa744950c33 in event_call ../lib/event.c:1995
    #9 0x7fa74483b34a in frr_run ../lib/libfrr.c:1213
    #10 0x555cdbacf1eb in main ../ospf6d/ospf6_main.c:250
    #11 0x7fa7443f9d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Objects leaked above:
0x6110000606c0 (200 bytes)
0x611000060940 (200 bytes)

Indirect leak of 80 byte(s) in 2 object(s) allocated from:
    #0 0x7fa744cce867 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7fa744867525 in qmalloc ../lib/memory.c:100
    #2 0x555cdbb37520 in ospf6_lsa_alloc ../ospf6d/ospf6_lsa.c:711
    #3 0x555cdbb375d6 in ospf6_lsa_create ../ospf6d/ospf6_lsa.c:725
    #4 0x555cdbaf1008 in ospf6_receive_lsa ../ospf6d/ospf6_flood.c:912
    #5 0x555cdbb48ceb in ospf6_lsupdate_recv ../ospf6d/ospf6_message.c:1621
    #6 0x555cdbb4ac90 in ospf6_read_helper ../ospf6d/ospf6_message.c:1896
    #7 0x555cdbb4aecc in ospf6_receive ../ospf6d/ospf6_message.c:1925
    #8 0x7fa744950c33 in event_call ../lib/event.c:1995
    #9 0x7fa74483b34a in frr_run ../lib/libfrr.c:1213
    #10 0x555cdbacf1eb in main ../ospf6d/ospf6_main.c:250
    #11 0x7fa7443f9d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Objects leaked above:
0x6040000325d0 (40 bytes)
0x604000032650 (40 bytes)

SUMMARY: AddressSanitizer: 480 byte(s) leaked in 4 allocation(s).

=================================================================
==5483==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 2000 byte(s) in 10 object(s) allocated from:
    #0 0x7f2c3faeea37 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7f2c3f68a6d9 in qcalloc ../lib/memory.c:105
    #2 0x56431b83633d in ospf6_lsa_alloc ../ospf6d/ospf6_lsa.c:710
    #3 0x56431b83640d in ospf6_lsa_create ../ospf6d/ospf6_lsa.c:725
    #4 0x56431b7efe13 in ospf6_receive_lsa ../ospf6d/ospf6_flood.c:912
    #5 0x56431b847b31 in ospf6_lsupdate_recv ../ospf6d/ospf6_message.c:1621
    #6 0x56431b849ad6 in ospf6_read_helper ../ospf6d/ospf6_message.c:1896
    #7 0x56431b849d12 in ospf6_receive ../ospf6d/ospf6_message.c:1925
    #8 0x7f2c3f773c62 in event_call ../lib/event.c:1995
    #9 0x7f2c3f65e2de in frr_run ../lib/libfrr.c:1213
    #10 0x56431b7cdff6 in main ../ospf6d/ospf6_main.c:221
    #11 0x7f2c3f21dd8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Objects leaked above:
0x611000060800 (200 bytes)
0x611000060a80 (200 bytes)
0x611000060d00 (200 bytes)
0x611000060f80 (200 bytes)
0x611000061200 (200 bytes)
0x611000061480 (200 bytes)
0x611000061840 (200 bytes)
0x611000061ac0 (200 bytes)
0x61100006c740 (200 bytes)
0x61100006d500 (200 bytes)

Indirect leak of 460 byte(s) in 10 object(s) allocated from:
    #0 0x7f2c3faee867 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f2c3f68a69c in qmalloc ../lib/memory.c:100
    #2 0x56431b836357 in ospf6_lsa_alloc ../ospf6d/ospf6_lsa.c:711
    #3 0x56431b83640d in ospf6_lsa_create ../ospf6d/ospf6_lsa.c:725
    #4 0x56431b7efe13 in ospf6_receive_lsa ../ospf6d/ospf6_flood.c:912
    #5 0x56431b847b31 in ospf6_lsupdate_recv ../ospf6d/ospf6_message.c:1621
    #6 0x56431b849ad6 in ospf6_read_helper ../ospf6d/ospf6_message.c:1896
    #7 0x56431b849d12 in ospf6_receive ../ospf6d/ospf6_message.c:1925
    #8 0x7f2c3f773c62 in event_call ../lib/event.c:1995
    #9 0x7f2c3f65e2de in frr_run ../lib/libfrr.c:1213
    #10 0x56431b7cdff6 in main ../ospf6d/ospf6_main.c:221
    #11 0x7f2c3f21dd8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Objects leaked above:
0x604000033110 (40 bytes)
0x604000033190 (40 bytes)
0x604000033210 (44 bytes)
0x604000033290 (44 bytes)
0x604000033310 (44 bytes)
0x604000033390 (44 bytes)
0x604000033410 (44 bytes)
0x604000033490 (44 bytes)
0x604000034c90 (44 bytes)
0x6070000d3830 (72 bytes)

SUMMARY: AddressSanitizer: 2460 byte(s) leaked in 20 allocation(s).
Signed-off-by: ryndia <dindyalsarvesh@gmail.com>
21 months agotopotests: bgp_vpnv4_asbr, wait that mpls entry is installed 13916/head
Philippe Guibert [Mon, 3 Jul 2023 08:25:35 +0000 (10:25 +0200)]
topotests: bgp_vpnv4_asbr, wait that mpls entry is installed

Ensure in the test that MPLS entries are installed before
declaring the test fails.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
21 months agoMerge pull request #13900 from donaldsharp/neighbor_structure_crash
Donatas Abraitis [Mon, 3 Jul 2023 06:21:46 +0000 (09:21 +0300)]
Merge pull request #13900 from donaldsharp/neighbor_structure_crash

ospf6d: Fix crash because neighbor structure was freed

21 months agoMerge pull request #13897 from donaldsharp/ospf_crashing_possibility
Donatas Abraitis [Sun, 2 Jul 2023 19:43:27 +0000 (22:43 +0300)]
Merge pull request #13897 from donaldsharp/ospf_crashing_possibility

ospf6d: Stop crash in ospf6_write

21 months agoMerge pull request #13895 from mjstapp/fix_ospf_sync_json_null
Donald Sharp [Sun, 2 Jul 2023 19:40:14 +0000 (15:40 -0400)]
Merge pull request #13895 from mjstapp/fix_ospf_sync_json_null

ospfd: check for NULLs in ldp-igp sync json code

21 months agoMerge pull request #13847 from opensourcerouting/fix/free_zclient_sync_on_destroy
Donald Sharp [Sat, 1 Jul 2023 18:35:42 +0000 (14:35 -0400)]
Merge pull request #13847 from opensourcerouting/fix/free_zclient_sync_on_destroy

Stop and free synchronous Zebra client on destroy

21 months agoMerge pull request #13878 from opensourcerouting/fix/staticd_ecmp_rib_delete_update
Donald Sharp [Sat, 1 Jul 2023 18:33:29 +0000 (14:33 -0400)]
Merge pull request #13878 from opensourcerouting/fix/staticd_ecmp_rib_delete_update

zebra: Dump route details when deleting a route

21 months agoMerge pull request #13882 from opensourcerouting/fix/dead_code
Donald Sharp [Sat, 1 Jul 2023 18:33:07 +0000 (14:33 -0400)]
Merge pull request #13882 from opensourcerouting/fix/dead_code

bgpd: Drop dead code when parsing extcommunity (color)

21 months agoMerge pull request #13883 from opensourcerouting/fix/comment_for_ecommunity_ecom2str
Donald Sharp [Sat, 1 Jul 2023 18:32:36 +0000 (14:32 -0400)]
Merge pull request #13883 from opensourcerouting/fix/comment_for_ecommunity_ecom2str

bgpd: Fix comment for ecommunity_ecom2str()

21 months agoospf6d: Fix crash because neighbor structure was freed 13900/head
Donald Sharp [Sat, 1 Jul 2023 15:18:06 +0000 (11:18 -0400)]
ospf6d: Fix crash because neighbor structure was freed

The loading_done event needs a event pointer to prevent
use after free's.  Testing found this:

    ERROR: AddressSanitizer: heap-use-after-free on address 0x613000035130 at pc 0x55ad42d54e5f bp 0x7ffff1e942a0 sp 0x7ffff1e94290
    READ of size 1 at 0x613000035130 thread T0
        #0 0x55ad42d54e5e in loading_done ospf6d/ospf6_neighbor.c:447
        #1 0x55ad42ed7be4 in event_call lib/event.c:1995
        #2 0x55ad42e1df75 in frr_run lib/libfrr.c:1213
        #3 0x55ad42cf332e in main ospf6d/ospf6_main.c:250
        #4 0x7f5798133c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)
        #5 0x55ad42cf2b19 in _start (/usr/lib/frr/ospf6d+0x248b19)

    0x613000035130 is located 48 bytes inside of 384-byte region [0x613000035100,0x613000035280)
    freed by thread T0 here:
        #0 0x7f57998d77a8 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xde7a8)
        #1 0x55ad42e3b4b6 in qfree lib/memory.c:130
        #2 0x55ad42d5d049 in ospf6_neighbor_delete ospf6d/ospf6_neighbor.c:180
        #3 0x55ad42d1e1ea in interface_down ospf6d/ospf6_interface.c:930
        #4 0x55ad42ed7be4 in event_call lib/event.c:1995
        #5 0x55ad42ed84fe in _event_execute lib/event.c:2086
        #6 0x55ad42d26d7b in ospf6_interface_clear ospf6d/ospf6_interface.c:2847
        #7 0x55ad42d73f16 in ospf6_process_reset ospf6d/ospf6_top.c:755
        #8 0x55ad42d7e98c in clear_router_ospf6_magic ospf6d/ospf6_top.c:778
        #9 0x55ad42d7e98c in clear_router_ospf6 ospf6d/ospf6_top_clippy.c:42
        #10 0x55ad42dc2665 in cmd_execute_command_real lib/command.c:994
        #11 0x55ad42dc2b32 in cmd_execute_command lib/command.c:1053
        #12 0x55ad42dc2fa9 in cmd_execute lib/command.c:1221
        #13 0x55ad42ee3cd6 in vty_command lib/vty.c:591
        #14 0x55ad42ee4170 in vty_execute lib/vty.c:1354
        #15 0x55ad42eec94f in vtysh_read lib/vty.c:2362
        #16 0x55ad42ed7be4 in event_call lib/event.c:1995
        #17 0x55ad42e1df75 in frr_run lib/libfrr.c:1213
        #18 0x55ad42cf332e in main ospf6d/ospf6_main.c:250
        #19 0x7f5798133c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

    previously allocated by thread T0 here:
        #0 0x7f57998d7d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
        #1 0x55ad42e3ab22 in qcalloc lib/memory.c:105
        #2 0x55ad42d5c8ff in ospf6_neighbor_create ospf6d/ospf6_neighbor.c:119
        #3 0x55ad42d4c86a in ospf6_hello_recv ospf6d/ospf6_message.c:464
        #4 0x55ad42d4c86a in ospf6_read_helper ospf6d/ospf6_message.c:1884
        #5 0x55ad42d4c86a in ospf6_receive ospf6d/ospf6_message.c:1925
        #6 0x55ad42ed7be4 in event_call lib/event.c:1995
        #7 0x55ad42e1df75 in frr_run lib/libfrr.c:1213
        #8 0x55ad42cf332e in main ospf6d/ospf6_main.c:250
        #9 0x7f5798133c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Add an actual event pointer and just track it appropriately.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
22 months agoMerge pull request #13896 from fdumontet6WIND/aspath_mgm_fix
Donald Sharp [Fri, 30 Jun 2023 19:31:15 +0000 (15:31 -0400)]
Merge pull request #13896 from fdumontet6WIND/aspath_mgm_fix

bgpd: fix no set as_path replace command

22 months agoospf6d: Stop crash in ospf6_write 13897/head
Donald Sharp [Fri, 30 Jun 2023 19:21:43 +0000 (15:21 -0400)]
ospf6d: Stop crash in ospf6_write

I'm seeing crashes in ospf6_write on the `assert(node)`.  The only
sequence of events that I see that could possibly cause this to happen
is this:

a) Someone has scheduled a outgoing write to the ospf6->t_write and
placed item(s) on the ospf6->oi_write_q
b) A decision is made in ospf6_send_lsupdate() to send an immediate
packet via a event_execute(..., ospf6_write,....).
c) ospf6_write is called and the oi_write_q is cleaned out.
d) the t_write event is now popped and the oi_write_q is empty
and FRR asserts on the `assert(node)` <crash>

When event_execute is called for ospf6_write, just cancel the t_write
event.  If ospf6_write has more data to send at the end of the function
it will reschedule itself.  I've only seen this crash one time and am
unable to reliably reproduce this at all.  But this is the only mechanism
that I can see that could make this happen, given how little the oi_write_q
is actually touched in code.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
22 months agoospfd: check for NULLs in vty code 13895/head
Mark Stapp [Fri, 30 Jun 2023 13:44:00 +0000 (09:44 -0400)]
ospfd: check for NULLs in vty code

There were a couple of cli paths that NULL-checked in the
vtysh output path, but not in the json path.

Signed-off-by: Mark Stapp <mjs@labn.net>
22 months agobgpd: fix no set as_path replace command 13896/head
Francois Dumontet [Fri, 30 Jun 2023 16:16:33 +0000 (18:16 +0200)]
bgpd: fix no set as_path replace command

fix to avoid "Excessive docstring" message

sharpd@eva ~/frr (tests_need_to_be_stricter)> sudo /usr/lib/frr/bgpd
--log stdout --log-level debug --daemon
2023/06/30 09:47:25 BGP: [K2CCG-5Y7ZJ] Excessive docstring while
parsing 'no set as-path replace [<any|ASNUM>]
[<ASNUM>$configured_asn]'
2023/06/30 09:47:25.361807 BGP: [K2CCG-5Y7ZJ] Excessive docstring
while parsing 'no set as-path replace [<any|ASNUM>]
[<ASNUM>$configured_asn]'
2023/06/30 09:47:25 BGP: [W7ENN-K2SVA] ----------
2023/06/30 09:47:25.361839 BGP: [W7ENN-K2SVA] ----------
2023/06/30 09:47:25 BGP: [WCW75-6TZPF] Define the configured AS number
2023/06/30 09:47:25.361842 BGP: [WCW75-6TZPF] Define the configured AS
number
2023/06/30 09:47:25 BGP: [W7ENN-K2SVA] ----------
2023/06/30 09:47:25.361844 BGP: [W7ENN-K2SVA] ----------
2023/06/30 09:47:25.382835 BGP: [T83RR-8SM5G] bgpd 9.1-dev starting:
vty@2605, bgp@<all>:179

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
22 months agobgpd: Drop dead code when parsing extcommunity (color) 13882/head
Donatas Abraitis [Thu, 29 Jun 2023 19:38:06 +0000 (22:38 +0300)]
bgpd: Drop dead code when parsing extcommunity (color)

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
22 months agoMerge pull request #13836 from pguibert6WIND/set_aspath_replace_with_configured_asn
Donatas Abraitis [Fri, 30 Jun 2023 09:39:55 +0000 (12:39 +0300)]
Merge pull request #13836 from pguibert6WIND/set_aspath_replace_with_configured_asn

bgpd: add 'set as-path replace' with a configured ASN

22 months agotools: fix pim interface config deletion 13889/head
Chirag Shah [Thu, 29 Jun 2023 16:55:12 +0000 (09:55 -0700)]
tools: fix pim interface config deletion

When no ip pim is performed subsequent pim related
configs under the interface also implicitly deleted.

When doing this via frr-reload requires to remove any
explicit no ip pim <blah> lines so delete list.

Testing Done:

running-config:
interface lo
 ip pim
 ip pim use-source 6.0.0.1
exit

frr.conf:
remove two pim config lines.
interface lo
exit

Before fix:
2023-06-29 23:44:26,062  INFO: Failed to execute interface lo  no ip pim use-source 6.0.0.1
2023-06-29 23:44:26,142  INFO: Failed to execute interface lo  no ip pim use-source
2023-06-29 23:44:26,221  INFO: Executed "interface lo  no ip pim"

After fix:
Only no ip pim executed and rest of the other lines removed from delete
list.

2023-06-30 01:07:32,618  INFO: Executed "interface lo  no ip pim"

Signed-off-by: Chirag Shah <chirag@nvidia.com>
22 months agoMerge pull request #13866 from LabNConsulting/mgmtd/incllang
Jafar Al-Gharaibeh [Thu, 29 Jun 2023 22:14:21 +0000 (17:14 -0500)]
Merge pull request #13866 from LabNConsulting/mgmtd/incllang

Changes for inclusive language and other cleanup

22 months agoMerge pull request #13879 from donaldsharp/fix_check_ping_again
Donatas Abraitis [Thu, 29 Jun 2023 19:57:26 +0000 (22:57 +0300)]
Merge pull request #13879 from donaldsharp/fix_check_ping_again

tests: Fix broken check_ping run_and_expect semantics

22 months agobgpd: Fix comment for ecommunity_ecom2str() 13883/head
Donatas Abraitis [Thu, 29 Jun 2023 19:44:43 +0000 (22:44 +0300)]
bgpd: Fix comment for ecommunity_ecom2str()

Reformat and align to be readable.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
22 months agoMerge pull request #13869 from anlancs/fix/pbr-crash-ip-protocol
Donatas Abraitis [Thu, 29 Jun 2023 19:21:55 +0000 (22:21 +0300)]
Merge pull request #13869 from anlancs/fix/pbr-crash-ip-protocol

pbrd: fix crash with match command

22 months agoMerge pull request #13877 from rwgbsd/master
Donatas Abraitis [Thu, 29 Jun 2023 14:54:14 +0000 (17:54 +0300)]
Merge pull request #13877 from rwgbsd/master

doc: Add Ubuntu 22.04 to list of builds

22 months agotests: Fix broken check_ping run_and_expect semantics 13879/head
Donald Sharp [Thu, 29 Jun 2023 14:42:11 +0000 (10:42 -0400)]
tests: Fix broken check_ping run_and_expect semantics

*again*.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
22 months agozebra: Dump route details when deleting a route 13878/head
Donatas Abraitis [Thu, 29 Jun 2023 14:39:25 +0000 (17:39 +0300)]
zebra: Dump route details when deleting a route

Just more details what's going on when deleting a route.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
22 months agodoc: Add Ubuntu 22.04 to list of builds 13877/head
Rodney W. Grimes [Thu, 29 Jun 2023 07:58:30 +0000 (07:58 +0000)]
doc: Add Ubuntu 22.04 to list of builds

Add Ubuntu 22.04 build instructions to list.
Sort list into alphabetic order.

Signed-off-by: Rodney W. Grimes <rgrimes@FreeBSD.org>
22 months agoMerge pull request #13864 from pguibert6WIND/bgp_coverity_fix
Donatas Abraitis [Thu, 29 Jun 2023 08:32:15 +0000 (11:32 +0300)]
Merge pull request #13864 from pguibert6WIND/bgp_coverity_fix

Bgp coverity fix

22 months agobgpd: add 'set as-path replace' with a configured ASN 13836/head
Philippe Guibert [Mon, 19 Jun 2023 14:22:55 +0000 (16:22 +0200)]
bgpd: add 'set as-path replace' with a configured ASN

There is no route-map set action to replace any ASN,
or a part of an ASN, with a configured ASN.

The current commit adds a new command to use a configured
ASN as replacement, instead of using the local as number.

> set as-path replace any 65500

Update the 'bgp_set_aspath_replace' test.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
22 months agobgpd: fix covery 1566055, label table overrun 13864/head
Philippe Guibert [Tue, 27 Jun 2023 16:21:53 +0000 (18:21 +0200)]
bgpd: fix covery 1566055, label table overrun

In case the full label stack is used, there may be
a table overrun happening. Avoid it by increasing the
size of the table.

Fixes: 27f4deed0ac1 ("bgpd: update the mpls entry to handle return traffic")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
22 months agobgpd: fix covery scan 1566054 with null pointer
Philippe Guibert [Tue, 27 Jun 2023 16:12:39 +0000 (18:12 +0200)]
bgpd: fix covery scan 1566054 with null pointer

The bmnc pointer is never null. Do not keep the test
on the pointer.

Fixes: 1069425868d1 ("bgpd: allocate label bound to received mpls vpn routes")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
22 months agopbrd: fix crash with match command 13869/head
anlan_cs [Wed, 28 Jun 2023 04:31:52 +0000 (12:31 +0800)]
pbrd: fix crash with match command

Crash with empty `ip-protocol`:
```
anlan(config-pbr-map)# match ip-protocol
vtysh: error reading from pbrd: Resource temporarily unavailable (11)Warning: closing connection to pbrd because of an I/O error!
```

So, give warning for empty `ip-protocol`.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
22 months agoMerge pull request #13870 from iqras23/bm_terminate
Donatas Abraitis [Wed, 28 Jun 2023 12:20:07 +0000 (15:20 +0300)]
Merge pull request #13870 from iqras23/bm_terminate

bgpd: Ensure peer data structure is accessed only when BGPD is not te…

22 months agoMerge pull request #13861 from opensourcerouting/fix/memory_leak_zserv
Mark Stapp [Wed, 28 Jun 2023 12:18:11 +0000 (08:18 -0400)]
Merge pull request #13861 from opensourcerouting/fix/memory_leak_zserv

zebra: Free Zebra client resources

22 months agoMerge pull request #13850 from Keelan10/pimd-leak-fix
mobash-rasool [Wed, 28 Jun 2023 10:42:10 +0000 (16:12 +0530)]
Merge pull request #13850 from Keelan10/pimd-leak-fix

pimd: Fix memory leak in PIM interface deletion

22 months agobgpd: Ensure peer data structure is accessed only when BGPD is not terminating 13870/head
Naveen Thanikachalam [Mon, 4 Feb 2019 14:26:01 +0000 (06:26 -0800)]
bgpd: Ensure peer data structure is accessed only when BGPD is not terminating

With these changes,
the code ensures that the peer data-structures are accessed
only after it knows that BGPD is not terminating.

Authored-by: Naveen Thanikachalam <nthanikachal@vmware.com>
Signed-off-by: Iqra Siddiqui <imujeebsiddi@vmware.com>
22 months agoMerge pull request #13867 from mjstapp/fix_opq_source
Donatas Abraitis [Wed, 28 Jun 2023 06:04:05 +0000 (09:04 +0300)]
Merge pull request #13867 from mjstapp/fix_opq_source

isisd, ospfd: fix opaque zapi source parsing

22 months agomgmtd: convert map to darr use allowing dynamic registrations 13866/head
Christian Hopps [Sat, 24 Jun 2023 16:35:47 +0000 (12:35 -0400)]
mgmtd: convert map to darr use allowing dynamic registrations

- move from the static allocated and initialize xpath map to using the
new darr (dynamic array) code.

Signed-off-by: Christian Hopps <chopps@labn.net>
22 months agolib: add dynamic array type
Christian Hopps [Fri, 23 Jun 2023 18:34:47 +0000 (14:34 -0400)]
lib: add dynamic array type

Signed-off-by: Christian Hopps <chopps@labn.net>
22 months agomgmtd: remove unused "placeholder" code.
Christian Hopps [Tue, 27 Jun 2023 18:12:39 +0000 (14:12 -0400)]
mgmtd: remove unused "placeholder" code.

We don't need un-run/un-tested placeholder code we may never need.

Signed-off-by: Christian Hopps <chopps@labn.net>
22 months agomgmtd: consolidate getcfg and getdata msgs into "get"
Christian Hopps [Tue, 27 Jun 2023 17:58:54 +0000 (13:58 -0400)]
mgmtd: consolidate getcfg and getdata msgs into "get"

eliminates tons of copy and paste code.

Signed-off-by: Christian Hopps <chopps@labn.net>
22 months agoisisd, ospfd: fix opaque zapi source parsing 13867/head
Mark Stapp [Tue, 27 Jun 2023 20:32:54 +0000 (16:32 -0400)]
isisd, ospfd: fix opaque zapi source parsing

Opaque zapi messages carry the sender's zclient tuple now,
daemons shouldn't try to parse those bits directly.

Signed-off-by: Mark Stapp <mjs@labn.net>
22 months agozebra: Free Zebra client resources 13861/head
Donatas Abraitis [Tue, 27 Jun 2023 08:44:10 +0000 (11:44 +0300)]
zebra: Free Zebra client resources

Memory leaks started flowing:

```
AddressSanitizer Topotests Part 0:  15 KB -> 283 KB
AddressSanitizer Topotests Part 1:  1 KB -> 495 KB
AddressSanitizer Topotests Part 2:  13 KB -> 478 KB
AddressSanitizer Topotests Part 3:  39 KB -> 213 KB
AddressSanitizer Topotests Part 4:  30 KB -> 836 KB
AddressSanitizer Topotests Part 5:  0 bytes -> 356 KB
AddressSanitizer Topotests Part 6:  86 KB -> 783 KB
AddressSanitizer Topotests Part 7:  0 bytes -> 354 KB
AddressSanitizer Topotests Part 8:  0 bytes -> 62 KB
AddressSanitizer Topotests Part 9:  408 KB -> 518 KB
```

```
Direct leak of 3584 byte(s) in 1 object(s) allocated from:
    #0 0x7f1957b02d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x559895c55df0 in qcalloc lib/memory.c:105
    #2 0x559895bc1cdf in zserv_client_create zebra/zserv.c:743
    #3 0x559895bc1cdf in zserv_accept zebra/zserv.c:880
    #4 0x559895cf3438 in event_call lib/event.c:1995
    #5 0x559895c3901c in frr_run lib/libfrr.c:1213
    #6 0x559895a698f1 in main zebra/main.c:472
    #7 0x7f195635ec86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)
```

Fixes b20acd0 ("bgpd: Use synchronous way to get labels from Zebra")

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
22 months agomgmtd: inclusive language change
Christian Hopps [Mon, 26 Jun 2023 16:59:59 +0000 (12:59 -0400)]
mgmtd: inclusive language change

'cfg_btch' -> 'batch' and 'btch_list' -> 'batch_list'

Signed-off-by: Christian Hopps <chopps@labn.net>
22 months agoMerge pull request #13838 from ak503/static_bfd_vrf
Christian Hopps [Tue, 27 Jun 2023 15:34:50 +0000 (11:34 -0400)]
Merge pull request #13838 from ak503/static_bfd_vrf

staticd: Fix bfd for static route in VRF

22 months agoMerge pull request #13826 from opensourcerouting/fix/ripng_match_ipv6_acls
Russ White [Tue, 27 Jun 2023 15:31:23 +0000 (11:31 -0400)]
Merge pull request #13826 from opensourcerouting/fix/ripng_match_ipv6_acls

ripng: match ipv6 address [prefix-list] CMDs

22 months agoMerge pull request #13852 from mjstapp/fix_opq_cov_msg
Russ White [Tue, 27 Jun 2023 15:28:31 +0000 (11:28 -0400)]
Merge pull request #13852 from mjstapp/fix_opq_cov_msg

zebra: clean up coverity warning in opaque api

22 months agoMerge pull request #13859 from opensourcerouting/fix/bgpd_coverity_issues
Russ White [Tue, 27 Jun 2023 14:26:02 +0000 (10:26 -0400)]
Merge pull request #13859 from opensourcerouting/fix/bgpd_coverity_issues

bgpd: Check for NULL before assigning a peer from the group

22 months agoMerge pull request #13854 from chiragshah6/fdev2
Russ White [Tue, 27 Jun 2023 14:25:39 +0000 (10:25 -0400)]
Merge pull request #13854 from chiragshah6/fdev2

zebra: fix evpn rmac nh list cmp function

22 months agoMerge pull request #13851 from opensourcerouting/fix/use_zclient_sync_for_table_manager
Mark Stapp [Tue, 27 Jun 2023 12:54:46 +0000 (08:54 -0400)]
Merge pull request #13851 from opensourcerouting/fix/use_zclient_sync_for_table_manager

bgpd: Use synchronous Zebra client for table manager

22 months agoMerge pull request #13628 from kuldeepkash/uplink_mcast_tests
Donatas Abraitis [Tue, 27 Jun 2023 10:34:17 +0000 (13:34 +0300)]
Merge pull request #13628 from kuldeepkash/uplink_mcast_tests

tests: Add multicast-pim-multi-uplink test suite

22 months agoMerge pull request #13672 from zmw12306/AE_zero
Donatas Abraitis [Tue, 27 Jun 2023 10:18:20 +0000 (13:18 +0300)]
Merge pull request #13672 from zmw12306/AE_zero

babeld: add AE!=0 check when type is 7 or 10.

22 months agoMerge pull request #13722 from fdumontet6WIND/color_extcomm
Donatas Abraitis [Tue, 27 Jun 2023 10:03:22 +0000 (13:03 +0300)]
Merge pull request #13722 from fdumontet6WIND/color_extcomm

bgpd,lib,yang: add colored extended communities support

22 months agoMerge pull request #13857 from anlancs/doc-wrong-code
Donatas Abraitis [Tue, 27 Jun 2023 09:56:47 +0000 (12:56 +0300)]
Merge pull request #13857 from anlancs/doc-wrong-code

doc: Fix one syntax error for code block

22 months agoldpd: Stop and free synchronous Zebra client on destroy 13847/head
Donatas Abraitis [Mon, 26 Jun 2023 13:34:03 +0000 (16:34 +0300)]
ldpd: Stop and free synchronous Zebra client on destroy

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
22 months agobgpd: Check for NULL before assigning a peer from the group 13859/head
Donatas Abraitis [Tue, 27 Jun 2023 06:50:02 +0000 (09:50 +0300)]
bgpd: Check for NULL before assigning a peer from the group

CID 1566056

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
22 months agobgpd: Guard zlog_debug for table manager when the connection is successful 13851/head
Donatas Abraitis [Tue, 27 Jun 2023 06:32:07 +0000 (09:32 +0300)]
bgpd: Guard zlog_debug for table manager when the connection is successful

We shouldn't use unguarded zlog_debug().

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
22 months agobgpd: Use zlog_err when can't connect to table manager (zebra)
Donatas Abraitis [Tue, 27 Jun 2023 06:29:52 +0000 (09:29 +0300)]
bgpd: Use zlog_err when can't connect to table manager (zebra)

If this an error, we should use zlog_err, not zlog_info as this is literally
not an information, but an error.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
22 months agodoc: Fix one syntax error for code block 13857/head
anlan_cs [Tue, 27 Jun 2023 05:19:28 +0000 (13:19 +0800)]
doc: Fix one syntax error for code block

The code block doesn't work due to special thing in front of it.
So, just make it work.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
22 months agopimd: Fix memory leak in PIM interface deletion 13850/head
Keelan10 [Mon, 26 Jun 2023 10:56:26 +0000 (14:56 +0400)]
pimd: Fix memory leak in PIM interface deletion

This commit ensures proper cleanup by deleting the gm_join_list when a PIM interface is deleted. The gm_join_list was previously not being freed, causing a memory leak.

The ASan leak log for reference:
```
***********************************************************************************
Address Sanitizer Error detected in multicast_mld_join_topo1.test_multicast_mld_local_join/r1.asan.pim6d.28070

=================================================================
==28070==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x7f3605dbfd28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x56230373dd6b in qcalloc lib/memory.c:105
    #2 0x56230372180f in list_new lib/linklist.c:49
    #3 0x56230361b589 in pim_if_gm_join_add pimd/pim_iface.c:1313
    #4 0x562303642247 in lib_interface_gmp_address_family_static_group_create pimd/pim_nb_config.c:2868
    #5 0x562303767280 in nb_callback_create lib/northbound.c:1235
    #6 0x562303767280 in nb_callback_configuration lib/northbound.c:1579
    #7 0x562303768a1d in nb_transaction_process lib/northbound.c:1710
    #8 0x56230376904a in nb_candidate_commit_apply lib/northbound.c:1104
    #9 0x5623037692ba in nb_candidate_commit lib/northbound.c:1137
    #10 0x562303769dec in nb_cli_classic_commit lib/northbound_cli.c:49
    #11 0x56230376fb79 in nb_cli_pending_commit_check lib/northbound_cli.c:88
    #12 0x5623036c5bcb in cmd_execute_command_real lib/command.c:991
    #13 0x5623036c5f1b in cmd_execute_command lib/command.c:1053
    #14 0x5623036c6392 in cmd_execute lib/command.c:1221
    #15 0x5623037e75da in vty_command lib/vty.c:591
    #16 0x5623037e7a74 in vty_execute lib/vty.c:1354
    #17 0x5623037f0253 in vtysh_read lib/vty.c:2362
    #18 0x5623037db4e8 in event_call lib/event.c:1995
    #19 0x562303720f97 in frr_run lib/libfrr.c:1213
    #20 0x56230368615d in main pimd/pim6_main.c:184
    #21 0x7f360461bc86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Indirect leak of 192 byte(s) in 4 object(s) allocated from:
    #0 0x7f3605dbfd28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x56230373dd6b in qcalloc lib/memory.c:105
    #2 0x56230361b91d in gm_join_new pimd/pim_iface.c:1288
    #3 0x56230361b91d in pim_if_gm_join_add pimd/pim_iface.c:1326
    #4 0x562303642247 in lib_interface_gmp_address_family_static_group_create pimd/pim_nb_config.c:2868
    #5 0x562303767280 in nb_callback_create lib/northbound.c:1235
    #6 0x562303767280 in nb_callback_configuration lib/northbound.c:1579
    #7 0x562303768a1d in nb_transaction_process lib/northbound.c:1710
    #8 0x56230376904a in nb_candidate_commit_apply lib/northbound.c:1104
    #9 0x5623037692ba in nb_candidate_commit lib/northbound.c:1137
    #10 0x562303769dec in nb_cli_classic_commit lib/northbound_cli.c:49
    #11 0x56230376fb79 in nb_cli_pending_commit_check lib/northbound_cli.c:88
    #12 0x5623036c5bcb in cmd_execute_command_real lib/command.c:991
    #13 0x5623036c5f1b in cmd_execute_command lib/command.c:1053
    #14 0x5623036c6392 in cmd_execute lib/command.c:1221
    #15 0x5623037e75da in vty_command lib/vty.c:591
    #16 0x5623037e7a74 in vty_execute lib/vty.c:1354
    #17 0x5623037f0253 in vtysh_read lib/vty.c:2362
    #18 0x5623037db4e8 in event_call lib/event.c:1995
    #19 0x562303720f97 in frr_run lib/libfrr.c:1213
    #20 0x56230368615d in main pimd/pim6_main.c:184
    #21 0x7f360461bc86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Indirect leak of 96 byte(s) in 4 object(s) allocated from:
    #0 0x7f3605dbfd28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x56230373dd6b in qcalloc lib/memory.c:105
    #2 0x562303721651 in listnode_new lib/linklist.c:71
    #3 0x56230372182b in listnode_add lib/linklist.c:92
    #4 0x56230361ba9a in gm_join_new pimd/pim_iface.c:1295
    #5 0x56230361ba9a in pim_if_gm_join_add pimd/pim_iface.c:1326
    #6 0x562303642247 in lib_interface_gmp_address_family_static_group_create pimd/pim_nb_config.c:2868
    #7 0x562303767280 in nb_callback_create lib/northbound.c:1235
    #8 0x562303767280 in nb_callback_configuration lib/northbound.c:1579
    #9 0x562303768a1d in nb_transaction_process lib/northbound.c:1710
    #10 0x56230376904a in nb_candidate_commit_apply lib/northbound.c:1104
    #11 0x5623037692ba in nb_candidate_commit lib/northbound.c:1137
    #12 0x562303769dec in nb_cli_classic_commit lib/northbound_cli.c:49
    #13 0x56230376fb79 in nb_cli_pending_commit_check lib/northbound_cli.c:88
    #14 0x5623036c5bcb in cmd_execute_command_real lib/command.c:991
    #15 0x5623036c5f1b in cmd_execute_command lib/command.c:1053
    #16 0x5623036c6392 in cmd_execute lib/command.c:1221
    #17 0x5623037e75da in vty_command lib/vty.c:591
    #18 0x5623037e7a74 in vty_execute lib/vty.c:1354
    #19 0x5623037f0253 in vtysh_read lib/vty.c:2362
    #20 0x5623037db4e8 in event_call lib/event.c:1995
    #21 0x562303720f97 in frr_run lib/libfrr.c:1213
    #22 0x56230368615d in main pimd/pim6_main.c:184
    #23 0x7f360461bc86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Indirect leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x7f3605dbfd28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x56230373dd6b in qcalloc lib/memory.c:105
    #2 0x56230361b91d in gm_join_new pimd/pim_iface.c:1288
    #3 0x56230361b91d in pim_if_gm_join_add pimd/pim_iface.c:1326
    #4 0x562303642247 in lib_interface_gmp_address_family_static_group_create pimd/pim_nb_config.c:2868
    #5 0x562303767280 in nb_callback_create lib/northbound.c:1235
    #6 0x562303767280 in nb_callback_configuration lib/northbound.c:1579
    #7 0x562303768a1d in nb_transaction_process lib/northbound.c:1710
    #8 0x56230376904a in nb_candidate_commit_apply lib/northbound.c:1104
    #9 0x5623037692ba in nb_candidate_commit lib/northbound.c:1137
    #10 0x562303769dec in nb_cli_classic_commit lib/northbound_cli.c:49
    #11 0x56230376fb79 in nb_cli_pending_commit_check lib/northbound_cli.c:88
    #12 0x5623036c5bcb in cmd_execute_command_real lib/command.c:991
    #13 0x5623036c5f6f in cmd_execute_command lib/command.c:1072
    #14 0x5623036c6392 in cmd_execute lib/command.c:1221
    #15 0x5623037e75da in vty_command lib/vty.c:591
    #16 0x5623037e7a74 in vty_execute lib/vty.c:1354
    #17 0x5623037f0253 in vtysh_read lib/vty.c:2362
    #18 0x5623037db4e8 in event_call lib/event.c:1995
    #19 0x562303720f97 in frr_run lib/libfrr.c:1213
    #20 0x56230368615d in main pimd/pim6_main.c:184
    #21 0x7f360461bc86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Indirect leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7f3605dbfd28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x56230373dd6b in qcalloc lib/memory.c:105
    #2 0x562303721651 in listnode_new lib/linklist.c:71
    #3 0x56230372182b in listnode_add lib/linklist.c:92
    #4 0x56230361ba9a in gm_join_new pimd/pim_iface.c:1295
    #5 0x56230361ba9a in pim_if_gm_join_add pimd/pim_iface.c:1326
    #6 0x562303642247 in lib_interface_gmp_address_family_static_group_create pimd/pim_nb_config.c:2868
    #7 0x562303767280 in nb_callback_create lib/northbound.c:1235
    #8 0x562303767280 in nb_callback_configuration lib/northbound.c:1579
    #9 0x562303768a1d in nb_transaction_process lib/northbound.c:1710
    #10 0x56230376904a in nb_candidate_commit_apply lib/northbound.c:1104
    #11 0x5623037692ba in nb_candidate_commit lib/northbound.c:1137
    #12 0x562303769dec in nb_cli_classic_commit lib/northbound_cli.c:49
    #13 0x56230376fb79 in nb_cli_pending_commit_check lib/northbound_cli.c:88
    #14 0x5623036c5bcb in cmd_execute_command_real lib/command.c:991
    #15 0x5623036c5f6f in cmd_execute_command lib/command.c:1072
    #16 0x5623036c6392 in cmd_execute lib/command.c:1221
    #17 0x5623037e75da in vty_command lib/vty.c:591
    #18 0x5623037e7a74 in vty_execute lib/vty.c:1354
    #19 0x5623037f0253 in vtysh_read lib/vty.c:2362
    #20 0x5623037db4e8 in event_call lib/event.c:1995
    #21 0x562303720f97 in frr_run lib/libfrr.c:1213
    #22 0x56230368615d in main pimd/pim6_main.c:184
    #23 0x7f360461bc86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

SUMMARY: AddressSanitizer: 400 byte(s) leaked in 11 allocation(s).
***********************************************************************************
```

Signed-off-by: Keelan Cannoo <keelan.cannoo@icloud.com>
22 months agozebra: fix evpn rmac nh list cmp function 13854/head
Chirag Shah [Mon, 26 Jun 2023 22:29:59 +0000 (15:29 -0700)]
zebra: fix evpn rmac nh list cmp function

EVPN RMAC (Router MAC) nexthop list compare
function needs to return all values so
the list element can be compared and added/deleted
properly.

Ticket:#3486989
Testing Done:
Originate EVPN Type-5 route with PIP IP and MAC as remote
nexthops.
Change the PIP IP address which triggers nexthop change.

Before fix:
When PIP IP changes RMAC is deleted from remote VTEPs.

TORS1# show evpn next-hops vni 4001 | include 00:02:00:00:00:2d
27.0.0.11       00:02:00:00:00:2d
TORS1# show evpn rmac vni 4001 | include 00:02:00:00:00:2d
00:02:00:00:00:2d 27.0.0.11

----- Remote VTEP change nexthop IP to 172.16.16.16 -----

TORS1# show evpn next-hops vni 4001 | include 00:02:00:00:00:2d
172.16.16.16    00:02:00:00:00:2d
TORS1# show evpn rmac vni 4001 | include 00:02:00:00:00:2d
TORS1#

After fix:
RMAC is retained as its nexthop list is not empty,
thus it is not deleted from remote VTEPs.

TORS1# show evpn rmac vni 4001 | include 00:02:00:00:00:2d
00:02:00:00:00:2d 172.16.16.16

Log:
2023/06/27 00:50:36.833474 ZEBRA: [XREH0-ZYMH6] L3VNI 4001 Remote VTEP
change(27.0.0.11 -> 172.16.16.16) for RMAC 00:02:00:00:00:2d

Signed-off-by: Chirag Shah <chirag@nvidia.com>
22 months ago*: Rearrange vrf_bitmap_X api to reduce memory footprint 13333/head
Donald Sharp [Wed, 19 Apr 2023 12:13:18 +0000 (08:13 -0400)]
*: Rearrange vrf_bitmap_X api to reduce memory footprint

When running all daemons with config for most of them, FRR has
sharpd@janelle:~/frr$ vtysh -c "show debug hashtable"  | grep "VRF BIT HASH" | wc -l
3570

3570 hashes for bitmaps associated with the vrf.  This is a very
large number of hashes.  Let's do two things:

a) Reduce the created size of the actually created hashes to 2
instead of 32.

b) Delay generation of the hash *until* a set operation happens.
As that no hash directly implies a unset value if/when checked.

This reduces the number of hashes to 61 in my setup for normal
operation.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
22 months agoMerge pull request #13804 from LabNConsulting/aceelindem/ospf6d-config-callbacks
Donald Sharp [Mon, 26 Jun 2023 18:59:13 +0000 (14:59 -0400)]
Merge pull request #13804 from LabNConsulting/aceelindem/ospf6d-config-callbacks

ospf6d: Add config callbacks to suppress hellos during config load.

22 months agoMerge pull request #13802 from LabNConsulting/aceelindem/ospfd-config-callbacks
Donald Sharp [Mon, 26 Jun 2023 18:58:03 +0000 (14:58 -0400)]
Merge pull request #13802 from LabNConsulting/aceelindem/ospfd-config-callbacks

ospfd: Add config callbacks and suppress hello during config load.

22 months agozebra: clean up coverity warning in opaque api 13852/head
Mark Stapp [Mon, 26 Jun 2023 17:19:23 +0000 (13:19 -0400)]
zebra: clean up coverity warning in opaque api

Seems a bit fussy of coverity, but ... don't NULL a variable
unnecessarily.

Signed-off-by: Mark Stapp <mjs@labn.net>
22 months agobgpd: Use synchronous Zebra client for table manager
Donatas Abraitis [Wed, 21 Jun 2023 21:20:53 +0000 (00:20 +0300)]
bgpd: Use synchronous Zebra client for table manager

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
22 months agopathd: Stop and free synchronous Zebra client on pathd termination
Donatas Abraitis [Mon, 26 Jun 2023 10:59:16 +0000 (13:59 +0300)]
pathd: Stop and free synchronous Zebra client on pathd termination

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
22 months agoospfd: Stop and free synchronous Zebra client on OSPF termination
Donatas Abraitis [Mon, 26 Jun 2023 10:57:24 +0000 (13:57 +0300)]
ospfd: Stop and free synchronous Zebra client on OSPF termination

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
22 months agodoc: extcommunity color 13722/head
Francois Dumontet [Sat, 10 Jun 2023 16:27:35 +0000 (18:27 +0200)]
doc: extcommunity color

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
22 months agobgpd: add functions related to srte_color management
Francois Dumontet [Fri, 9 Jun 2023 12:30:33 +0000 (14:30 +0200)]
bgpd: add functions related to srte_color management

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
22 months agotests: add bgp colored extended community test
Francois Dumontet [Thu, 25 May 2023 16:23:48 +0000 (18:23 +0200)]
tests: add bgp colored extended community test

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
22 months agobgpd: add colored extended communities support
Francois Dumontet [Mon, 22 May 2023 13:36:06 +0000 (15:36 +0200)]
bgpd: add colored extended communities support

add support of color extended community, conforming to RFC 9012.
This extended community will be added to the existing one, RT,SOO
and Node Target. The configuration will be made through the
route-map service.

find above a configuration example:

router bgp 65001
 bgp router-id 192.168.1.1
 no bgp ebgp-requires-policy
 no bgp network import-check
 neighbor 192.168.1.2 remote-as external
 neighbor 192.168.1.3 remote-as external
 neighbor 192.168.1.4 remote-as external
 address-family ipv4 unicast
  network 10.10.10.10/24 route-map rmap
  exit-address-family
!
  route-map rmap permit 10
   set extcommunity color 55555 200
  exit

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
22 months agoMerge pull request #13771 from mjstapp/opaque_notify
Donatas Abraitis [Mon, 26 Jun 2023 10:08:52 +0000 (13:08 +0300)]
Merge pull request #13771 from mjstapp/opaque_notify

lib, zebra, sharpd: add notifications for ZAPI opaque message registration events

22 months agoMerge pull request #13848 from LabNConsulting/chopps/clang-format-tweak
Donatas Abraitis [Mon, 26 Jun 2023 09:55:10 +0000 (12:55 +0300)]
Merge pull request #13848 from LabNConsulting/chopps/clang-format-tweak

tools: less aggressive settings for clang-format

22 months agoMerge pull request #13839 from LabNConsulting/chopps/nofiltermodule
Jafar Al-Gharaibeh [Mon, 26 Jun 2023 04:54:57 +0000 (23:54 -0500)]
Merge pull request #13839 from LabNConsulting/chopps/nofiltermodule

staticd: remove unused YANG module

22 months agotests: Add multicast-pim-multi-uplink-topo3 suite 13628/head
Kuldeep Kashyap [Tue, 30 May 2023 06:03:51 +0000 (11:33 +0530)]
tests: Add multicast-pim-multi-uplink-topo3 suite

Added 4 new test cases to verify multicast PIM
uplink(8 uplink) functionality.

Signed-off-by: Kuldeep Kashyap <kashyapk@vmware.com>
22 months agotests: Add multicast-pim-multi-uplink-topo2 suite
Kuldeep Kashyap [Tue, 30 May 2023 06:00:43 +0000 (11:30 +0530)]
tests: Add multicast-pim-multi-uplink-topo2 suite

Added 4 new test cases to verify multicast PIM
uplink(8 uplink) functionality.

Signed-off-by: Kuldeep Kashyap <kashyapk@vmware.com>
22 months agotools: less aggressive settings for clang-format 13848/head
Christian Hopps [Sun, 25 Jun 2023 12:13:25 +0000 (08:13 -0400)]
tools: less aggressive settings for clang-format

- Reports were that the current settings were choosing to extend beyond 80
columns too often. This change makes that more expensive but still tries
very hard to not break before first open parenthesis of function calls.

Signed-off-by: Christian Hopps <chopps@labn.net>
22 months agoMerge pull request #13845 from LabNConsulting/aceelindem/isis-config-end-error-log
Donatas Abraitis [Sat, 24 Jun 2023 20:35:58 +0000 (23:35 +0300)]
Merge pull request #13845 from LabNConsulting/aceelindem/isis-config-end-error-log

isisd: Log error when config-end timeout occurs.

22 months agoMerge pull request #13844 from LabNConsulting/aceelindem/bgp-config-callback-log
Donatas Abraitis [Sat, 24 Jun 2023 20:22:56 +0000 (23:22 +0300)]
Merge pull request #13844 from LabNConsulting/aceelindem/bgp-config-callback-log

bgpd: Add config-end timeout error log message.

22 months agoMerge pull request #13822 from SaiGomathiN/regF
Donatas Abraitis [Sat, 24 Jun 2023 20:22:10 +0000 (23:22 +0300)]
Merge pull request #13822 from SaiGomathiN/regF

pim, pim6d: pimreg interface is not getting added in a certain scenario

22 months agoisisd: Log error when config-end timeout occurs. 13845/head
Acee [Sat, 24 Jun 2023 17:43:03 +0000 (13:43 -0400)]
isisd: Log error when config-end timeout occurs.

Signed-off-by: Acee <aceelindem@gmail.com>
22 months agobgpd: Add config-end timemout error log message. 13844/head
Acee [Sat, 24 Jun 2023 17:29:24 +0000 (13:29 -0400)]
bgpd: Add config-end timemout error log message.

Signed-off-by: Acee <aceelindem@gmail.com>
22 months agostaticd: remove unused YANG module 13839/head
Christian Hopps [Fri, 23 Jun 2023 17:16:18 +0000 (13:16 -0400)]
staticd: remove unused YANG module

Signed-off-by: Christian Hopps <chopps@labn.net>
22 months agostaticd: Fix bfd for static route in VRF 13838/head
Dmitrii Turlupov [Fri, 23 Jun 2023 15:48:59 +0000 (18:48 +0300)]
staticd: Fix bfd for static route in VRF

vrf BELLA
 ip route 1.1.1.1/32 192.168.1.1 bfd profile test
exit-vrf

Before patch:
# do show bfd peers
BFD Peers:
peer 192.168.1.1 vrf default

After patch:
# do show bfd peers
BFD Peers:
peer 192.168.1.1 vrf BELLA

Signed-off-by: Dmitrii Turlupov <turlupov@zts.ru>
22 months agosharpd: support opaque zapi notifications 13771/head
Mark Stapp [Mon, 12 Jun 2023 20:14:45 +0000 (16:14 -0400)]
sharpd: support opaque zapi notifications

Add cli and support to sharpd to exercise the zapi opaque
'notification' features.

Signed-off-by: Mark Stapp <mjs@labn.net>
22 months agozebra: support notifications for opaque ZAPI messages
Mark Stapp [Wed, 31 May 2023 20:25:15 +0000 (16:25 -0400)]
zebra: support notifications for opaque ZAPI messages

Allow zapi clients to register to be notified when a server
for an  opaque message type is present. Zebra maintains these
notification registrations in the same data structures that it
uses for opaque message handling.

Signed-off-by: Mark Stapp <mjs@labn.net>
22 months agolib: add notifications for opaque zapi messages
Mark Stapp [Wed, 31 May 2023 20:22:16 +0000 (16:22 -0400)]
lib: add notifications for opaque zapi messages

Add a new notification zapi message type. A zapi client
that uses opaque messages can register to be notified
when a server for an opaque type is present.

Signed-off-by: Mark Stapp <mjs@labn.net>
22 months agolib, zebra: include source client zapi info in opaque messages
Mark Stapp [Mon, 29 May 2023 17:04:24 +0000 (13:04 -0400)]
lib, zebra: include source client zapi info in opaque messages

Include the sending zapi client info (proto, instance, and
session id) in each opaque zapi message. Add opaque 'init'
apis for clients who want to encode their opaque data inline,
into the zclient's internal stream buffer. Use these init apis
in the TE/link-state lib code, instead of hand-coding the
zapi opaque header info.

Signed-off-by: Mark Stapp <mjs@labn.net>
22 months agoospf6d: Add config callbacks to suppress hellos during config load. Add bgpd/isisd... 13804/head
Acee [Sun, 18 Jun 2023 11:22:45 +0000 (07:22 -0400)]
ospf6d: Add config callbacks to suppress hellos during config load. Add bgpd/isisd message.

Signed-off-by: Acee <aceelindem@gmail.com>