]> git.puffer.fish Git - mirror/frr.git/log
mirror/frr.git
18 months agobgpd: rewrite 'bgp label vpn export' command
Philippe Guibert [Sun, 24 Sep 2023 20:16:36 +0000 (22:16 +0200)]
bgpd: rewrite 'bgp label vpn export' command

The original 'bgp label vpn export' code is confusing,
the 'no form' actions are mixed with the positive form.

Fix this by rewriting the code.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
18 months agoMerge pull request #14607 from mobash-rasool/fixes2
Donatas Abraitis [Tue, 17 Oct 2023 14:34:11 +0000 (17:34 +0300)]
Merge pull request #14607 from mobash-rasool/fixes2

pim6d: valgrind issue fixes

18 months agopim6d: valgrind issue fixes 14607/head
Mobashshera Rasool [Tue, 17 Oct 2023 04:40:05 +0000 (21:40 -0700)]
pim6d: valgrind issue fixes

Problem Statement:
===================
Syscall param sendmsg(msg.msg_iov[0]) points to uninitialised byte(s)
at 0x4975157: sendmsg (sendmsg.c:28)
==2263111==    by 0x1413BE: pim_msg_send_frame (pim_pim.c:629)
==2263111==    by 0x1413BE: pim_msg_send (pim_pim.c:743)
==2263111==    by 0x1425DC: pim_register_send (pim_register.c:332)
==2263111==    by 0x1427EE: pim_null_register_send (pim_register.c:443)
==2263111==    by 0x14D228: pim_upstream_register_stop_timer (pim_upstream.c:1608)
==2263111==    by 0x48CE6DF: thread_call (thread.c:1693)
==2263111==    by 0x4899EFF: frr_run (libfrr.c:1068)
==2263111==    by 0x11D035: main (pim6_main.c:190)
==2263111==  Address 0x1ffeffdcb1 is on thread 1's stack
==2263111==  in frame #2, created by pim_register_send (pim_register.c:273)
==2263111==  Uninitialised value was created by a stack allocation
==2263111==    at 0x142690: pim_null_register_send (pim_register.c:389)

RCA:
====================
1. All members of struct pim_msg_header were not initiliased while sending
null register packet. Therefore when the pointers are assigned while
sending the msg via sendmsg, it complains the pointer points to
uninitialised byte.
2. struct ipv6_ph ph was also not initialised.

Fix:
====================
Initialised all the members using memset.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
18 months agoMerge pull request #14599 from opensourcerouting/fix/issue_14419
Donald Sharp [Mon, 16 Oct 2023 14:20:23 +0000 (10:20 -0400)]
Merge pull request #14599 from opensourcerouting/fix/issue_14419

tests: Check if evpn route-map match by route type works

18 months agotests: Check if evpn route-map match by route type works 14599/head
Donatas Abraitis [Sat, 14 Oct 2023 08:45:56 +0000 (11:45 +0300)]
tests: Check if evpn route-map match by route type works

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
18 months agoMerge pull request #14585 from donaldsharp/send_capability
Donatas Abraitis [Sat, 14 Oct 2023 17:22:37 +0000 (20:22 +0300)]
Merge pull request #14585 from donaldsharp/send_capability

ldpd: Clarify error situation for different problems

18 months agoMerge pull request #14582 from cloudscale-ch/denis/topotest-for-14488
Donald Sharp [Sat, 14 Oct 2023 13:42:49 +0000 (09:42 -0400)]
Merge pull request #14582 from cloudscale-ch/denis/topotest-for-14488

tests: Add OSPF test for issue 14488

18 months agoMerge pull request #14590 from opensourcerouting/ospf6d-fwd-addr
Donald Sharp [Fri, 13 Oct 2023 20:27:30 +0000 (16:27 -0400)]
Merge pull request #14590 from opensourcerouting/ospf6d-fwd-addr

ospf6d: fix setting of the forwarding address in AS-External LSAs

18 months agoMerge pull request #14553 from donaldsharp/zebra_weighted_ecmp
Donatas Abraitis [Fri, 13 Oct 2023 20:09:18 +0000 (23:09 +0300)]
Merge pull request #14553 from donaldsharp/zebra_weighted_ecmp

Zebra weighted ecmp

18 months agoldpd: Clarify error situation for different problems 14585/head
Donald Sharp [Fri, 13 Oct 2023 11:17:17 +0000 (07:17 -0400)]
ldpd: Clarify error situation for different problems

Clarify the fatal error message recorded when an error situation
happens.  Disambiguating the default case from the TLV_TYPE_DYNAMIC_CAP
case.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
18 months agoMerge pull request #14561 from idryzhov/implicit-fallthrough
Donald Sharp [Fri, 13 Oct 2023 15:51:11 +0000 (11:51 -0400)]
Merge pull request #14561 from idryzhov/implicit-fallthrough

build: add -Wimplicit-fallthrough

18 months agoMerge pull request #14584 from pguibert6WIND/lmc_log_display_chunk
Donald Sharp [Fri, 13 Oct 2023 15:49:48 +0000 (11:49 -0400)]
Merge pull request #14584 from pguibert6WIND/lmc_log_display_chunk

zebra: add label chunk range in log when label manager request fails

18 months agoMerge pull request #14583 from ryndia/ecom_dup_fix
Donald Sharp [Fri, 13 Oct 2023 15:47:29 +0000 (11:47 -0400)]
Merge pull request #14583 from ryndia/ecom_dup_fix

bgpd: ecommunity_dup memory leak fix

18 months agoospf6d: fix setting of the forwarding address in AS-External LSAs 14590/head
Renato Westphal [Fri, 13 Oct 2023 13:55:39 +0000 (10:55 -0300)]
ospf6d: fix setting of the forwarding address in AS-External LSAs

When redistributing a local route, ensure the forwarding address field
of AS-External LSAs is only set when the associated nexthop interface
is OSPF-enabled. This is necessary because the OSPF RFC requires that
the AS-External LSA forwarding address should be resolvable using an
intra-area or inter-area path.

Fixes #14462.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
18 months agotests: Add OSPF test for issue 14488 14582/head
Denis Krienbühl [Tue, 10 Oct 2023 20:23:18 +0000 (22:23 +0200)]
tests: Add OSPF test for issue 14488

OSPF on IPv4/IPv6 removes the wrong routes in certain cases, causing
issues when removing and re-enabling interfaces. This test proofs that.

These tests all pass with https://github.com/FRRouting/frr/pull/13340
and the latest master (d2324b7b4a02e9ef6a219578567932addeb7f593).

See https://github.com/FRRouting/frr/issues/14488

Signed-off-by: Denis Krienbühl <denis.krienbuehl@cloudscale.ch>
18 months agoMerge pull request #13340 from leonshaw/fix/rib-del-connected
Donald Sharp [Fri, 13 Oct 2023 12:53:43 +0000 (08:53 -0400)]
Merge pull request #13340 from leonshaw/fix/rib-del-connected

zebra: Fix connected route deletion when multiple entry exists

18 months agozebra: add label chunk range in log when label manager request fails 14584/head
Philippe Guibert [Thu, 12 Oct 2023 15:44:47 +0000 (17:44 +0200)]
zebra: add label chunk range in log when label manager request fails

When the label manager is unable to provide a label chunk to
a routing service, an error message is displayed:

> Oct 11 11:47:27 vsr zebra[163745]: [YMY6E-K9JYD][EC 4043309085] Unable to assign Label Chunk to bgp instance 0

There is missing information on the range that was requested.
Add this information in the log message.

> Oct 11 11:47:27 vsr zebra[163745]: [YMY6E-K9JYD][EC 4043309085] Unable to assign Label Chunk 60 - 60 to bgp instance 0

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
18 months agozebra: merge lm_get_chunk_response() function
Philippe Guibert [Fri, 13 Oct 2023 08:20:30 +0000 (10:20 +0200)]
zebra: merge lm_get_chunk_response() function

This function lm_get_chunk_response() is only called
by label_manager_get_chunk(). Let us move the code of
the function in the caller.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
18 months agoMerge pull request #14580 from donaldsharp/chain_ignore
mobash-rasool [Fri, 13 Oct 2023 10:19:31 +0000 (15:49 +0530)]
Merge pull request #14580 from donaldsharp/chain_ignore

Chain ignore

18 months agoMerge pull request #14576 from LabNConsulting/chopps/short-circuit-guarantee
Igor Ryzhov [Fri, 13 Oct 2023 09:13:20 +0000 (12:13 +0300)]
Merge pull request #14576 from LabNConsulting/chopps/short-circuit-guarantee

lib: msg: make short-circuit connections guaranteed

18 months agobgpd: Ecommunity_dup memory leak fix 14583/head
ryndia [Thu, 12 Oct 2023 22:04:30 +0000 (02:04 +0400)]
bgpd: Ecommunity_dup memory leak fix

The shallow copy of attr wasn't freed when there was no valid label for the momentand the function return therefore creating leaks. The leak below are solved by flushing the shallow copy of attr.

Address Sanitizer Error detected in bgp_vpnv6_per_nexthop_label.test_bgp_vpnv6_per_nexthop_label/r1.asan.bgpd.13409
=================================================================
==13409==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 280 byte(s) in 7 object(s) allocated from:
    #0 0x7f62cd0c9d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x7f62ccac21c3 in qcalloc lib/memory.c:105
    #2 0x5623b8810dc8 in ecommunity_dup bgpd/bgp_ecommunity.c:252
    #3 0x5623b88be8eb in vpn_leak_from_vrf_update bgpd/bgp_mplsvpn.c:1628
    #4 0x5623b88c13b3 in vpn_leak_from_vrf_update_all bgpd/bgp_mplsvpn.c:2005
    #5 0x5623b89beabc in vpn_leak_postchange bgpd/bgp_mplsvpn.h:287
    #6 0x5623b89beabc in af_label_vpn_export_allocation_mode_magic bgpd/bgp_vty.c:9464
    #7 0x5623b89beabc in af_label_vpn_export_allocation_mode bgpd/bgp_vty_clippy.c:2809
    #8 0x7f62cca45511 in cmd_execute_command_real lib/command.c:978
    #9 0x7f62cca459d5 in cmd_execute_command lib/command.c:1036
    #10 0x7f62cca45e54 in cmd_execute lib/command.c:1203
    #11 0x7f62ccb6ee20 in vty_command lib/vty.c:591
    #12 0x7f62ccb6f2cb in vty_execute lib/vty.c:1354
    #13 0x7f62ccb77b95 in vtysh_read lib/vty.c:2362
    #14 0x7f62ccb62b8f in event_call lib/event.c:1969
    #15 0x7f62ccaa5462 in frr_run lib/libfrr.c:1213
    #16 0x5623b87e054b in main bgpd/bgp_main.c:510
    #17 0x7f62cbae7c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Direct leak of 280 byte(s) in 7 object(s) allocated from:
    #0 0x7f62cd0c9d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x7f62ccac21c3 in qcalloc lib/memory.c:105
    #2 0x5623b8810dc8 in ecommunity_dup bgpd/bgp_ecommunity.c:252
    #3 0x5623b88be8eb in vpn_leak_from_vrf_update bgpd/bgp_mplsvpn.c:1628
    #4 0x5623b892e86d in bgp_update bgpd/bgp_route.c:4969
    #5 0x5623b893134d in bgp_nlri_parse_ip bgpd/bgp_route.c:6213
    #6 0x5623b88e2a0e in bgp_nlri_parse bgpd/bgp_packet.c:341
    #7 0x5623b88e4f7c in bgp_update_receive bgpd/bgp_packet.c:2220
    #8 0x5623b88f0474 in bgp_process_packet bgpd/bgp_packet.c:3386
    #9 0x7f62ccb62b8f in event_call lib/event.c:1969
    #10 0x7f62ccaa5462 in frr_run lib/libfrr.c:1213
    #11 0x5623b87e054b in main bgpd/bgp_main.c:510
    #12 0x7f62cbae7c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Direct leak of 280 byte(s) in 7 object(s) allocated from:
    #0 0x7f62cd0c9d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x7f62ccac21c3 in qcalloc lib/memory.c:105
    #2 0x5623b8810dc8 in ecommunity_dup bgpd/bgp_ecommunity.c:252
    #3 0x5623b88be8eb in vpn_leak_from_vrf_update bgpd/bgp_mplsvpn.c:1628
    #4 0x5623b88c13b3 in vpn_leak_from_vrf_update_all bgpd/bgp_mplsvpn.c:2005
    #5 0x5623b89bdebb in vpn_leak_postchange bgpd/bgp_mplsvpn.h:287
    #6 0x5623b89bdebb in af_label_vpn_export_magic bgpd/bgp_vty.c:9547
    #7 0x5623b89bdebb in af_label_vpn_export bgpd/bgp_vty_clippy.c:2868
    #8 0x7f62cca45511 in cmd_execute_command_real lib/command.c:978
    #9 0x7f62cca459d5 in cmd_execute_command lib/command.c:1036
    #10 0x7f62cca45e54 in cmd_execute lib/command.c:1203
    #11 0x7f62ccb6ee20 in vty_command lib/vty.c:591
    #12 0x7f62ccb6f2cb in vty_execute lib/vty.c:1354
    #13 0x7f62ccb77b95 in vtysh_read lib/vty.c:2362
    #14 0x7f62ccb62b8f in event_call lib/event.c:1969
    #15 0x7f62ccaa5462 in frr_run lib/libfrr.c:1213
    #16 0x5623b87e054b in main bgpd/bgp_main.c:510
    #17 0x7f62cbae7c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Direct leak of 240 byte(s) in 6 object(s) allocated from:
    #0 0x7f62cd0c9d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x7f62ccac21c3 in qcalloc lib/memory.c:105
    #2 0x5623b8810dc8 in ecommunity_dup bgpd/bgp_ecommunity.c:252
    #3 0x5623b88be8eb in vpn_leak_from_vrf_update bgpd/bgp_mplsvpn.c:1628
    #4 0x5623b88dc289 in evaluate_paths bgpd/bgp_nht.c:1384
    #5 0x5623b88ddb0b in bgp_process_nexthop_update bgpd/bgp_nht.c:733
    #6 0x5623b88de027 in bgp_parse_nexthop_update bgpd/bgp_nht.c:934
    #7 0x5623b8a03163 in bgp_read_nexthop_update bgpd/bgp_zebra.c:104
    #8 0x7f62ccb92d8a in zclient_read lib/zclient.c:4425
    #9 0x7f62ccb62b8f in event_call lib/event.c:1969
    #10 0x7f62ccaa5462 in frr_run lib/libfrr.c:1213
    #11 0x5623b87e054b in main bgpd/bgp_main.c:510
    #12 0x7f62cbae7c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Direct leak of 120 byte(s) in 3 object(s) allocated from:
    #0 0x7f62cd0c9d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x7f62ccac21c3 in qcalloc lib/memory.c:105
    #2 0x5623b8810dc8 in ecommunity_dup bgpd/bgp_ecommunity.c:252
    #3 0x5623b88be8eb in vpn_leak_from_vrf_update bgpd/bgp_mplsvpn.c:1628
    #4 0x5623b893a406 in bgp_redistribute_add bgpd/bgp_route.c:8692
    #5 0x5623b8a02b3b in zebra_read_route bgpd/bgp_zebra.c:595
    #6 0x7f62ccb92d8a in zclient_read lib/zclient.c:4425
    #7 0x7f62ccb62b8f in event_call lib/event.c:1969
    #8 0x7f62ccaa5462 in frr_run lib/libfrr.c:1213
    #9 0x5623b87e054b in main bgpd/bgp_main.c:510
    #10 0x7f62cbae7c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Direct leak of 80 byte(s) in 2 object(s) allocated from:
    #0 0x7f62cd0c9d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x7f62ccac21c3 in qcalloc lib/memory.c:105
    #2 0x5623b8810dc8 in ecommunity_dup bgpd/bgp_ecommunity.c:252
    #3 0x5623b88be8eb in vpn_leak_from_vrf_update bgpd/bgp_mplsvpn.c:1628
    #4 0x5623b88dc188 in evaluate_paths bgpd/bgp_nht.c:1348
    #5 0x5623b88ddb0b in bgp_process_nexthop_update bgpd/bgp_nht.c:733
    #6 0x5623b88de027 in bgp_parse_nexthop_update bgpd/bgp_nht.c:934
    #7 0x5623b8a03163 in bgp_read_nexthop_update bgpd/bgp_zebra.c:104
    #8 0x7f62ccb92d8a in zclient_read lib/zclient.c:4425
    #9 0x7f62ccb62b8f in event_call lib/event.c:1969
    #10 0x7f62ccaa5462 in frr_run lib/libfrr.c:1213
    #11 0x5623b87e054b in main bgpd/bgp_main.c:510
    #12 0x7f62cbae7c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Indirect leak of 56 byte(s) in 7 object(s) allocated from:
    #0 0x7f62cd0c9b40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
    #1 0x7f62ccac1ee3 in qmalloc lib/memory.c:100
    #2 0x5623b8810eb8 in ecommunity_dup bgpd/bgp_ecommunity.c:256
    #3 0x5623b88be8eb in vpn_leak_from_vrf_update bgpd/bgp_mplsvpn.c:1628
    #4 0x5623b88c13b3 in vpn_leak_from_vrf_update_all bgpd/bgp_mplsvpn.c:2005
    #5 0x5623b89beabc in vpn_leak_postchange bgpd/bgp_mplsvpn.h:287
    #6 0x5623b89beabc in af_label_vpn_export_allocation_mode_magic bgpd/bgp_vty.c:9464
    #7 0x5623b89beabc in af_label_vpn_export_allocation_mode bgpd/bgp_vty_clippy.c:2809
    #8 0x7f62cca45511 in cmd_execute_command_real lib/command.c:978
    #9 0x7f62cca459d5 in cmd_execute_command lib/command.c:1036
    #10 0x7f62cca45e54 in cmd_execute lib/command.c:1203
    #11 0x7f62ccb6ee20 in vty_command lib/vty.c:591
    #12 0x7f62ccb6f2cb in vty_execute lib/vty.c:1354
    #13 0x7f62ccb77b95 in vtysh_read lib/vty.c:2362
    #14 0x7f62ccb62b8f in event_call lib/event.c:1969
    #15 0x7f62ccaa5462 in frr_run lib/libfrr.c:1213
    #16 0x5623b87e054b in main bgpd/bgp_main.c:510
    #17 0x7f62cbae7c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Indirect leak of 56 byte(s) in 7 object(s) allocated from:
    #0 0x7f62cd0c9b40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
    #1 0x7f62ccac1ee3 in qmalloc lib/memory.c:100
    #2 0x5623b8810eb8 in ecommunity_dup bgpd/bgp_ecommunity.c:256
    #3 0x5623b88be8eb in vpn_leak_from_vrf_update bgpd/bgp_mplsvpn.c:1628
    #4 0x5623b892e86d in bgp_update bgpd/bgp_route.c:4969
    #5 0x5623b893134d in bgp_nlri_parse_ip bgpd/bgp_route.c:6213
    #6 0x5623b88e2a0e in bgp_nlri_parse bgpd/bgp_packet.c:341
    #7 0x5623b88e4f7c in bgp_update_receive bgpd/bgp_packet.c:2220
    #8 0x5623b88f0474 in bgp_process_packet bgpd/bgp_packet.c:3386
    #9 0x7f62ccb62b8f in event_call lib/event.c:1969
    #10 0x7f62ccaa5462 in frr_run lib/libfrr.c:1213
    #11 0x5623b87e054b in main bgpd/bgp_main.c:510
    #12 0x7f62cbae7c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Indirect leak of 56 byte(s) in 7 object(s) allocated from:
    #0 0x7f62cd0c9b40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
    #1 0x7f62ccac1ee3 in qmalloc lib/memory.c:100
    #2 0x5623b8810eb8 in ecommunity_dup bgpd/bgp_ecommunity.c:256
    #3 0x5623b88be8eb in vpn_leak_from_vrf_update bgpd/bgp_mplsvpn.c:1628
    #4 0x5623b88c13b3 in vpn_leak_from_vrf_update_all bgpd/bgp_mplsvpn.c:2005
    #5 0x5623b89bdebb in vpn_leak_postchange bgpd/bgp_mplsvpn.h:287
    #6 0x5623b89bdebb in af_label_vpn_export_magic bgpd/bgp_vty.c:9547
    #7 0x5623b89bdebb in af_label_vpn_export bgpd/bgp_vty_clippy.c:2868
    #8 0x7f62cca45511 in cmd_execute_command_real lib/command.c:978
    #9 0x7f62cca459d5 in cmd_execute_command lib/command.c:1036
    #10 0x7f62cca45e54 in cmd_execute lib/command.c:1203
    #11 0x7f62ccb6ee20 in vty_command lib/vty.c:591
    #12 0x7f62ccb6f2cb in vty_execute lib/vty.c:1354
    #13 0x7f62ccb77b95 in vtysh_read lib/vty.c:2362
    #14 0x7f62ccb62b8f in event_call lib/event.c:1969
    #15 0x7f62ccaa5462 in frr_run lib/libfrr.c:1213
    #16 0x5623b87e054b in main bgpd/bgp_main.c:510
    #17 0x7f62cbae7c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Indirect leak of 48 byte(s) in 6 object(s) allocated from:
    #0 0x7f62cd0c9b40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
    #1 0x7f62ccac1ee3 in qmalloc lib/memory.c:100
    #2 0x5623b8810eb8 in ecommunity_dup bgpd/bgp_ecommunity.c:256
    #3 0x5623b88be8eb in vpn_leak_from_vrf_update bgpd/bgp_mplsvpn.c:1628
    #4 0x5623b88dc289 in evaluate_paths bgpd/bgp_nht.c:1384
    #5 0x5623b88ddb0b in bgp_process_nexthop_update bgpd/bgp_nht.c:733
    #6 0x5623b88de027 in bgp_parse_nexthop_update bgpd/bgp_nht.c:934
    #7 0x5623b8a03163 in bgp_read_nexthop_update bgpd/bgp_zebra.c:104
    #8 0x7f62ccb92d8a in zclient_read lib/zclient.c:4425
    #9 0x7f62ccb62b8f in event_call lib/event.c:1969
    #10 0x7f62ccaa5462 in frr_run lib/libfrr.c:1213
    #11 0x5623b87e054b in main bgpd/bgp_main.c:510
    #12 0x7f62cbae7c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Indirect leak of 24 byte(s) in 3 object(s) allocated from:
    #0 0x7f62cd0c9b40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
    #1 0x7f62ccac1ee3 in qmalloc lib/memory.c:100
    #2 0x5623b8810eb8 in ecommunity_dup bgpd/bgp_ecommunity.c:256
    #3 0x5623b88be8eb in vpn_leak_from_vrf_update bgpd/bgp_mplsvpn.c:1628
    #4 0x5623b893a406 in bgp_redistribute_add bgpd/bgp_route.c:8692
    #5 0x5623b8a02b3b in zebra_read_route bgpd/bgp_zebra.c:595
    #6 0x7f62ccb92d8a in zclient_read lib/zclient.c:4425
    #7 0x7f62ccb62b8f in event_call lib/event.c:1969
    #8 0x7f62ccaa5462 in frr_run lib/libfrr.c:1213
    #9 0x5623b87e054b in main bgpd/bgp_main.c:510
    #10 0x7f62cbae7c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Indirect leak of 16 byte(s) in 2 object(s) allocated from:
    #0 0x7f62cd0c9b40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
    #1 0x7f62ccac1ee3 in qmalloc lib/memory.c:100
    #2 0x5623b8810eb8 in ecommunity_dup bgpd/bgp_ecommunity.c:256
    #3 0x5623b88be8eb in vpn_leak_from_vrf_update bgpd/bgp_mplsvpn.c:1628
    #4 0x5623b88dc188 in evaluate_paths bgpd/bgp_nht.c:1348
    #5 0x5623b88ddb0b in bgp_process_nexthop_update bgpd/bgp_nht.c:733
    #6 0x5623b88de027 in bgp_parse_nexthop_update bgpd/bgp_nht.c:934
    #7 0x5623b8a03163 in bgp_read_nexthop_update bgpd/bgp_zebra.c:104
    #8 0x7f62ccb92d8a in zclient_read lib/zclient.c:4425
    #9 0x7f62ccb62b8f in event_call lib/event.c:1969
    #10 0x7f62ccaa5462 in frr_run lib/libfrr.c:1213
    #11 0x5623b87e054b in main bgpd/bgp_main.c:510
    #12 0x7f62cbae7c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

SUMMARY: AddressSanitizer: 1536 byte(s) leaked in 64 allocation(s).
***********************************************************************************

Address Sanitizer Error detected in bgp_vpnv4_per_nexthop_label.test_bgp_vpnv4_per_nexthop_label/r1.asan.bgpd.10610

=================================================================
==10610==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 280 byte(s) in 7 object(s) allocated from:
    #0 0x7f81fc562d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x7f81fbf5b1c3 in qcalloc lib/memory.c:105
    #2 0x55cdc9b28dc8 in ecommunity_dup bgpd/bgp_ecommunity.c:252
    #3 0x55cdc9bd68eb in vpn_leak_from_vrf_update bgpd/bgp_mplsvpn.c:1628
    #4 0x55cdc9c4686d in bgp_update bgpd/bgp_route.c:4969
    #5 0x55cdc9c4934d in bgp_nlri_parse_ip bgpd/bgp_route.c:6213
    #6 0x55cdc9bfaa0e in bgp_nlri_parse bgpd/bgp_packet.c:341
    #7 0x55cdc9bfcf7c in bgp_update_receive bgpd/bgp_packet.c:2220
    #8 0x55cdc9c08474 in bgp_process_packet bgpd/bgp_packet.c:3386
    #9 0x7f81fbffbb8f in event_call lib/event.c:1969
    #10 0x7f81fbf3e462 in frr_run lib/libfrr.c:1213
    #11 0x55cdc9af854b in main bgpd/bgp_main.c:510
    #12 0x7f81faf80c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Direct leak of 280 byte(s) in 7 object(s) allocated from:
    #0 0x7f81fc562d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x7f81fbf5b1c3 in qcalloc lib/memory.c:105
    #2 0x55cdc9b28dc8 in ecommunity_dup bgpd/bgp_ecommunity.c:252
    #3 0x55cdc9bd68eb in vpn_leak_from_vrf_update bgpd/bgp_mplsvpn.c:1628
    #4 0x55cdc9bd93b3 in vpn_leak_from_vrf_update_all bgpd/bgp_mplsvpn.c:2005
    #5 0x55cdc9cd6abc in vpn_leak_postchange bgpd/bgp_mplsvpn.h:287
    #6 0x55cdc9cd6abc in af_label_vpn_export_allocation_mode_magic bgpd/bgp_vty.c:9464
    #7 0x55cdc9cd6abc in af_label_vpn_export_allocation_mode bgpd/bgp_vty_clippy.c:2809
    #8 0x7f81fbede511 in cmd_execute_command_real lib/command.c:978
    #9 0x7f81fbede9d5 in cmd_execute_command lib/command.c:1036
    #10 0x7f81fbedee54 in cmd_execute lib/command.c:1203
    #11 0x7f81fc007e20 in vty_command lib/vty.c:591
    #12 0x7f81fc0082cb in vty_execute lib/vty.c:1354
    #13 0x7f81fc010b95 in vtysh_read lib/vty.c:2362
    #14 0x7f81fbffbb8f in event_call lib/event.c:1969
    #15 0x7f81fbf3e462 in frr_run lib/libfrr.c:1213
    #16 0x55cdc9af854b in main bgpd/bgp_main.c:510
    #17 0x7f81faf80c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Direct leak of 280 byte(s) in 7 object(s) allocated from:
    #0 0x7f81fc562d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x7f81fbf5b1c3 in qcalloc lib/memory.c:105
    #2 0x55cdc9b28dc8 in ecommunity_dup bgpd/bgp_ecommunity.c:252
    #3 0x55cdc9bd68eb in vpn_leak_from_vrf_update bgpd/bgp_mplsvpn.c:1628
    #4 0x55cdc9bd93b3 in vpn_leak_from_vrf_update_all bgpd/bgp_mplsvpn.c:2005
    #5 0x55cdc9cd5ebb in vpn_leak_postchange bgpd/bgp_mplsvpn.h:287
    #6 0x55cdc9cd5ebb in af_label_vpn_export_magic bgpd/bgp_vty.c:9547
    #7 0x55cdc9cd5ebb in af_label_vpn_export bgpd/bgp_vty_clippy.c:2868
    #8 0x7f81fbede511 in cmd_execute_command_real lib/command.c:978
    #9 0x7f81fbede9d5 in cmd_execute_command lib/command.c:1036
    #10 0x7f81fbedee54 in cmd_execute lib/command.c:1203
    #11 0x7f81fc007e20 in vty_command lib/vty.c:591
    #12 0x7f81fc0082cb in vty_execute lib/vty.c:1354
    #13 0x7f81fc010b95 in vtysh_read lib/vty.c:2362
    #14 0x7f81fbffbb8f in event_call lib/event.c:1969
    #15 0x7f81fbf3e462 in frr_run lib/libfrr.c:1213
    #16 0x55cdc9af854b in main bgpd/bgp_main.c:510
    #17 0x7f81faf80c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Direct leak of 240 byte(s) in 6 object(s) allocated from:
    #0 0x7f81fc562d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x7f81fbf5b1c3 in qcalloc lib/memory.c:105
    #2 0x55cdc9b28dc8 in ecommunity_dup bgpd/bgp_ecommunity.c:252
    #3 0x55cdc9bd68eb in vpn_leak_from_vrf_update bgpd/bgp_mplsvpn.c:1628
    #4 0x55cdc9bf4289 in evaluate_paths bgpd/bgp_nht.c:1384
    #5 0x55cdc9bf5b0b in bgp_process_nexthop_update bgpd/bgp_nht.c:733
    #6 0x55cdc9bf6027 in bgp_parse_nexthop_update bgpd/bgp_nht.c:934
    #7 0x55cdc9d1b163 in bgp_read_nexthop_update bgpd/bgp_zebra.c:104
    #8 0x7f81fc02bd8a in zclient_read lib/zclient.c:4425
    #9 0x7f81fbffbb8f in event_call lib/event.c:1969
    #10 0x7f81fbf3e462 in frr_run lib/libfrr.c:1213
    #11 0x55cdc9af854b in main bgpd/bgp_main.c:510
    #12 0x7f81faf80c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Direct leak of 80 byte(s) in 2 object(s) allocated from:
    #0 0x7f81fc562d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x7f81fbf5b1c3 in qcalloc lib/memory.c:105
    #2 0x55cdc9b28dc8 in ecommunity_dup bgpd/bgp_ecommunity.c:252
    #3 0x55cdc9bd68eb in vpn_leak_from_vrf_update bgpd/bgp_mplsvpn.c:1628
    #4 0x55cdc9bf4188 in evaluate_paths bgpd/bgp_nht.c:1348
    #5 0x55cdc9bf5b0b in bgp_process_nexthop_update bgpd/bgp_nht.c:733
    #6 0x55cdc9bf6027 in bgp_parse_nexthop_update bgpd/bgp_nht.c:934
    #7 0x55cdc9d1b163 in bgp_read_nexthop_update bgpd/bgp_zebra.c:104
    #8 0x7f81fc02bd8a in zclient_read lib/zclient.c:4425
    #9 0x7f81fbffbb8f in event_call lib/event.c:1969
    #10 0x7f81fbf3e462 in frr_run lib/libfrr.c:1213
    #11 0x55cdc9af854b in main bgpd/bgp_main.c:510
    #12 0x7f81faf80c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Direct leak of 80 byte(s) in 2 object(s) allocated from:
    #0 0x7f81fc562d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x7f81fbf5b1c3 in qcalloc lib/memory.c:105
    #2 0x55cdc9b28dc8 in ecommunity_dup bgpd/bgp_ecommunity.c:252
    #3 0x55cdc9bd68eb in vpn_leak_from_vrf_update bgpd/bgp_mplsvpn.c:1628
    #4 0x55cdc9bd93b3 in vpn_leak_from_vrf_update_all bgpd/bgp_mplsvpn.c:2005
    #5 0x55cdc9bdafd5 in vpn_leak_postchange bgpd/bgp_mplsvpn.h:287
    #6 0x55cdc9bdafd5 in vpn_leak_label_callback bgpd/bgp_mplsvpn.c:581
    #7 0x55cdc9bb2606 in lp_cbq_docallback bgpd/bgp_labelpool.c:118
    #8 0x7f81fc0164b5 in work_queue_run lib/workqueue.c:266
    #9 0x7f81fbffbb8f in event_call lib/event.c:1969
    #10 0x7f81fbf3e462 in frr_run lib/libfrr.c:1213
    #11 0x55cdc9af854b in main bgpd/bgp_main.c:510
    #12 0x7f81faf80c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Direct leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x7f81fc562d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x7f81fbf5b1c3 in qcalloc lib/memory.c:105
    #2 0x55cdc9b28dc8 in ecommunity_dup bgpd/bgp_ecommunity.c:252
    #3 0x55cdc9bd68eb in vpn_leak_from_vrf_update bgpd/bgp_mplsvpn.c:1628
    #4 0x55cdc9c52406 in bgp_redistribute_add bgpd/bgp_route.c:8692
    #5 0x55cdc9d1ab3b in zebra_read_route bgpd/bgp_zebra.c:595
    #6 0x7f81fc02bd8a in zclient_read lib/zclient.c:4425
    #7 0x7f81fbffbb8f in event_call lib/event.c:1969
    #8 0x7f81fbf3e462 in frr_run lib/libfrr.c:1213
    #9 0x55cdc9af854b in main bgpd/bgp_main.c:510
    #10 0x7f81faf80c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Indirect leak of 56 byte(s) in 7 object(s) allocated from:
    #0 0x7f81fc562b40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
    #1 0x7f81fbf5aee3 in qmalloc lib/memory.c:100
    #2 0x55cdc9b28eb8 in ecommunity_dup bgpd/bgp_ecommunity.c:256
    #3 0x55cdc9bd68eb in vpn_leak_from_vrf_update bgpd/bgp_mplsvpn.c:1628
    #4 0x55cdc9bd93b3 in vpn_leak_from_vrf_update_all bgpd/bgp_mplsvpn.c:2005
    #5 0x55cdc9cd6abc in vpn_leak_postchange bgpd/bgp_mplsvpn.h:287
    #6 0x55cdc9cd6abc in af_label_vpn_export_allocation_mode_magic bgpd/bgp_vty.c:9464
    #7 0x55cdc9cd6abc in af_label_vpn_export_allocation_mode bgpd/bgp_vty_clippy.c:2809
    #8 0x7f81fbede511 in cmd_execute_command_real lib/command.c:978
    #9 0x7f81fbede9d5 in cmd_execute_command lib/command.c:1036
    #10 0x7f81fbedee54 in cmd_execute lib/command.c:1203
    #11 0x7f81fc007e20 in vty_command lib/vty.c:591
    #12 0x7f81fc0082cb in vty_execute lib/vty.c:1354
    #13 0x7f81fc010b95 in vtysh_read lib/vty.c:2362
    #14 0x7f81fbffbb8f in event_call lib/event.c:1969
    #15 0x7f81fbf3e462 in frr_run lib/libfrr.c:1213
    #16 0x55cdc9af854b in main bgpd/bgp_main.c:510
    #17 0x7f81faf80c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Indirect leak of 56 byte(s) in 7 object(s) allocated from:
    #0 0x7f81fc562b40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
    #1 0x7f81fbf5aee3 in qmalloc lib/memory.c:100
    #2 0x55cdc9b28eb8 in ecommunity_dup bgpd/bgp_ecommunity.c:256
    #3 0x55cdc9bd68eb in vpn_leak_from_vrf_update bgpd/bgp_mplsvpn.c:1628
    #4 0x55cdc9bd93b3 in vpn_leak_from_vrf_update_all bgpd/bgp_mplsvpn.c:2005
    #5 0x55cdc9cd5ebb in vpn_leak_postchange bgpd/bgp_mplsvpn.h:287
    #6 0x55cdc9cd5ebb in af_label_vpn_export_magic bgpd/bgp_vty.c:9547
    #7 0x55cdc9cd5ebb in af_label_vpn_export bgpd/bgp_vty_clippy.c:2868
    #8 0x7f81fbede511 in cmd_execute_command_real lib/command.c:978
    #9 0x7f81fbede9d5 in cmd_execute_command lib/command.c:1036
    #10 0x7f81fbedee54 in cmd_execute lib/command.c:1203
    #11 0x7f81fc007e20 in vty_command lib/vty.c:591
    #12 0x7f81fc0082cb in vty_execute lib/vty.c:1354
    #13 0x7f81fc010b95 in vtysh_read lib/vty.c:2362
    #14 0x7f81fbffbb8f in event_call lib/event.c:1969
    #15 0x7f81fbf3e462 in frr_run lib/libfrr.c:1213
    #16 0x55cdc9af854b in main bgpd/bgp_main.c:510
    #17 0x7f81faf80c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Indirect leak of 56 byte(s) in 7 object(s) allocated from:
    #0 0x7f81fc562b40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
    #1 0x7f81fbf5aee3 in qmalloc lib/memory.c:100
    #2 0x55cdc9b28eb8 in ecommunity_dup bgpd/bgp_ecommunity.c:256
    #3 0x55cdc9bd68eb in vpn_leak_from_vrf_update bgpd/bgp_mplsvpn.c:1628
    #4 0x55cdc9c4686d in bgp_update bgpd/bgp_route.c:4969
    #5 0x55cdc9c4934d in bgp_nlri_parse_ip bgpd/bgp_route.c:6213
    #6 0x55cdc9bfaa0e in bgp_nlri_parse bgpd/bgp_packet.c:341
    #7 0x55cdc9bfcf7c in bgp_update_receive bgpd/bgp_packet.c:2220
    #8 0x55cdc9c08474 in bgp_process_packet bgpd/bgp_packet.c:3386
    #9 0x7f81fbffbb8f in event_call lib/event.c:1969
    #10 0x7f81fbf3e462 in frr_run lib/libfrr.c:1213
    #11 0x55cdc9af854b in main bgpd/bgp_main.c:510
    #12 0x7f81faf80c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Indirect leak of 48 byte(s) in 6 object(s) allocated from:
    #0 0x7f81fc562b40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
    #1 0x7f81fbf5aee3 in qmalloc lib/memory.c:100
    #2 0x55cdc9b28eb8 in ecommunity_dup bgpd/bgp_ecommunity.c:256
    #3 0x55cdc9bd68eb in vpn_leak_from_vrf_update bgpd/bgp_mplsvpn.c:1628
    #4 0x55cdc9bf4289 in evaluate_paths bgpd/bgp_nht.c:1384
    #5 0x55cdc9bf5b0b in bgp_process_nexthop_update bgpd/bgp_nht.c:733
    #6 0x55cdc9bf6027 in bgp_parse_nexthop_update bgpd/bgp_nht.c:934
    #7 0x55cdc9d1b163 in bgp_read_nexthop_update bgpd/bgp_zebra.c:104
    #8 0x7f81fc02bd8a in zclient_read lib/zclient.c:4425
    #9 0x7f81fbffbb8f in event_call lib/event.c:1969
    #10 0x7f81fbf3e462 in frr_run lib/libfrr.c:1213
    #11 0x55cdc9af854b in main bgpd/bgp_main.c:510
    #12 0x7f81faf80c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Indirect leak of 16 byte(s) in 2 object(s) allocated from:
    #0 0x7f81fc562b40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
    #1 0x7f81fbf5aee3 in qmalloc lib/memory.c:100
    #2 0x55cdc9b28eb8 in ecommunity_dup bgpd/bgp_ecommunity.c:256
    #3 0x55cdc9bd68eb in vpn_leak_from_vrf_update bgpd/bgp_mplsvpn.c:1628
    #4 0x55cdc9bf4188 in evaluate_paths bgpd/bgp_nht.c:1348
    #5 0x55cdc9bf5b0b in bgp_process_nexthop_update bgpd/bgp_nht.c:733
    #6 0x55cdc9bf6027 in bgp_parse_nexthop_update bgpd/bgp_nht.c:934
    #7 0x55cdc9d1b163 in bgp_read_nexthop_update bgpd/bgp_zebra.c:104
    #8 0x7f81fc02bd8a in zclient_read lib/zclient.c:4425
    #9 0x7f81fbffbb8f in event_call lib/event.c:1969
    #10 0x7f81fbf3e462 in frr_run lib/libfrr.c:1213
    #11 0x55cdc9af854b in main bgpd/bgp_main.c:510
    #12 0x7f81faf80c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Indirect leak of 16 byte(s) in 2 object(s) allocated from:
    #0 0x7f81fc562b40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
    #1 0x7f81fbf5aee3 in qmalloc lib/memory.c:100
    #2 0x55cdc9b28eb8 in ecommunity_dup bgpd/bgp_ecommunity.c:256
    #3 0x55cdc9bd68eb in vpn_leak_from_vrf_update bgpd/bgp_mplsvpn.c:1628
    #4 0x55cdc9bd93b3 in vpn_leak_from_vrf_update_all bgpd/bgp_mplsvpn.c:2005
    #5 0x55cdc9bdafd5 in vpn_leak_postchange bgpd/bgp_mplsvpn.h:287
    #6 0x55cdc9bdafd5 in vpn_leak_label_callback bgpd/bgp_mplsvpn.c:581
    #7 0x55cdc9bb2606 in lp_cbq_docallback bgpd/bgp_labelpool.c:118
    #8 0x7f81fc0164b5 in work_queue_run lib/workqueue.c:266
    #9 0x7f81fbffbb8f in event_call lib/event.c:1969
    #10 0x7f81fbf3e462 in frr_run lib/libfrr.c:1213
    #11 0x55cdc9af854b in main bgpd/bgp_main.c:510
    #12 0x7f81faf80c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Indirect leak of 8 byte(s) in 1 object(s) allocated from:
    #0 0x7f81fc562b40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
    #1 0x7f81fbf5aee3 in qmalloc lib/memory.c:100
    #2 0x55cdc9b28eb8 in ecommunity_dup bgpd/bgp_ecommunity.c:256
    #3 0x55cdc9bd68eb in vpn_leak_from_vrf_update bgpd/bgp_mplsvpn.c:1628
    #4 0x55cdc9c52406 in bgp_redistribute_add bgpd/bgp_route.c:8692
    #5 0x55cdc9d1ab3b in zebra_read_route bgpd/bgp_zebra.c:595
    #6 0x7f81fc02bd8a in zclient_read lib/zclient.c:4425
    #7 0x7f81fbffbb8f in event_call lib/event.c:1969
    #8 0x7f81fbf3e462 in frr_run lib/libfrr.c:1213
    #9 0x55cdc9af854b in main bgpd/bgp_main.c:510
    #10 0x7f81faf80c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

SUMMARY: AddressSanitizer: 1536 byte(s) leaked in 64 allocation(s).
***********************************************************************************

Signed-off-by: ryndia <dindyalsarvesh@gmail.com>
18 months agoMerge pull request #14577 from mjstapp/fix_zebra_nlmsg_unknown
Donald Sharp [Thu, 12 Oct 2023 19:58:22 +0000 (15:58 -0400)]
Merge pull request #14577 from mjstapp/fix_zebra_nlmsg_unknown

zebra: add xxxCHAIN netlink messages to handler, ignore

18 months agoMerge pull request #14578 from opensourcerouting/fix/coverity_1566808
Donald Sharp [Thu, 12 Oct 2023 19:58:08 +0000 (15:58 -0400)]
Merge pull request #14578 from opensourcerouting/fix/coverity_1566808

bgpd: Remove redundant check for bgp against NULL

18 months agomgmtd: clarify the startup dance in comments 14576/head
Christian Hopps [Thu, 12 Oct 2023 18:38:39 +0000 (14:38 -0400)]
mgmtd: clarify the startup dance in comments

Also retry the config read vs. aborting if we haven't got a FE
client connection yet.

Signed-off-by: Christian Hopps <chopps@labn.net>
18 months agobuild: add -Wimplicit-fallthrough 14561/head
Igor Ryzhov [Tue, 10 Oct 2023 21:15:32 +0000 (00:15 +0300)]
build: add -Wimplicit-fallthrough

Also:
- replace all /* fallthrough */ comments with portable fallthrough;
pseudo keyword to accomodate both gcc and clang
- add missing break; statements as required by older versions of gcc
- cleanup some code to remove unnecessary fallthrough

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
18 months agotests: Fixup bgp_link_bw_ip test to new behavior 14553/head
Donald Sharp [Thu, 12 Oct 2023 16:00:07 +0000 (12:00 -0400)]
tests: Fixup bgp_link_bw_ip test to new behavior

Old behavior was metric values between 1-100,
now we have metric values between 1-255.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
18 months agobgpd: Remove unused cumulative bandwidth variable
Donald Sharp [Fri, 29 Sep 2023 19:19:54 +0000 (15:19 -0400)]
bgpd: Remove unused cumulative bandwidth variable

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
18 months agobgpd: Just pass down the Bandwidth unmodified so that Zebra can use it
Donald Sharp [Fri, 29 Sep 2023 19:17:14 +0000 (15:17 -0400)]
bgpd: Just pass down the Bandwidth unmodified so that Zebra can use it

Instead of scaling the bandwith to something between 1 and 100, just
send down the bandwidth Available for the link.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
18 months agozebra: Make ucmp scale value owned by zrouter
Donald Sharp [Thu, 28 Sep 2023 16:44:31 +0000 (12:44 -0400)]
zebra: Make ucmp scale value owned by zrouter

The weight scale value might be useful to have it
change it's behavior at a later time or controlled
by something depending on how FRR is compiled/ran.
Let's start that process

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
18 months agozebra: Score weighted values of ecmp to a number between 1-255
Donald Sharp [Thu, 28 Sep 2023 16:27:31 +0000 (12:27 -0400)]
zebra: Score weighted values of ecmp to a number between 1-255

Currently underlying asics get into a bit of trouble when the
nexthop weight passed down varies wildly between the different
numbers.  Let's normalize the weight values between 1 and 255

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
18 months agoMerge pull request #14579 from Keelan10/fix-nhrpd-leak
Donald Sharp [Thu, 12 Oct 2023 14:59:44 +0000 (10:59 -0400)]
Merge pull request #14579 from Keelan10/fix-nhrpd-leak

nhrpd: Fix nhrp_peer leak

18 months agozebra: Cleanup string generation via clang 14580/head
Donald Sharp [Thu, 12 Oct 2023 14:35:01 +0000 (10:35 -0400)]
zebra: Cleanup string generation via clang

Separate commit for clang-format cleanup of string
messages because I felt it would hide the actual
changes being made to the system.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
18 months agozebra: Add RTM_XXXCHAIN to string outputs
Donald Sharp [Thu, 12 Oct 2023 14:34:21 +0000 (10:34 -0400)]
zebra: Add RTM_XXXCHAIN to string outputs

Let's get some meaningful string output for when FRR receives
these messages.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
18 months agolib: msg: make short-circuit connections guaranteed
Christian Hopps [Thu, 12 Oct 2023 12:34:20 +0000 (08:34 -0400)]
lib: msg: make short-circuit connections guaranteed

When short circuiting is requested the caller can count on that
being the connection type they get.

Signed-off-by: Christian Hopps <chopps@labn.net>
18 months agonhrpd: Fix nhrp_peer leak 14579/head
Keelan10 [Thu, 12 Oct 2023 14:04:52 +0000 (18:04 +0400)]
nhrpd: Fix nhrp_peer leak

- Addressed memory leak by removing `&c->peer_notifier` from the notifier list on termination. Retaining it caused the notifier list to stay active, preventing the deletion of `c->cur.peer`
  thereby causing a memory leak.

- Reordered termination steps to call `vrf_terminate` before `nhrp_vc_terminate`, preventing a heap-use-after-free issue when `nhrp_vc_notify_del` is invoked in `nhrp_peer_check_delete`.

- Added an if statement to avoid passing NULL as hash to `hash_release`, which leads to a SIGSEGV.

The ASan leak log for reference:

```
***********************************************************************************
Address Sanitizer Error detected in nhrp_topo.test_nhrp_topo/r1.asan.nhrpd.20265

=================================================================
==20265==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 112 byte(s) in 1 object(s) allocated from:
    #0 0x7f80270c9b40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
    #1 0x7f8026ac1eb8 in qmalloc lib/memory.c:100
    #2 0x560fd648f0a6 in nhrp_peer_create nhrpd/nhrp_peer.c:175
    #3 0x7f8026a88d3f in hash_get lib/hash.c:147
    #4 0x560fd6490a5d in nhrp_peer_get nhrpd/nhrp_peer.c:228
    #5 0x560fd648a51a in nhrp_nhs_resolve_cb nhrpd/nhrp_nhs.c:297
    #6 0x7f80266b000f in resolver_cb_literal lib/resolver.c:234
    #7 0x7f8026b62e0e in event_call lib/event.c:1969
    #8 0x7f8026aa5437 in frr_run lib/libfrr.c:1213
    #9 0x560fd6488b4f in main nhrpd/nhrp_main.c:166
    #10 0x7f8025eb2c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

SUMMARY: AddressSanitizer: 112 byte(s) leaked in 1 allocation(s).
***********************************************************************************

***********************************************************************************
Address Sanitizer Error detected in nhrp_topo.test_nhrp_topo/r2.asan.nhrpd.20400

=================================================================
==20400==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 112 byte(s) in 1 object(s) allocated from:
    #0 0x7fb6e3ca5b40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
    #1 0x7fb6e369deb8 in qmalloc lib/memory.c:100
    #2 0x562652de40a6 in nhrp_peer_create nhrpd/nhrp_peer.c:175
    #3 0x7fb6e3664d3f in hash_get lib/hash.c:147
    #4 0x562652de5a5d in nhrp_peer_get nhrpd/nhrp_peer.c:228
    #5 0x562652de1e8e in nhrp_packet_recvraw nhrpd/nhrp_packet.c:325
    #6 0x7fb6e373ee0e in event_call lib/event.c:1969
    #7 0x7fb6e3681437 in frr_run lib/libfrr.c:1213
    #8 0x562652dddb4f in main nhrpd/nhrp_main.c:166
    #9 0x7fb6e2a8ec86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

SUMMARY: AddressSanitizer: 112 byte(s) leaked in 1 allocation(s).
***********************************************************************************
```

Signed-off-by: Keelan Cannoo <keelan.cannoo@icloud.com>
18 months agozebra: add RTM_xxxCHAIN message codes, ignore 14577/head
Mark Stapp [Thu, 12 Oct 2023 13:59:44 +0000 (09:59 -0400)]
zebra: add RTM_xxxCHAIN message codes, ignore

We may receive some xxxCHAIN netlink messages, but we ignore
them (currently). Add them to the basic handler callback so
that we don't log errors about them.

Signed-off-by: Mark Stapp <mjs@labn.net>
18 months agobgpd: Remove redundant check for bgp against NULL 14578/head
Donatas Abraitis [Thu, 12 Oct 2023 13:36:45 +0000 (16:36 +0300)]
bgpd: Remove redundant check for bgp against NULL

bgp_orig is never NULL in the code path, and coverity is angry on this.

Let's remove this test at all.

Coverity 1566808

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
18 months agoMerge pull request #14559 from opensourcerouting/feature/update_dev_versions_for_packages
Donald Sharp [Wed, 11 Oct 2023 15:34:57 +0000 (11:34 -0400)]
Merge pull request #14559 from opensourcerouting/feature/update_dev_versions_for_packages

packaging: Increase development version for debian/redhat stuff

18 months agoMerge pull request #14564 from opensourcerouting/fix/mgmtd_vty_port
Donald Sharp [Wed, 11 Oct 2023 15:33:50 +0000 (11:33 -0400)]
Merge pull request #14564 from opensourcerouting/fix/mgmtd_vty_port

mgmtd: Change MGMTD_VTY_PORT to 2623

18 months agoMerge pull request #14537 from opensourcerouting/feature/bgpd_aod
Russ White [Wed, 11 Oct 2023 14:22:26 +0000 (10:22 -0400)]
Merge pull request #14537 from opensourcerouting/feature/bgpd_aod

bgpd: Implement EBGP-OAD peering type

18 months agoMerge pull request #14557 from volodymyrhuti/EIGRP_IF_DELETE_CRASH
Russ White [Wed, 11 Oct 2023 14:17:54 +0000 (10:17 -0400)]
Merge pull request #14557 from volodymyrhuti/EIGRP_IF_DELETE_CRASH

eigrp: use correct memory pool on interface deletion

18 months agoMerge pull request #14528 from opensourcerouting/feature/bgpd_handle_addpath_capabili...
Russ White [Wed, 11 Oct 2023 14:16:18 +0000 (10:16 -0400)]
Merge pull request #14528 from opensourcerouting/feature/bgpd_handle_addpath_capability_via_dynamic_capability

bgpd: Handle Addpath capability using dynamic capabilities

18 months agoMerge pull request #14437 from opensourcerouting/issue/14004
Mark Stapp [Wed, 11 Oct 2023 11:23:41 +0000 (07:23 -0400)]
Merge pull request #14437 from opensourcerouting/issue/14004

vtysh freezed on ospf 'no network' command when there are multiple networks and interfaces

18 months agoMerge pull request #14563 from opensourcerouting/fix/cpuwarning_starvation
Donald Sharp [Wed, 11 Oct 2023 11:21:43 +0000 (07:21 -0400)]
Merge pull request #14563 from opensourcerouting/fix/cpuwarning_starvation

lib: Suppress HOB/STARVATION warnings when running in vtysh

18 months agoMerge pull request #14554 from donaldsharp/bgp_fifo
Donatas Abraitis [Wed, 11 Oct 2023 10:31:04 +0000 (13:31 +0300)]
Merge pull request #14554 from donaldsharp/bgp_fifo

bgpd: Convert the bgp_advertise_attr->adv to a fifo

18 months agomgmtd: Change MGMTD_VTY_PORT to 2623 14564/head
Donatas Abraitis [Wed, 11 Oct 2023 10:27:28 +0000 (13:27 +0300)]
mgmtd: Change MGMTD_VTY_PORT to 2623

This is clashing with PIMv6 (2622).

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
18 months agolib: Suppress HOB/STARVATION warnings when running in vtysh 14563/head
Donatas Abraitis [Mon, 9 Oct 2023 09:03:50 +0000 (12:03 +0300)]
lib: Suppress HOB/STARVATION warnings when running in vtysh

Running ping/traceroute/etc. (any kind of commands that use execute_command()
suffer with this kind of warnings.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
18 months agoMerge pull request #14560 from donaldsharp/linkstate_reversal
Donatas Abraitis [Wed, 11 Oct 2023 05:01:46 +0000 (08:01 +0300)]
Merge pull request #14560 from donaldsharp/linkstate_reversal

Linkstate reversal

18 months agodebian: Increase version for development version to be 9.2 14559/head
Donatas Abraitis [Tue, 10 Oct 2023 16:53:50 +0000 (19:53 +0300)]
debian: Increase version for development version to be 9.2

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
18 months agoredhat: Update frr.spec file with older releases and increase current version
Donatas Abraitis [Tue, 10 Oct 2023 16:50:10 +0000 (19:50 +0300)]
redhat: Update frr.spec file with older releases and increase current version

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
18 months agoRevert "lib: register bgp link-state afi/safi" 14560/head
Donald Sharp [Tue, 10 Oct 2023 20:45:57 +0000 (16:45 -0400)]
Revert "lib: register bgp link-state afi/safi"

This reverts commit 1642a68d60cfade4b2fce72aaef58dea700c65c3.

18 months agoRevert "yang: add bgp link-state"
Donald Sharp [Tue, 10 Oct 2023 20:45:45 +0000 (16:45 -0400)]
Revert "yang: add bgp link-state"

This reverts commit 3cf5ff27155138ad7b7bafd2e815ca1bba5744ea.

18 months agoRevert "bgpd: add bgp link-state address-family configuration context"
Donald Sharp [Tue, 10 Oct 2023 20:45:32 +0000 (16:45 -0400)]
Revert "bgpd: add bgp link-state address-family configuration context"

This reverts commit ae2f3bb5b4eed01df1f7a69c7710c9be519390f6.

18 months agoRevert "bgpd: accept bgp link-state capability"
Donald Sharp [Tue, 10 Oct 2023 20:45:24 +0000 (16:45 -0400)]
Revert "bgpd: accept bgp link-state capability"

This reverts commit 67fe40676eb4e2ca78a41ddd70887af09b29fd9d.

18 months agoRevert "lib: add link-state prefixes"
Donald Sharp [Tue, 10 Oct 2023 20:45:11 +0000 (16:45 -0400)]
Revert "lib: add link-state prefixes"

This reverts commit c8172af6825ad4b10e68b33b8edc22e6e2dc1524.

18 months agoRevert "bgpd: store bgp link-state prefixes"
Donald Sharp [Tue, 10 Oct 2023 20:45:00 +0000 (16:45 -0400)]
Revert "bgpd: store bgp link-state prefixes"

This reverts commit 39a8d354c11f6f063fa5154f5807e7a0c9b04b46.

18 months agoRevert "bgpd: send bgp link-state prefixes"
Donald Sharp [Tue, 10 Oct 2023 20:44:51 +0000 (16:44 -0400)]
Revert "bgpd: send bgp link-state prefixes"

This reverts commit 0c94fb9cc853b3bcc98e8acca9fd03a036d33c92.

18 months agoRevert "bgpd, lib: extend the size of the prefix string buffer"
Donald Sharp [Tue, 10 Oct 2023 20:44:34 +0000 (16:44 -0400)]
Revert "bgpd, lib: extend the size of the prefix string buffer"

This reverts commit bdb3fa3b9216aede64c5b982011fb04ef25c67f7.

18 months agoRevert "bgpd: do not display vty output headers for link-state prefixes"
Donald Sharp [Tue, 10 Oct 2023 20:44:26 +0000 (16:44 -0400)]
Revert "bgpd: do not display vty output headers for link-state prefixes"

This reverts commit 3098772467ad8a46a8f35cdd4e502806740b2064.

18 months agoRevert "bgpd: display link-state prefixes detail"
Donald Sharp [Tue, 10 Oct 2023 20:44:11 +0000 (16:44 -0400)]
Revert "bgpd: display link-state prefixes detail"

This reverts commit 7e0d9ff8ba984966689562553afe2734b04c8539.

18 months agoRevert "bgpd: do not announce link-state routes to zebra"
Donald Sharp [Tue, 10 Oct 2023 20:43:59 +0000 (16:43 -0400)]
Revert "bgpd: do not announce link-state routes to zebra"

This reverts commit 39fb34275f827b3e1134549ed1731d74e72e6c79.

18 months agoRevert "bgpd: add bgp default link-state command"
Donald Sharp [Tue, 10 Oct 2023 20:43:48 +0000 (16:43 -0400)]
Revert "bgpd: add bgp default link-state command"

This reverts commit 38a7e20fc98ed750d9b2cdae1c79d1e19ceadcd3.

18 months agoRevert "bgpd: add show bgp link-state link-state commands"
Donald Sharp [Tue, 10 Oct 2023 20:43:38 +0000 (16:43 -0400)]
Revert "bgpd: add show bgp link-state link-state commands"

This reverts commit f11f67033fe20f0b4aeb6c885949abb060324749.

18 months agoRevert "bgpd: add linkstate debug"
Donald Sharp [Tue, 10 Oct 2023 20:43:28 +0000 (16:43 -0400)]
Revert "bgpd: add linkstate debug"

This reverts commit de38eada9c0527758bca34984d2f018670d74c9a.

18 months agoRevert "tests: add bgp_linkstate_topo1"
Donald Sharp [Tue, 10 Oct 2023 20:43:17 +0000 (16:43 -0400)]
Revert "tests: add bgp_linkstate_topo1"

This reverts commit a0e6cd4c8fb954f66546b056b0016b4ca7a0a430.

18 months agoRevert "doc: move bgp references at the right place"
Donald Sharp [Tue, 10 Oct 2023 20:43:07 +0000 (16:43 -0400)]
Revert "doc: move bgp references at the right place"

This reverts commit 709fe971fdd998687fdb9d1e36eca3fb9c8b3265.

18 months agoRevert "doc: add the bgp link-state user documentation"
Donald Sharp [Tue, 10 Oct 2023 20:42:58 +0000 (16:42 -0400)]
Revert "doc: add the bgp link-state user documentation"

This reverts commit 115f4f1dddb47a05c3e9454cc0fc88f34ebeb281.

18 months agoRevert "bgpd: store and send bgp link-state attributes"
Donald Sharp [Tue, 10 Oct 2023 20:42:47 +0000 (16:42 -0400)]
Revert "bgpd: store and send bgp link-state attributes"

This reverts commit 8b531b110756bf8627b5716f433190a0748b5e76.

18 months agoRevert "tests: add link-state attribute display in bgp_linkstate_topo1"
Donald Sharp [Tue, 10 Oct 2023 20:33:07 +0000 (16:33 -0400)]
Revert "tests: add link-state attribute display in bgp_linkstate_topo1"

This reverts commit 5727195cbf7d4c5ea63e307d553e039fa1f9e96f.

18 months agoRevert "doc: add information to display bgp-ls attributes"
Donald Sharp [Tue, 10 Oct 2023 20:32:55 +0000 (16:32 -0400)]
Revert "doc: add information to display bgp-ls attributes"

This reverts commit 8074d6f438bfb6c0cc98626b54919ce10f190125.

18 months agoRevert "bgpd: do not check attr in bgp_packet_attribute"
Donald Sharp [Tue, 10 Oct 2023 20:31:28 +0000 (16:31 -0400)]
Revert "bgpd: do not check attr in bgp_packet_attribute"

This reverts commit eb9e2865116777661c44963769c1a5fed764b7f9.

18 months agoRevert "bgpd: fix illegal memory access in bgp_ls_tlv_check_size()"
Donald Sharp [Tue, 10 Oct 2023 20:31:01 +0000 (16:31 -0400)]
Revert "bgpd: fix illegal memory access in bgp_ls_tlv_check_size()"

This reverts commit dae5791c446cd18d8cda93a1e578fff2cd27be10.

18 months agoospfd: Fixing infinite loop when listing OSPF interfaces 14437/head
Rodrigo Nardi [Mon, 18 Sep 2023 20:40:35 +0000 (17:40 -0300)]
ospfd: Fixing infinite loop when listing OSPF interfaces

The problem was happening because the ospf->oiflist has this behaviour, each interface was removed and added at the end of the list in each ospf_network_run_subnet call, generation an infinite loop.
As a solution, a copy of the list was generated and we interacted with a fixed list.

Signed-off-by: Rodrigo Nardi <rnardi@netdef.org>
18 months agoRevert "bgpd: fix link_state_hash_cmp()"
Donald Sharp [Tue, 10 Oct 2023 17:31:19 +0000 (13:31 -0400)]
Revert "bgpd: fix link_state_hash_cmp()"

This reverts commit 25408c8dbf7d9e0149ceb2dcbd2058860ce4f6c5.

18 months agoRevert "bgpd: fix insecure data write with ip addresses"
Donald Sharp [Tue, 10 Oct 2023 17:31:13 +0000 (13:31 -0400)]
Revert "bgpd: fix insecure data write with ip addresses"

This reverts commit 54222f921305edbce74e81996e9303c0c6b03823.

18 months agoRevert "bgpd: fix insecure data write with area addresses"
Donald Sharp [Tue, 10 Oct 2023 17:31:06 +0000 (13:31 -0400)]
Revert "bgpd: fix insecure data write with area addresses"

This reverts commit 57d0dc565f6a99c3d61b9b67a40ad88a83773eb6.

18 months agoRevert "bgpd: fix printing link state ospf opaque data"
Donald Sharp [Tue, 10 Oct 2023 17:30:57 +0000 (13:30 -0400)]
Revert "bgpd: fix printing link state ospf opaque data"

This reverts commit e1333d12e0d3ba8a9a0ca914dc72d0908dea494e.

18 months agoeigrp: use correct memory pool on interface deletion 14557/head
Volodymyr Huti [Tue, 10 Oct 2023 16:10:18 +0000 (19:10 +0300)]
eigrp: use correct memory pool on interface deletion

Trying to delete an interface during the test test_eigrp_topo1.py triggers a crash.
```
EIGRP: abort+0x12b
EIGRP: _zlog_assert_failed+0x18c
EIGRP: mt_count_free+0x56
EIGRP: qfree+0x2e
EIGRP: eigrp_if_delete_hook+0x8c
EIGRP: hook_call_if_del+0x5f
EIGRP: if_delete_retain+0x1c
EIGRP: if_delete+0xfb
EIGRP: if_destroy_via_zapi+0x69
EIGRP: zclient_interface_delete+0x57
EIGRP: zclient_read+0x3d0
EIGRP: event_call+0xd8
EIGRP: frr_run+0x271
EIGRP: main+0x14b
EIGRP: __libc_start_main+0xf3
EIGRP: _start+0x2e
EIGRP: in thread zclient_read scheduled from lib/zclient.c:4514 zclient_event()
```

Signed-off-by: Volodymyr Huti <v.huti@vyos.io>
18 months agobuild: FRR 9.2 development version frr-9.2-dev
Donatas Abraitis [Tue, 10 Oct 2023 16:43:56 +0000 (19:43 +0300)]
build: FRR 9.2 development version

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
18 months agoMerge pull request #13617 from anlancs/fix/pimd-remove-pimreg-vrf mergify/bp/dev/9.1/pr-13617 base_9.1
mobash-rasool [Tue, 10 Oct 2023 16:40:24 +0000 (22:10 +0530)]
Merge pull request #13617 from anlancs/fix/pimd-remove-pimreg-vrf

pimd: Fix missing pimreg interface

18 months agoMerge pull request #14535 from opensourcerouting/fix/bgp_aggregate_stuff
Russ White [Tue, 10 Oct 2023 15:36:34 +0000 (11:36 -0400)]
Merge pull request #14535 from opensourcerouting/fix/bgp_aggregate_stuff

bgpd: Drop redundant assignment for aspath segment type and length

18 months agoMerge pull request #14515 from mjstapp/fix_nhg_intf_uninstall
Chirag Shah [Tue, 10 Oct 2023 15:30:55 +0000 (08:30 -0700)]
Merge pull request #14515 from mjstapp/fix_nhg_intf_uninstall

zebra: be more careful removing 'installed' flag from nhgs

18 months agoMerge pull request #14548 from raja-rajasekar/frr_dev1
Russ White [Tue, 10 Oct 2023 15:05:11 +0000 (11:05 -0400)]
Merge pull request #14548 from raja-rajasekar/frr_dev1

zebra: Prevent leaking ctx memory in err condition

18 months agoMerge pull request #14550 from Keelan10/fix-nexthop_group-leak
Donald Sharp [Tue, 10 Oct 2023 14:11:48 +0000 (10:11 -0400)]
Merge pull request #14550 from Keelan10/fix-nexthop_group-leak

zebra: Free nexthop_group

18 months agobgpd: Convert the bgp_advertise_attr->adv to a fifo 14554/head
Donald Sharp [Fri, 6 Oct 2023 16:48:38 +0000 (12:48 -0400)]
bgpd: Convert the bgp_advertise_attr->adv to a fifo

BGP is storing outgoing updates in a couple of different
fifo's.  This is to ensure proper packet packing of
all bgp_dests that happen to use the same attribute.

How it's all put together currently:  On initial update
BGP walks through all the bgp_dest's in a table.  For each
path being sent a bgp_advertise is created.  This bgp_advertise
is placed in fifo order on the bgp_synchronize->update queue.
The bgp_advertise has a pointer to the bgp_advertise_attr which
is associated iwth the actual attribute that is being sent to
it's peer.  In turn this bgp_advertise is placed in a fifo off
of the bgp_advertise_attr structure.  As such as we have paths
that share an attribute, the path/dest is placed on the
bgp_syncrhonize->update fifo as well as being placed on the fifo
associated with the advertised attribute.

On actual creation of a packet.  The first item in the
bgp_synchronize->update fifo is popped.  The bgp_advertise_attr
pointer is grabbed, we fill out the nlri part of the bgp packet
and then walk the bgp_advertise_attr fifo to place paths/dests in
the packet.  As each path/dest is placed in the packet it is removed
from both the bgp_synchronize->update fifo and the bgp_advertise_attr
fifo.

The whole point of this change is to switch the *next, *prev
pointers in the bgp_advertise structure with a typesafe data
structure.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
18 months agozebra: Free nexthop_group 14550/head
Keelan10 [Tue, 10 Oct 2023 09:13:09 +0000 (13:13 +0400)]
zebra: Free nexthop_group

`ng` was not properly freed, leading to a memory leak.
The commit calls `nexthop_group_delete` to free memory associated with `ng`.

The ASan leak log for reference:

```
***********************************************************************************
Address Sanitizer Error detected in isis_topo1.test_isis_topo1/r5.asan.zebra.24308

=================================================================
==24308==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 32 byte(s) in 1 object(s) allocated from:
    #0 0x7f4f47b43d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x7f4f4753c0a8 in qcalloc lib/memory.c:105
    #2 0x7f4f47559526 in nexthop_group_new lib/nexthop_group.c:270
    #3 0x562ded6a39d4 in zebra_add_import_table_entry zebra/redistribute.c:681
    #4 0x562ded787c35 in rib_link zebra/zebra_rib.c:3972
    #5 0x562ded787c35 in rib_addnode zebra/zebra_rib.c:3993
    #6 0x562ded787c35 in process_subq_early_route_add zebra/zebra_rib.c:2860
    #7 0x562ded787c35 in process_subq_early_route zebra/zebra_rib.c:3138
    #8 0x562ded787c35 in process_subq zebra/zebra_rib.c:3178
    #9 0x562ded787c35 in meta_queue_process zebra/zebra_rib.c:3228
    #10 0x7f4f475f7118 in work_queue_run lib/workqueue.c:266
    #11 0x7f4f475dc7f2 in event_call lib/event.c:1969
    #12 0x7f4f4751f347 in frr_run lib/libfrr.c:1213
    #13 0x562ded69e818 in main zebra/main.c:486
    #14 0x7f4f468ffc86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Indirect leak of 152 byte(s) in 1 object(s) allocated from:
    #0 0x7f4f47b43d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x7f4f4753c0a8 in qcalloc lib/memory.c:105
    #2 0x7f4f475510ad in nexthop_new lib/nexthop.c:376
    #3 0x7f4f475539c5 in nexthop_dup lib/nexthop.c:914
    #4 0x7f4f4755b27a in copy_nexthops lib/nexthop_group.c:444
    #5 0x562ded6a3a1c in zebra_add_import_table_entry zebra/redistribute.c:682
    #6 0x562ded787c35 in rib_link zebra/zebra_rib.c:3972
    #7 0x562ded787c35 in rib_addnode zebra/zebra_rib.c:3993
    #8 0x562ded787c35 in process_subq_early_route_add zebra/zebra_rib.c:2860
    #9 0x562ded787c35 in process_subq_early_route zebra/zebra_rib.c:3138
    #10 0x562ded787c35 in process_subq zebra/zebra_rib.c:3178
    #11 0x562ded787c35 in meta_queue_process zebra/zebra_rib.c:3228
    #12 0x7f4f475f7118 in work_queue_run lib/workqueue.c:266
    #13 0x7f4f475dc7f2 in event_call lib/event.c:1969
    #14 0x7f4f4751f347 in frr_run lib/libfrr.c:1213
    #15 0x562ded69e818 in main zebra/main.c:486
    #16 0x7f4f468ffc86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

SUMMARY: AddressSanitizer: 184 byte(s) leaked in 2 allocation(s).
***********************************************************************************
```

Signed-off-by: Keelan Cannoo <keelan.cannoo@icloud.com>
18 months agoMerge pull request #14451 from m-varasteh/ospf-coverity-issues
Donatas Abraitis [Tue, 10 Oct 2023 06:01:03 +0000 (09:01 +0300)]
Merge pull request #14451 from m-varasteh/ospf-coverity-issues

ospfd: a possible fix for TAINTED_SCALAR coverity issues

18 months agoMerge pull request #14533 from mjstapp/fix_rule_notify_vrf
Donald Sharp [Mon, 9 Oct 2023 18:07:12 +0000 (14:07 -0400)]
Merge pull request #14533 from mjstapp/fix_rule_notify_vrf

lib,*: add vrf id to pbr rule results zapi message

18 months agozebra: Prevent leaking ctx memory in err condition 14548/head
Rajasekar Raja [Mon, 9 Oct 2023 16:54:54 +0000 (16:54 +0000)]
zebra: Prevent leaking ctx memory in err condition

When netlink_link_change() errors out for a new link for
interface without MTU set, the allocated ctx is not freed..
Adding code for correctness

Ticket# 3628313

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
18 months agoMerge pull request #14543 from mjstapp/fix_pbr_rule_unique
Donald Sharp [Mon, 9 Oct 2023 14:36:00 +0000 (10:36 -0400)]
Merge pull request #14543 from mjstapp/fix_pbr_rule_unique

zebra: add zclient to iprules key

18 months agoMerge pull request #10733 from anlancs/zebra-remove-update
Rafael Zalamena [Sun, 8 Oct 2023 13:52:54 +0000 (10:52 -0300)]
Merge pull request #10733 from anlancs/zebra-remove-update

zebra: remove ZEBRA_INTERFACE_VRF_UPDATE

18 months agoMerge pull request #14541 from idryzhov/isis-fix-cb-destroy
Rafael Zalamena [Sun, 8 Oct 2023 13:49:03 +0000 (10:49 -0300)]
Merge pull request #14541 from idryzhov/isis-fix-cb-destroy

isisd: remove redundant northbound destroy callbacks

18 months agodoc: replace commands list with header file 10733/head
anlan_cs [Sat, 7 Oct 2023 02:03:49 +0000 (10:03 +0800)]
doc: replace commands list with header file

Signed-off-by: anlan_cs <anlan_cs@tom.com>
18 months ago*: remove ZEBRA_INTERFACE_VRF_UPDATE
anlan_cs [Fri, 4 Mar 2022 13:52:27 +0000 (21:52 +0800)]
*: remove ZEBRA_INTERFACE_VRF_UPDATE

Currently when one interface changes its VRF, zebra will send these messages to
all daemons in *order*:
    1) `ZEBRA_INTERFACE_DELETE` ( notify them delete from old VRF )
    2) `ZEBRA_INTERFACE_VRF_UPDATE` ( notify them move from old to new VRF )
    3) `ZEBRA_INTERFACE_ADD` ( notify them added into new VRF )

When daemons deal with `VRF_UPDATE`, they use
`zebra_interface_vrf_update_read()->if_lookup_by_name()`
to check the interface exist or not in old VRF. This check will always return
*NULL* because `DELETE` ( deleted from old VRF ) is already done, so can't
find this interface in old VRF.

Send `VRF_UPDATE` is redundant and unuseful. `DELETE` and `ADD` are enough,
they will deal with RB tree, so don't send this `VRF_UPDATE` message when
vrf changes.

Since all daemons have good mechanism to deal with changing vrf, and don't
use this `VRF_UPDATE` mechanism.  So, it is safe to completely remove
all the code with `VRF_UPDATE`.

Signed-off-by: anlan_cs <anlan_cs@tom.com>
18 months agobgpd: Implement EBGP-OAD peering type 14537/head
Donatas Abraitis [Fri, 6 Oct 2023 11:51:18 +0000 (14:51 +0300)]
bgpd: Implement EBGP-OAD peering type

At each EBGP boundary, BGP path attributes are modified as per [RFC4271], which includes stripping any IBGP-only attributes.

Some networks span more than one autonomous system and require more flexibility in the propagation of path attributes. It is worth noting that these multi-AS networks have a common or single administrative entity. These networks are said to belong to One Administrative Domain (OAD). It is desirable to carry IBGP-only attributes across EBGP peerings when the peers belong to an OAD.

This document defines a new EBGP peering type known as EBGP-OAD, which is used between two EBGP peers that belong to an OAD. This document also defines rules for route announcement and processing for EBGP-OAD peers.

https://datatracker.ietf.org/doc/html/draft-uttaro-idr-bgp-oad

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
18 months agotests: Check if EBGP-OAD works
Donatas Abraitis [Fri, 6 Oct 2023 11:48:04 +0000 (14:48 +0300)]
tests: Check if EBGP-OAD works

https://datatracker.ietf.org/doc/html/draft-uttaro-idr-bgp-oad

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
18 months agodoc: Add `neighbor oad` command
Donatas Abraitis [Fri, 6 Oct 2023 11:47:32 +0000 (14:47 +0300)]
doc: Add `neighbor oad` command

https://datatracker.ietf.org/doc/html/draft-uttaro-idr-bgp-oad

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
18 months agozebra: add zclient to iprules key 14543/head
Mark Stapp [Fri, 6 Oct 2023 16:26:38 +0000 (12:26 -0400)]
zebra: add zclient to iprules key

Include a zclient value in the hash and tree key computations
for iprules in zebra: clients may collide without this.

Signed-off-by: Mark Stapp <mjs@labn.net>
18 months agoisisd: remove redundant northbound destroy callbacks 14541/head
Igor Ryzhov [Fri, 6 Oct 2023 14:33:35 +0000 (17:33 +0300)]
isisd: remove redundant northbound destroy callbacks

Fixes startup warnings:
```
ISIS: [ZKB8W-3S2Q4][EC 100663330] unneeded 'destroy' callback for '/frr-isisd:isis/instance/segment-routing-srv6/msd/node-msd/max-segs-left'
ISIS: [ZKB8W-3S2Q4][EC 100663330] unneeded 'destroy' callback for '/frr-isisd:isis/instance/segment-routing-srv6/msd/node-msd/max-end-pop'
ISIS: [ZKB8W-3S2Q4][EC 100663330] unneeded 'destroy' callback for '/frr-isisd:isis/instance/segment-routing-srv6/msd/node-msd/max-h-encaps'
ISIS: [ZKB8W-3S2Q4][EC 100663330] unneeded 'destroy' callback for '/frr-isisd:isis/instance/segment-routing-srv6/msd/node-msd/max-end-d'
```

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
18 months agolib,*: add vrf id to pbr rule results zapi message 14533/head
Mark Stapp [Thu, 5 Oct 2023 15:02:42 +0000 (11:02 -0400)]
lib,*: add vrf id to pbr rule results zapi message

The iprule/pbr rule object has a vrf id, and zebra uses
that internally, but the vrf id isn't returned to clients
who install rules and are waiting for results. Include the
vrf_id sent by the client in the zapi result notification
message; update the existing clients so they decode the id.

Signed-off-by: Mark Stapp <mjs@labn.net>