]> git.puffer.fish Git - mirror/frr.git/log
mirror/frr.git
16 months agopathd: fix excessive doc string on pcep msd command 14925/head
Philippe Guibert [Fri, 1 Dec 2023 08:24:50 +0000 (09:24 +0100)]
pathd: fix excessive doc string on pcep msd command

The following message appears after starting pathd:
> root@ubuntu2204:~# vtysh
> 2023/10/31 05:59:10 [K2CCG-5Y7ZJ] Excessive docstring while parsing 'msd (1-32)'
> 2023/10/31 05:59:10 [W7ENN-K2SVA] ----------
> 2023/10/31 05:59:10 [WCW75-6TZPF] PCC maximum SID depth value
> 2023/10/31 05:59:10 [W7ENN-K2SVA] ----------

Remove the excessive doc string in the pcep msd command.

Fixes: d6d2527448ef ("pathd: fix 'no msd' command not possible under pcc node")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
16 months agoMerge pull request #14914 from idryzhov/mgmt-validate
Donatas Abraitis [Fri, 1 Dec 2023 07:01:05 +0000 (09:01 +0200)]
Merge pull request #14914 from idryzhov/mgmt-validate

mgmtd: validate candidate yang tree before creating a config diff

16 months agoMerge pull request #14909 from chiragshah6/fdev4
Donatas Abraitis [Thu, 30 Nov 2023 09:25:48 +0000 (11:25 +0200)]
Merge pull request #14909 from chiragshah6/fdev4

bgpd: aggr summary-only suppressed export to evpn

16 months agoMerge pull request #14907 from Keelan10/bgp_srv6-leak
Donatas Abraitis [Thu, 30 Nov 2023 07:22:57 +0000 (09:22 +0200)]
Merge pull request #14907 from Keelan10/bgp_srv6-leak

bgpd: Free Memory for SRv6 Functions and Locator Chunks

16 months agobgpd: lttng tp add evpn route events 14909/head
Chirag Shah [Thu, 7 Sep 2023 22:51:32 +0000 (15:51 -0700)]
bgpd: lttng tp add evpn route events

Ticket:#3597393
Testing Done:

2023-09-08T22:53:03.532 frr_bgp:evpn_withdraw_type5 {'vrf_id': 42, 'ip':
'53.1.1.0'}
2023-09-08T22:53:06.207 frr_bgp:evpn_advertise_type5 {'vrf_id': 42,
'ip': '53.1.1.0', 'rmac': '00:02:00:00:00:38', 'vtep': '27.0.0.15'}

2023-09-08T21:51:15.637 frr_bgp:evpn_mh_local_ead_es_evi_route_upd
{'esi': '03:44:38:39:ff:ff:01:00:00:03', 'vni': 1000, 'route_type': 1,
'vtep': '27.0.0.15'}

2023-09-08T20:45:17.059 frr_bgp:evpn_mh_local_ead_es_evi_route_del
{'esi': '03:44:38:39:ff:ff:01:00:00:01', 'vni': 0, 'route_type': 4,
'vtep': '27.0.0.15'}

2023-09-08T21:51:18.363 frr_bgp:evpn_mh_es_evi_vtep_add {'esi':
'03:44:38:39:ff:ff:01:00:00:02', 'vni': 1000, 'vtep': '27.0.0.16',
'ead_es': 1}

2023-09-08T20:43:50.206 frr_bgp:evpn_mh_es_evi_vtep_del {'esi':
'03:44:38:39:ff:ff:01:00:00:01', 'vni': 1002, 'vtep': '27.0.0.16',
'ead_es': 0}

Signed-off-by: Chirag Shah <chirag@nvidia.com>
16 months agobgpd: aggr summary-only suppressed export to evpn
Chirag Shah [Sat, 23 Sep 2023 00:19:09 +0000 (17:19 -0700)]
bgpd: aggr summary-only suppressed export to evpn

When exporting bgp vrf instance unicast route into
EVPN as type-5, check for suppressed ones and do not
export them.

Ticket:#3534718
Testing Done:

Config:

router bgp 660000 vrf vrf1
 bgp router-id 144.1.1.2
 no bgp network import-check
 neighbor 144.1.1.1 remote-as external
 !
 address-family ipv4 unicast
  aggregate-address 50.1.0.0/16 summary-only
  redistribute connected
 exit-address-family
 !
 address-family l2vpn evpn
  advertise ipv4 unicast
 exit-address-family
exit

v4 suppressed route: (5 suppressed routes not exported to evpn)

tor1# vtysh -c "show bgp vrf vrf1 ipv4 unicast" | grep "50.1"
*> 50.1.0.0/16      0.0.0.0(bordertor-11)
s> 50.1.1.212/32    6.0.0.30(leaf-11)<
s> 50.1.1.222/32    6.0.0.31(leaf-11)<
s> 50.1.110.0/24    0.0.0.0(bordertor-11)
s> 50.1.210.214/32  6.0.0.30(leaf-11)<
s> 50.1.220.224/32  6.0.0.31(leaf-11)<

tor1# vtysh -c "show bgp l2vpn evpn route" | grep -A3 "*> \[5\].*\[50.1"
*> [5]:[0]:[16]:[50.1.0.0] RD 144.1.1.2:7
                    6.0.0.1 (bordertor-11)
                                             0         32768 ?
                    ET:8 RT:4640:104001 Rmac:00:02:00:00:00:04

Signed-off-by: Chirag Shah <chirag@nvidia.com>
17 months agomgmtd: validate candidate yang tree before creating a config diff 14914/head
Igor Ryzhov [Tue, 14 Nov 2023 19:17:24 +0000 (20:17 +0100)]
mgmtd: validate candidate yang tree before creating a config diff

The candidate yang tree should be validated before `nb_config_diff` is
called. `nb_config_diff` ignores all prohibited operations and can
provide an empty change list because of this. For example, if a user
deletes a mandatory node from the candidate datastore and tries to make
a commit, they'll receive the "No changes found to be committed!" error,
because such a change is ignored by `nb_config_diff`. Instead, mgmtd
should tell the user that their candidate datastore is not valid and
can't be commited.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
17 months agoMerge pull request #14906 from Keelan10/bgp_confederation-leak
Donald Sharp [Wed, 29 Nov 2023 18:49:37 +0000 (13:49 -0500)]
Merge pull request #14906 from Keelan10/bgp_confederation-leak

bgpd: Free Memory for confed_peers in bgp_free

17 months agoMerge pull request #14908 from Keelan10/zebra-tc-leak
Donald Sharp [Wed, 29 Nov 2023 18:48:45 +0000 (13:48 -0500)]
Merge pull request #14908 from Keelan10/zebra-tc-leak

zebra: Set Free Functions for Traffic Control Hash Tables

17 months agobgpd: Free Memory for SRv6 Functions and Locator Chunks 14907/head
Keelan10 [Wed, 29 Nov 2023 11:49:58 +0000 (15:49 +0400)]
bgpd: Free Memory for SRv6 Functions and Locator Chunks

Implement proper memory cleanup for SRv6 functions and locator chunks to prevent potential memory leaks.
The list callback deletion functions have been set.

The ASan leak log for reference:

```
***********************************************************************************
Address Sanitizer Error detected in bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.asan.bgpd.4180

=================================================================
==4180==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 544 byte(s) in 2 object(s) allocated from:
    #0 0x7f8d176a0d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x7f8d1709f238 in qcalloc lib/memory.c:105
    #2 0x55d5dba6ee75 in sid_register bgpd/bgp_mplsvpn.c:591
    #3 0x55d5dba6ee75 in alloc_new_sid bgpd/bgp_mplsvpn.c:712
    #4 0x55d5dba6f3ce in ensure_vrf_tovpn_sid_per_af bgpd/bgp_mplsvpn.c:758
    #5 0x55d5dba6fb94 in ensure_vrf_tovpn_sid bgpd/bgp_mplsvpn.c:849
    #6 0x55d5dba7f975 in vpn_leak_postchange bgpd/bgp_mplsvpn.h:299
    #7 0x55d5dba7f975 in vpn_leak_postchange_all bgpd/bgp_mplsvpn.c:3704
    #8 0x55d5dbbb6c66 in bgp_zebra_process_srv6_locator_chunk bgpd/bgp_zebra.c:3164
    #9 0x7f8d1716f08a in zclient_read lib/zclient.c:4459
    #10 0x7f8d1713f034 in event_call lib/event.c:1974
    #11 0x7f8d1708242b in frr_run lib/libfrr.c:1214
    #12 0x55d5db99d19d in main bgpd/bgp_main.c:510
    #13 0x7f8d160c5c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Direct leak of 296 byte(s) in 1 object(s) allocated from:
    #0 0x7f8d176a0d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x7f8d1709f238 in qcalloc lib/memory.c:105
    #2 0x7f8d170b1d5f in srv6_locator_chunk_alloc lib/srv6.c:135
    #3 0x55d5dbbb6a19 in bgp_zebra_process_srv6_locator_chunk bgpd/bgp_zebra.c:3144
    #4 0x7f8d1716f08a in zclient_read lib/zclient.c:4459
    #5 0x7f8d1713f034 in event_call lib/event.c:1974
    #6 0x7f8d1708242b in frr_run lib/libfrr.c:1214
    #7 0x55d5db99d19d in main bgpd/bgp_main.c:510
    #8 0x7f8d160c5c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)
***********************************************************************************

```

Signed-off-by: Keelan Cannoo <keelan.cannoo@icloud.com>
17 months agoMerge pull request #14896 from zarkdav/patch-1
Donald Sharp [Wed, 29 Nov 2023 14:04:39 +0000 (09:04 -0500)]
Merge pull request #14896 from zarkdav/patch-1

Update bgp.rst

17 months agoMerge pull request #14838 from idryzhov/mgmtd-cli-out
Christian Hopps [Wed, 29 Nov 2023 13:50:16 +0000 (14:50 +0100)]
Merge pull request #14838 from idryzhov/mgmtd-cli-out

Output configuration of mgmtd-converted daemons from mgmtd

17 months agoMerge pull request #14762 from pguibert6WIND/show_pcep_port
Olivier Dugeon [Wed, 29 Nov 2023 13:41:47 +0000 (14:41 +0100)]
Merge pull request #14762 from pguibert6WIND/show_pcep_port

pathd: fix space before pcep port in running-config

17 months agoMerge pull request #9012 from dlqs/lua-poly
Donatas Abraitis [Wed, 29 Nov 2023 13:14:46 +0000 (15:14 +0200)]
Merge pull request #9012 from dlqs/lua-poly

Refactor decoder for Lua hook system

17 months agozebra: Set Free Functions for Traffic Control Hash Tables 14908/head
Keelan10 [Wed, 29 Nov 2023 12:33:54 +0000 (16:33 +0400)]
zebra: Set Free Functions for Traffic Control Hash Tables

Configure hash table cleanup with specific free functions for `zrouter.filter_hash`, `zrouter.qdisc_hash`, and `zrouter.class_hash`.
This ensures proper memory cleanup, addressing memory leaks.

The ASan leak log for reference:

```
***********************************************************************************
Address Sanitizer Error detected in tc_basic.test_tc_basic/r1.asan.zebra.15495

=================================================================
==15495==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 176 byte(s) in 1 object(s) allocated from:
    #0 0x7fd5660ffd28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x7fd565afe238 in qcalloc lib/memory.c:105
    #2 0x5564521c6c9e in tc_filter_alloc_intern zebra/zebra_tc.c:389
    #3 0x7fd565ac49e8 in hash_get lib/hash.c:147
    #4 0x5564521c7c74 in zebra_tc_filter_add zebra/zebra_tc.c:409
    #5 0x55645210755a in zread_tc_filter zebra/zapi_msg.c:3428
    #6 0x5564521127c1 in zserv_handle_commands zebra/zapi_msg.c:4004
    #7 0x5564522208b2 in zserv_process_messages zebra/zserv.c:520
    #8 0x7fd565b9e034 in event_call lib/event.c:1974
    #9 0x7fd565ae142b in frr_run lib/libfrr.c:1214
    #10 0x5564520c14b1 in main zebra/main.c:492
    #11 0x7fd564ec2c86 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 0x7fd5660ffd28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x7fd565afe238 in qcalloc lib/memory.c:105
    #2 0x5564521c6c6e in tc_class_alloc_intern zebra/zebra_tc.c:239
    #3 0x7fd565ac49e8 in hash_get lib/hash.c:147
    #4 0x5564521c784f in zebra_tc_class_add zebra/zebra_tc.c:293
    #5 0x556452107ce5 in zread_tc_class zebra/zapi_msg.c:3315
    #6 0x5564521127c1 in zserv_handle_commands zebra/zapi_msg.c:4004
    #7 0x5564522208b2 in zserv_process_messages zebra/zserv.c:520
    #8 0x7fd565b9e034 in event_call lib/event.c:1974
    #9 0x7fd565ae142b in frr_run lib/libfrr.c:1214
    #10 0x5564520c14b1 in main zebra/main.c:492
    #11 0x7fd564ec2c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Direct leak of 12 byte(s) in 1 object(s) allocated from:
    #0 0x7fd5660ffd28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x7fd565afe238 in qcalloc lib/memory.c:105
    #2 0x5564521c6c3e in tc_qdisc_alloc_intern zebra/zebra_tc.c:128
    #3 0x7fd565ac49e8 in hash_get lib/hash.c:147
    #4 0x5564521c753b in zebra_tc_qdisc_install zebra/zebra_tc.c:184
    #5 0x556452108203 in zread_tc_qdisc zebra/zapi_msg.c:3286
    #6 0x5564521127c1 in zserv_handle_commands zebra/zapi_msg.c:4004
    #7 0x5564522208b2 in zserv_process_messages zebra/zserv.c:520
    #8 0x7fd565b9e034 in event_call lib/event.c:1974
    #9 0x7fd565ae142b in frr_run lib/libfrr.c:1214
    #10 0x5564520c14b1 in main zebra/main.c:492
    #11 0x7fd564ec2c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

SUMMARY: AddressSanitizer: 228 byte(s) leaked in 3 allocation(s).
***********************************************************************************
```

Signed-off-by: Keelan Cannoo <keelan.cannoo@icloud.com>
17 months agobgpd: Free Memory for confed_peers in bgp_free 14906/head
Keelan10 [Wed, 29 Nov 2023 11:28:54 +0000 (15:28 +0400)]
bgpd: Free Memory for confed_peers in bgp_free

Release memory associated with `bgp->confed_peers` in the `bgp_free`
function to ensure proper cleanup. This fix prevents memory leaks related
to `confed_peers`.

The ASan leak log for reference:

```
***********************************************************************************
Address Sanitizer Error detected in bgp_confederation_astype.test_bgp_confederation_astype/r2.asan.bgpd.15045

=================================================================
==15045==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0x7f5666787b40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
    #1 0x7f56661867c7 in qrealloc lib/memory.c:112
    #2 0x55a3b4736a40 in bgp_confederation_peers_add bgpd/bgpd.c:681
    #3 0x55a3b46b3363 in bgp_confederation_peers bgpd/bgp_vty.c:2068
    #4 0x7f5666109021 in cmd_execute_command_real lib/command.c:978
    #5 0x7f5666109a52 in cmd_execute_command_strict lib/command.c:1087
    #6 0x7f5666109ab1 in command_config_read_one_line lib/command.c:1247
    #7 0x7f5666109d98 in config_from_file lib/command.c:1300
    #8 0x7f566623c6d0 in vty_read_file lib/vty.c:2614
    #9 0x7f566623c7fa in vty_read_config lib/vty.c:2860
    #10 0x7f56661682e4 in frr_config_read_in lib/libfrr.c:978
    #11 0x7f5666226034 in event_call lib/event.c:1974
    #12 0x7f566616942b in frr_run lib/libfrr.c:1214
    #13 0x55a3b44f319d in main bgpd/bgp_main.c:510
    #14 0x7f56651acc86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Indirect leak of 6 byte(s) in 1 object(s) allocated from:
    #0 0x7f5666720538 in strdup (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x77538)
    #1 0x7f5666186898 in qstrdup lib/memory.c:117
    #2 0x55a3b4736adb in bgp_confederation_peers_add bgpd/bgpd.c:687
    #3 0x55a3b46b3363 in bgp_confederation_peers bgpd/bgp_vty.c:2068
    #4 0x7f5666109021 in cmd_execute_command_real lib/command.c:978
    #5 0x7f5666109a52 in cmd_execute_command_strict lib/command.c:1087
    #6 0x7f5666109ab1 in command_config_read_one_line lib/command.c:1247
    #7 0x7f5666109d98 in config_from_file lib/command.c:1300
    #8 0x7f566623c6d0 in vty_read_file lib/vty.c:2614
    #9 0x7f566623c7fa in vty_read_config lib/vty.c:2860
    #10 0x7f56661682e4 in frr_config_read_in lib/libfrr.c:978
    #11 0x7f5666226034 in event_call lib/event.c:1974
    #12 0x7f566616942b in frr_run lib/libfrr.c:1214
    #13 0x55a3b44f319d in main bgpd/bgp_main.c:510
    #14 0x7f56651acc86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)
***********************************************************************************
```

Signed-off-by: Keelan Cannoo <keelan.cannoo@icloud.com>
17 months agodoc: Update bgp.rst 14896/head
Benjamin Ryzman [Tue, 28 Nov 2023 16:48:36 +0000 (17:48 +0100)]
doc: Update bgp.rst

Fix typo in VRF Route Leaking general configuration example.

Signed-off-by: Benjamin Ryzman <benjamin@ryzman.fr>
17 months agoMerge pull request #14894 from louis-6wind/bestpath-heap
Donatas Abraitis [Wed, 29 Nov 2023 08:44:16 +0000 (10:44 +0200)]
Merge pull request #14894 from louis-6wind/bestpath-heap

bgpd: fix bgp_best_selection heap-use-after-free

17 months agoMerge pull request #14886 from LabNConsulting/aceelindem/ospf-link-local-fix
Donatas Abraitis [Wed, 29 Nov 2023 08:36:30 +0000 (10:36 +0200)]
Merge pull request #14886 from LabNConsulting/aceelindem/ospf-link-local-fix

ospfd: Fix OSPF link-local opaque LSA crash and opaque memory corruption

17 months agoMerge pull request #14897 from chiragshah6/mdev1
Donatas Abraitis [Wed, 29 Nov 2023 07:51:50 +0000 (09:51 +0200)]
Merge pull request #14897 from chiragshah6/mdev1

tools: fix frr-reload interface desc cmd

17 months agotools: fix frr-reload interface desc cmd 14897/head
Chirag Shah [Wed, 29 Nov 2023 02:54:14 +0000 (18:54 -0800)]
tools: fix frr-reload interface desc cmd

Fix frr-reload script to only render 'no description'
rather than 'no description blah'

Ticket:#3628756
Testing Done:

Before:
2023-11-29 02:38:55,758  INFO: Failed to execute interface hostbond_1
no description hostbond_1_to_host exit
2023-11-29 02:38:55,758 ERROR: "interface hostbond_1 --  no description
hostbond_1_to_host -- exit" we failed to remove this command
2023-11-29 02:38:55,758 ERROR: % Unknown command:  no description
hostbond_1_to_host

Signed-off-by: Chirag Shah <chirag@nvidia.com>
17 months agoospfd: Fix OSPF link-local opaque LSA crash and opaque memory corruption 14886/head
Acee [Mon, 27 Nov 2023 13:13:03 +0000 (08:13 -0500)]
ospfd: Fix OSPF link-local opaque LSA crash and opaque memory corruption

  1. When an OSPF interface is deleted, remove the references in link-local
     LSA. Delete the LSA from the LSDB so that the callback has accessibily
     to the interface prior to deletion.
  2. Fix a double free for the opaque function table data structure.
  3. Assure that the opaque per-type information and opaque function table
     structures are removed at the same time since they have back pointers
     to one another.
  4. Add a topotest variation for the link-local opaque LSA crash.

Signed-off-by: Acee <aceelindem@gmail.com>
17 months agoMerge pull request #14811 from donaldsharp/zebra_final_shutdown_finally
Christian Hopps [Tue, 28 Nov 2023 19:14:42 +0000 (20:14 +0100)]
Merge pull request #14811 from donaldsharp/zebra_final_shutdown_finally

Zebra final shutdown finally

17 months agobgpd: fix bgp_best_selection heap-use-after-free 14894/head
Louis Scalbert [Tue, 28 Nov 2023 13:54:46 +0000 (14:54 +0100)]
bgpd: fix bgp_best_selection heap-use-after-free

Fix bgp_best_selection heap-use-after-free

> ==2521540==ERROR: AddressSanitizer: heap-use-after-free on address 0x60d000032810 at pc 0x000000716f45 bp 0x7ffedc6229d0 sp 0x7ffedc6229c8
> READ of size 8 at 0x60d000032810 thread T0
>     #0 0x716f44 in bgp_best_selection /home/lscalber/git/frr/bgpd/bgp_route.c:2834:5
>     #1 0x71a05e in bgp_process_main_one /home/lscalber/git/frr/bgpd/bgp_route.c:3344:2
>     #2 0x71c265 in bgp_process_wq /home/lscalber/git/frr/bgpd/bgp_route.c:3622:3
>     #3 0x7fe630a6669c in work_queue_run /home/lscalber/git/frr/lib/workqueue.c:282:10
>     #4 0x7fe630a294e2 in event_call /home/lscalber/git/frr/lib/event.c:1974:2
>     #5 0x7fe630898f3f in frr_run /home/lscalber/git/frr/lib/libfrr.c:1214:3
>     #6 0x4f4ace in main /home/lscalber/git/frr/bgpd/bgp_main.c:510:2
>     #7 0x7fe63018bd09 in __libc_start_main csu/../csu/libc-start.c:308:16
>     #8 0x449629 in _start (/usr/lib/frr/bgpd+0x449629)
>
> 0x60d000032810 is located 48 bytes inside of 144-byte region [0x60d0000327e0,0x60d000032870)
> freed by thread T0 here:
>     #0 0x4c341d in free (/usr/lib/frr/bgpd+0x4c341d)
>     #1 0x7fe6308d7420 in qfree /home/lscalber/git/frr/lib/memory.c:130:2
>     #2 0x702632 in bgp_path_info_free_with_caller /home/lscalber/git/frr/bgpd/bgp_route.c:300:2
>     #3 0x702023 in bgp_path_info_unlock /home/lscalber/git/frr/bgpd/bgp_route.c:315:3
>     #4 0x703bc6 in bgp_path_info_reap /home/lscalber/git/frr/bgpd/bgp_route.c:461:2
>     #5 0x716e5d in bgp_best_selection /home/lscalber/git/frr/bgpd/bgp_route.c:2829:12
>     #6 0x71a05e in bgp_process_main_one /home/lscalber/git/frr/bgpd/bgp_route.c:3344:2
>     #7 0x71c265 in bgp_process_wq /home/lscalber/git/frr/bgpd/bgp_route.c:3622:3
>     #8 0x7fe630a6669c in work_queue_run /home/lscalber/git/frr/lib/workqueue.c:282:10
>     #9 0x7fe630a294e2 in event_call /home/lscalber/git/frr/lib/event.c:1974:2
>     #10 0x7fe630898f3f in frr_run /home/lscalber/git/frr/lib/libfrr.c:1214:3
>     #11 0x4f4ace in main /home/lscalber/git/frr/bgpd/bgp_main.c:510:2
>     #12 0x7fe63018bd09 in __libc_start_main csu/../csu/libc-start.c:308:16
>
> previously allocated by thread T0 here:
>     #0 0x4c3812 in calloc (/usr/lib/frr/bgpd+0x4c3812)
>     #1 0x7fe6308d7178 in qcalloc /home/lscalber/git/frr/lib/memory.c:105:27
>     #2 0x71f5b4 in info_make /home/lscalber/git/frr/bgpd/bgp_route.c:3985:8
>     #3 0x725293 in bgp_update /home/lscalber/git/frr/bgpd/bgp_route.c:4881:8
>     #4 0x73083d in bgp_nlri_parse_ip /home/lscalber/git/frr/bgpd/bgp_route.c:6230:4
>     #5 0x6ba980 in bgp_nlri_parse /home/lscalber/git/frr/bgpd/bgp_packet.c:341:10
>     #6 0x6cca2a in bgp_update_receive /home/lscalber/git/frr/bgpd/bgp_packet.c:2412:15
>     #7 0x6c6788 in bgp_process_packet /home/lscalber/git/frr/bgpd/bgp_packet.c:3887:11
>     #8 0x7fe630a294e2 in event_call /home/lscalber/git/frr/lib/event.c:1974:2
>     #9 0x7fe630898f3f in frr_run /home/lscalber/git/frr/lib/libfrr.c:1214:3
>     #10 0x4f4ace in main /home/lscalber/git/frr/bgpd/bgp_main.c:510:2
>     #11 0x7fe63018bd09 in __libc_start_main csu/../csu/libc-start.c:308:16

Fixes: ddb5b4880b ("bgpd: vpn-vrf route leaking")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
17 months agoMerge pull request #14856 from opensourcerouting/show-rm
Russ White [Tue, 28 Nov 2023 13:46:53 +0000 (08:46 -0500)]
Merge pull request #14856 from opensourcerouting/show-rm

lib: fix show route map JSON display

17 months agoMerge pull request #14819 from opensourcerouting/feature/bgp_debug_updates_with_route-map
Russ White [Tue, 28 Nov 2023 13:40:07 +0000 (08:40 -0500)]
Merge pull request #14819 from opensourcerouting/feature/bgp_debug_updates_with_route-map

bgpd: Add an ability to filter UPDATEs using neighbor with prefix-list

17 months agoMerge pull request #14512 from pguibert6WIND/vpnv4_with_no_rt_export
Russ White [Tue, 28 Nov 2023 13:34:58 +0000 (08:34 -0500)]
Merge pull request #14512 from pguibert6WIND/vpnv4_with_no_rt_export

L3VPN exportation by using 'route-map vpn export' command instead of 'rt vpn export' command

17 months agoMerge pull request #14878 from ton31337/fix/chore_changelogs
Donald Sharp [Mon, 27 Nov 2023 14:15:04 +0000 (09:15 -0500)]
Merge pull request #14878 from ton31337/fix/chore_changelogs

redhat, debian: Update release notes for 9.1 release

17 months agoMerge pull request #14877 from k-v1/ubuntu-docker-fix-typos
Donatas Abraitis [Mon, 27 Nov 2023 07:28:02 +0000 (09:28 +0200)]
Merge pull request #14877 from k-v1/ubuntu-docker-fix-typos

docker: fix typos in docs for ubuntu20-ci and ubuntu22-ci

17 months agoredhat, debian: Update release notes for 9.1 release 14878/head
Donatas Abraitis [Thu, 9 Nov 2023 14:35:13 +0000 (16:35 +0200)]
redhat, debian: Update release notes for 9.1 release

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
17 months agodocker: fix typos in docs for ubuntu20-ci and ubuntu22-ci 14877/head
Konstantin Vasin [Sun, 26 Nov 2023 15:10:29 +0000 (18:10 +0300)]
docker: fix typos in docs for ubuntu20-ci and ubuntu22-ci

Signed-off-by: Konstantin Vasin <126960927+k-v1@users.noreply.github.com>
17 months agoMerge pull request #14867 from opensourcerouting/zclient-options-cleanup
Donald Sharp [Sat, 25 Nov 2023 14:15:07 +0000 (09:15 -0500)]
Merge pull request #14867 from opensourcerouting/zclient-options-cleanup

*: clean up `zclient` options

17 months agodoc: remove duplicated show route-map 14856/head
Rafael Zalamena [Tue, 21 Nov 2023 18:02:44 +0000 (15:02 -0300)]
doc: remove duplicated show route-map

Remove zebra duplicated command documentation without description.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
17 months agolib,vtysh: fix show route map JSON output
Rafael Zalamena [Mon, 20 Nov 2023 20:32:19 +0000 (17:32 -0300)]
lib,vtysh: fix show route map JSON output

Move the command from 'lib' to 'vtysh' so we can properly format the
JSON output in a correct manner.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
17 months agoMerge pull request #14866 from opensourcerouting/freebsd-14-build-doc
Donald Sharp [Fri, 24 Nov 2023 00:48:37 +0000 (19:48 -0500)]
Merge pull request #14866 from opensourcerouting/freebsd-14-build-doc

doc: Add build instructions for FreeBSD 14

17 months agoMerge pull request #14863 from opensourcerouting/if-connected-dlist
Donald Sharp [Thu, 23 Nov 2023 22:45:07 +0000 (17:45 -0500)]
Merge pull request #14863 from opensourcerouting/if-connected-dlist

*: convert struct interface->connected to DLIST

17 months agolib, bgp/vnc: add `.auxiliary` zclient option 14867/head
David Lamparter [Thu, 23 Nov 2023 14:40:38 +0000 (15:40 +0100)]
lib, bgp/vnc: add `.auxiliary` zclient option

Avoids calling VRF/interface/... handlers in library code more than
once.  It's kinda surprising that this hasn't been blowing up already
for the VNC code, luckily these handlers are (mostly?) idempotent.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
17 months agodoc: Add build instructions for FreeBSD 14 14866/head
David Schweizer [Thu, 23 Nov 2023 14:38:45 +0000 (15:38 +0100)]
doc: Add build instructions for FreeBSD 14

Signed-off-by: David Schweizer <dschweizer@opensourcerouting.org>
17 months ago*: add `zclient_options_sync`
David Lamparter [Thu, 23 Nov 2023 14:18:44 +0000 (15:18 +0100)]
*: add `zclient_options_sync`

... and use it instead of fiddling with the `.synchronous` field.

(Make it const while at it.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
17 months agozebra, lib: remove notify field from hello message
David Lamparter [Thu, 23 Nov 2023 14:08:32 +0000 (15:08 +0100)]
zebra, lib: remove notify field from hello message

This is no longer used.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
17 months agolib: remove `.receive_notify` zclient option
David Lamparter [Thu, 23 Nov 2023 14:03:35 +0000 (15:03 +0100)]
lib: remove `.receive_notify` zclient option

This should just be set with `ZEBRA_ROUTE_NOTIFY_REQUEST` instead.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
17 months agoeigrpd: use default zclient options
David Lamparter [Thu, 23 Nov 2023 14:01:54 +0000 (15:01 +0100)]
eigrpd: use default zclient options

`.receive_notify = false` is the default.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
17 months agostaticd: replace `receive_notify` with request
David Lamparter [Thu, 23 Nov 2023 13:53:37 +0000 (14:53 +0100)]
staticd: replace `receive_notify` with request

Send `ZEBRA_ROUTE_NOTIFY_REQUEST` rather than relying on the options
field in zclient startup.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
17 months agosharpd: replace `receive_notify` with request
David Lamparter [Thu, 23 Nov 2023 13:53:37 +0000 (14:53 +0100)]
sharpd: replace `receive_notify` with request

Send `ZEBRA_ROUTE_NOTIFY_REQUEST` rather than relying on the options
field in zclient startup.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
17 months agopbrd: replace `receive_notify` with request
David Lamparter [Thu, 23 Nov 2023 13:53:37 +0000 (14:53 +0100)]
pbrd: replace `receive_notify` with request

Send `ZEBRA_ROUTE_NOTIFY_REQUEST` rather than relying on the options
field in zclient startup.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
17 months agoMerge pull request #14858 from idryzhov/mgmtd-error-msg
Donatas Abraitis [Thu, 23 Nov 2023 06:09:45 +0000 (08:09 +0200)]
Merge pull request #14858 from idryzhov/mgmtd-error-msg

mgmtd: fix reply when running ds is not locked

17 months agolib: remove `distribute_{in,out}` from interface 14863/head
David Lamparter [Wed, 22 Nov 2023 21:53:17 +0000 (22:53 +0100)]
lib: remove `distribute_{in,out}` from interface

Both of these fields are just straight up completely unused.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
17 months ago*: convert `struct interface->connected` to DLIST
David Lamparter [Wed, 22 Nov 2023 18:05:41 +0000 (19:05 +0100)]
*: convert `struct interface->connected` to DLIST

Replace `struct list *` with `DLIST(if_connected, ...)`.

NB: while converting this, I found multiple places using connected
prefixes assuming they were IPv4 without checking:

- vrrpd/vrrp.c: vrrp_socket()
- zebra/irdp_interface.c: irdp_get_prefix(), irdp_if_start(),
  irdp_advert_off()

(these fixes are really hard to split off into separate commits as that
would require going back and reapplying the change but with the old list
handling)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
17 months agoMerge pull request #14862 from louis-6wind/fix-ctx-iptable
Mark Stapp [Wed, 22 Nov 2023 20:47:47 +0000 (15:47 -0500)]
Merge pull request #14862 from louis-6wind/fix-ctx-iptable

zebra: fix dplane_ctx_iptable use-after-free

17 months agozebra: fix dplane_ctx_iptable use-after-free 14862/head
Louis Scalbert [Wed, 22 Nov 2023 17:21:25 +0000 (18:21 +0100)]
zebra: fix dplane_ctx_iptable use-after-free

Fix a crash because a use-after-free.

> =================================================================
> ==1249835==ERROR: AddressSanitizer: heap-use-after-free on address 0x604000074210 at pc 0x7fa1b42a652c bp 0x7ffc477a2aa0 sp 0x7ffc477a2a98
> READ of size 8 at 0x604000074210 thread T0
>     #0 0x7fa1b42a652b in list_delete_all_node git/frr/lib/linklist.c:299:20
>     #1 0x7fa1b42a683f in list_delete git/frr/lib/linklist.c:312:2
>     #2 0x5ee515 in dplane_ctx_free_internal git/frr/zebra/zebra_dplane.c:858:4
>     #3 0x5ee59c in dplane_ctx_free git/frr/zebra/zebra_dplane.c:884:2
>     #4 0x5ee544 in dplane_ctx_fini git/frr/zebra/zebra_dplane.c:905:2
>     #5 0x7045c0 in rib_process_dplane_results git/frr/zebra/zebra_rib.c:4928:4
>     #6 0x7fa1b4434fb2 in event_call git/frr/lib/event.c:1970:2
>     #7 0x7fa1b42a0ccf in frr_run git/frr/lib/libfrr.c:1213:3
>     #8 0x556808 in main git/frr/zebra/main.c:488:2
>     #9 0x7fa1b3d0bd09 in __libc_start_main csu/../csu/libc-start.c:308:16
>     #10 0x4453e9 in _start (/usr/lib/frr/zebra+0x4453e9)
>
> 0x604000074210 is located 0 bytes inside of 40-byte region [0x604000074210,0x604000074238)
> freed by thread T0 here:
>     #0 0x4bf1dd in free (/usr/lib/frr/zebra+0x4bf1dd)
>     #1 0x7fa1b42df0c0 in qfree git/frr/lib/memory.c:130:2
>     #2 0x7fa1b42a68ce in list_free_internal git/frr/lib/linklist.c:24:2
>     #3 0x7fa1b42a6870 in list_delete git/frr/lib/linklist.c:313:2
>     #4 0x5ee515 in dplane_ctx_free_internal git/frr/zebra/zebra_dplane.c:858:4
>     #5 0x5ee59c in dplane_ctx_free git/frr/zebra/zebra_dplane.c:884:2
>     #6 0x5ee544 in dplane_ctx_fini git/frr/zebra/zebra_dplane.c:905:2
>     #7 0x7045c0 in rib_process_dplane_results git/frr/zebra/zebra_rib.c:4928:4
>     #8 0x7fa1b4434fb2 in event_call git/frr/lib/event.c:1970:2
>     #9 0x7fa1b42a0ccf in frr_run git/frr/lib/libfrr.c:1213:3
>     #10 0x556808 in main git/frr/zebra/main.c:488:2
>     #11 0x7fa1b3d0bd09 in __libc_start_main csu/../csu/libc-start.c:308:16
>
> previously allocated by thread T0 here:
>     #0 0x4bf5d2 in calloc (/usr/lib/frr/zebra+0x4bf5d2)
>     #1 0x7fa1b42dee18 in qcalloc git/frr/lib/memory.c:105:27
>     #2 0x7fa1b42a3784 in list_new git/frr/lib/linklist.c:18:9
>     #3 0x6d165f in pbr_iptable_alloc_intern git/frr/zebra/zebra_pbr.c:1015:29
>     #4 0x7fa1b426ad1f in hash_get git/frr/lib/hash.c:147:13
>     #5 0x6d15f2 in zebra_pbr_add_iptable git/frr/zebra/zebra_pbr.c:1030:13
>     #6 0x5db2a3 in zread_iptable git/frr/zebra/zapi_msg.c:3759:3
>     #7 0x5e365d in zserv_handle_commands git/frr/zebra/zapi_msg.c:4039:3
>     #8 0x7e09fc in zserv_process_messages git/frr/zebra/zserv.c:520:3
>     #9 0x7fa1b4434fb2 in event_call git/frr/lib/event.c:1970:2
>     #10 0x7fa1b42a0ccf in frr_run git/frr/lib/libfrr.c:1213:3
>     #11 0x556808 in main git/frr/zebra/main.c:488:2
>     #12 0x7fa1b3d0bd09 in __libc_start_main csu/../csu/libc-start.c:308:16

Fixes: 1cc380679e ("zebra: Actually free all memory associated ctx->u.iptable.interface_name_list")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
17 months agoMerge pull request #14830 from fdumontet6WIND/snmpv2
Donatas Abraitis [Wed, 22 Nov 2023 12:45:15 +0000 (14:45 +0200)]
Merge pull request #14830 from fdumontet6WIND/snmpv2

tests: bgp_snmp_bgp4v2mib fix some random failure

17 months agoMerge pull request #14815 from idryzhov/lib-mgmt-deps
Christian Hopps [Wed, 22 Nov 2023 09:51:40 +0000 (10:51 +0100)]
Merge pull request #14815 from idryzhov/lib-mgmt-deps

Remove lib dependency on mgmtd

17 months agotests: bgp_snmp_bgp4v2mib fix some random failure 14830/head
Francois Dumontet [Sun, 19 Nov 2023 21:55:06 +0000 (22:55 +0100)]
tests: bgp_snmp_bgp4v2mib fix some random failure

avoid to consider additionnal traps randomly received later

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
17 months agoMerge pull request #14850 from donaldsharp/IFNAMSIZ_GET_YOUR_SHIT_TOGETHER
Donatas Abraitis [Wed, 22 Nov 2023 07:13:58 +0000 (09:13 +0200)]
Merge pull request #14850 from donaldsharp/IFNAMSIZ_GET_YOUR_SHIT_TOGETHER

*: Let's use the native IFNAMSIZ instead of INTERFACE_NAMSIZ

17 months agolib: Print debug config in files after we have prefix-lists 14819/head
Donatas Abraitis [Mon, 20 Nov 2023 12:50:57 +0000 (14:50 +0200)]
lib: Print debug config in files after we have prefix-lists

Without this if we enter something like `debug bgp updates in x.x.x.x prefix-list y`,
prefix-list can't be lookup up, because when we read the config, debug does not know
anything about this prefix-list.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
17 months agobgpd: Optimize prefix-list lookup for debug messages
Donatas Abraitis [Mon, 20 Nov 2023 10:14:43 +0000 (12:14 +0200)]
bgpd: Optimize prefix-list lookup for debug messages

Pass prefix-list pointers at configuration time.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
17 months agobgpd: Add an ability to filter UPDATEs using neighbor with prefix-list
Donatas Abraitis [Fri, 17 Nov 2023 06:39:33 +0000 (08:39 +0200)]
bgpd: Add an ability to filter UPDATEs using neighbor with prefix-list

Before this patch we didn't have an option to filter debug UPDATE messages
by specifying an arbitrary prefix, prefix-list or so. We had/have only an option
to specify:

```
* debug bgp updates in 10.0.0.1
* debug bgp updates prefix 10.0.1.0/24
```

Now adding:

```
* debug bgp updates <in|out> 10.0.0.1 prefix-list plist
```

CLI output:

```
r2# show debugging
MGMT debugging status:

Zebra debugging status:

BGP debugging status:
  BGP updates debugging is on (inbound) for 192.168.2.6 with prefix-list debug

Staticd debugging status

r2# show running-config | include prefix-list debug
debug bgp updates in 192.168.2.6 prefix-list debug
r2#
```

Logs:

```
BGP: [PCFFM-WMARW] 192.168.2.3(r3) rcvd UPDATE wlen 0 attrlen 28 alen 5
BGP: [PCFFM-WMARW] 192.168.2.3(r3) rcvd UPDATE wlen 0 attrlen 28 alen 4
BGP: [PCFFM-WMARW] 192.168.2.3(r3) rcvd UPDATE wlen 0 attrlen 0 alen 0
BGP: [M59KS-A3ZXZ] bgp_update_receive: rcvd End-of-RIB for IPv4 Unicast from 192.168.2.3 in vrf default
BGP: [PCFFM-WMARW] 192.168.2.4(r4) rcvd UPDATE wlen 0 attrlen 28 alen 5
BGP: [PCFFM-WMARW] 192.168.2.4(r4) rcvd UPDATE wlen 0 attrlen 28 alen 4
BGP: [PCFFM-WMARW] 192.168.2.4(r4) rcvd UPDATE wlen 0 attrlen 0 alen 0
BGP: [M59KS-A3ZXZ] bgp_update_receive: rcvd End-of-RIB for IPv4 Unicast from 192.168.2.4 in vrf default
BGP: [PCFFM-WMARW] 192.168.1.1(r1) rcvd UPDATE wlen 0 attrlen 29 alen 5
BGP: [PCFFM-WMARW] 192.168.2.6(r6) rcvd UPDATE wlen 0 attrlen 28 alen 5
BGP: [XXWBM-V772F] 192.168.2.6(r6) rcvd UPDATE w/ attr: nexthop 192.168.2.6, origin ?, metric 0, path 65006
BGP: [YCKEM-GB33T] 192.168.2.6(r6) rcvd 172.16.16.254/32 IPv4 unicast <<<<<<<<<<<<
BGP: [PCFFM-WMARW] 192.168.2.6(r6) rcvd UPDATE wlen 0 attrlen 28 alen 4
BGP: [PCFFM-WMARW] 192.168.2.6(r6) rcvd UPDATE wlen 0 attrlen 0 alen 0
BGP: [M59KS-A3ZXZ] bgp_update_receive: rcvd End-of-RIB for IPv4 Unicast from 192.168.2.6 in vrf default
BGP: [PCFFM-WMARW] 192.168.2.5(r5) rcvd UPDATE wlen 0 attrlen 28 alen 5
BGP: [PCFFM-WMARW] 192.168.2.5(r5) rcvd UPDATE wlen 0 attrlen 28 alen 4
BGP: [PCFFM-WMARW] 192.168.2.5(r5) rcvd UPDATE wlen 0 attrlen 0 alen 0
BGP: [M59KS-A3ZXZ] bgp_update_receive: rcvd End-of-RIB for IPv4 Unicast from 192.168.2.5 in vrf default
BGP: [PCFFM-WMARW] 192.168.1.1(r1) rcvd UPDATE wlen 0 attrlen 29 alen 5
BGP: [PCFFM-WMARW] 192.168.7.7(r7) rcvd UPDATE wlen 0 attrlen 0 alen 0
BGP: [M59KS-A3ZXZ] bgp_update_receive: rcvd End-of-RIB for IPv4 Unicast from 192.168.7.7 in vrf default
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
17 months agodoc: Add `debug bgp updates <in|out> NEIGHBOR route-map RMAP` cmd
Donatas Abraitis [Fri, 17 Nov 2023 07:58:20 +0000 (09:58 +0200)]
doc: Add `debug bgp updates <in|out> NEIGHBOR route-map RMAP` cmd

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
17 months agomgmtd: fix reply when running ds is not locked 14858/head
Igor Ryzhov [Tue, 21 Nov 2023 21:18:40 +0000 (23:18 +0200)]
mgmtd: fix reply when running ds is not locked

At this stage, we should send a SET_CFG reply, not COMMIT_CFG reply.
Commit request is not yet initialized.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
17 months agozebra: Cleanup zrouter.stale_client_list on shutdown 14811/head
Donald Sharp [Mon, 20 Nov 2023 19:47:07 +0000 (14:47 -0500)]
zebra: Cleanup zrouter.stale_client_list on shutdown

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agozebra: Cleanup hash's on zebra shutdown
Donald Sharp [Mon, 20 Nov 2023 19:41:24 +0000 (14:41 -0500)]
zebra: Cleanup hash's on zebra shutdown

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agozebra: Cleanup svd_nh_table on shutdown
Donald Sharp [Mon, 20 Nov 2023 18:57:59 +0000 (13:57 -0500)]
zebra: Cleanup svd_nh_table on shutdown

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agozebra: Unregister mpls hooks on zebra shutdown
Donald Sharp [Mon, 20 Nov 2023 18:52:01 +0000 (13:52 -0500)]
zebra: Unregister mpls hooks on zebra shutdown

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agozebra: On shutdown, ensure dg_update_list is emptied
Donald Sharp [Mon, 20 Nov 2023 17:46:36 +0000 (12:46 -0500)]
zebra: On shutdown, ensure dg_update_list is emptied

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agozebra: On shutdown, ensure ctx's in rib_dplane_q are freed
Donald Sharp [Thu, 16 Nov 2023 17:55:34 +0000 (12:55 -0500)]
zebra: On shutdown, ensure ctx's in rib_dplane_q are freed

a) Rename rib_init to zebra_rib_init() to better follow how
things are named

b) on shutdown cycle through the rib_dplane_q and free
up any contexts sitting in it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agobgpd: On shutdown do not create a workqueue for the self peer
Donald Sharp [Wed, 15 Nov 2023 21:23:56 +0000 (16:23 -0500)]
bgpd: On shutdown do not create a workqueue for the self peer

When bgp is shutting down, it calls bgp_fsm_change_status
on everything including a self peer, which goes through
and cleans the tables of the self peer data structures
as if it's a real peer.  Add a bit of code to just
not do the work at all.  This allows unlocks to flow
a bit further and for the self peer to be deleted
on shutdown.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agobgpd: MTYPE_BGP was being overused split up
Donald Sharp [Wed, 15 Nov 2023 19:52:10 +0000 (14:52 -0500)]
bgpd: MTYPE_BGP was being overused split up

The MTYPE_BGP memory type was being over used as
both the handler for the bgp instance itself as
well as memory associated with name strings.
Let's separate out the two.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agozebra: Cleanup dplane provider owned ctx's on shutdown
Donald Sharp [Wed, 15 Nov 2023 19:41:18 +0000 (14:41 -0500)]
zebra: Cleanup dplane provider owned ctx's on shutdown

On shutdown go through and ensure that any contexts the
dplane provider holds are freed.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months ago*: Cleanup keychain on shutdown
Donald Sharp [Wed, 15 Nov 2023 19:36:24 +0000 (14:36 -0500)]
*: Cleanup keychain on shutdown

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agobfdd: Free zclient memory on shutdown
Donald Sharp [Wed, 15 Nov 2023 19:32:13 +0000 (14:32 -0500)]
bfdd: Free zclient memory on shutdown

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agozebra: On shutdown, cleanup dplane providers
Donald Sharp [Wed, 15 Nov 2023 18:47:41 +0000 (13:47 -0500)]
zebra: On shutdown, cleanup dplane providers

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agozebra: On shutdown cleanup zns memory.
Donald Sharp [Wed, 15 Nov 2023 18:47:22 +0000 (13:47 -0500)]
zebra: On shutdown cleanup zns memory.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agobgpd, topotests: apply route-map after rt vpn export 14512/head
Philippe Guibert [Mon, 20 Nov 2023 16:23:05 +0000 (17:23 +0100)]
bgpd, topotests: apply route-map after rt vpn export

A route-map can be programmed to remove the route-target which
has been set with 'rt vpn export' command, but fails to remove
it.

Fix this by applying the route-map, then considering the resulting
extended community-list.
Add some tests to catch this issue.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
17 months agodoc: explain rt list exportation with route-maps
Philippe Guibert [Mon, 9 Oct 2023 18:57:32 +0000 (20:57 +0200)]
doc: explain rt list exportation with route-maps

Explain that an export route target list can be configured
alternatively by using route-maps.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
17 months agotopotests: bgp_vpnv4_ebgp, check 'extcommunity rt' presence
Philippe Guibert [Thu, 28 Sep 2023 20:04:41 +0000 (22:04 +0200)]
topotests: bgp_vpnv4_ebgp, check 'extcommunity rt' presence

Add a test to check that the presence of a route-map at
exportation with a 'set extcommunity rt' is enough to allow
the prefix to be exported.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
17 months agobgpd: fix bgp node created at withdraw event
Philippe Guibert [Thu, 28 Sep 2023 15:59:22 +0000 (17:59 +0200)]
bgpd: fix bgp node created at withdraw event

The prefixes unexportation triggers an attempt to create
the VPN prefix node if that prefix was not already present.

For instance, if a given prefix is not exported because of
a route-map filtering, the withdraw process will try to
create the node with the 'bgp_afi_node_get()' command.

Fix this by replacing this call by the 'bgp_safi_node_lookup()'
function.

Fixes: ddb5b4880ba8 ("bgpd: vpn-vrf route leaking")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
17 months agobgpd: fix export prefixes when rt extcomm set by route-map
Philippe Guibert [Thu, 28 Sep 2023 15:05:43 +0000 (17:05 +0200)]
bgpd: fix export prefixes when rt extcomm set by route-map

When exporting BGP prefixes, it is necessary to configure
the route target extended communities with the following
command:

> rt vpn export <RouteTarget>

But the customer may need to configure the route-target to
apply to bgp updates, solely based on a route-map criterium.
by using the below route-map configured like that:

> route-map vpn export <routemapname>

Fix this by allowing to export bgp updates based on the
presence of route-targets on either route-map or vpn
configured rt. the exportation process is stopped
if no route target is available in the ecommunity list.

Fixes: ddb5b4880ba8 ("bgpd: vpn-vrf route leaking")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
17 months agobgpd: fix wrong event called when removing a set rule
Philippe Guibert [Thu, 28 Sep 2023 15:41:27 +0000 (17:41 +0200)]
bgpd: fix wrong event called when removing a set rule

The following route-map set rules events are destroyed with
the 'match_destroy' API whereas there is a 'set_destroy' API
available.
Fix this for the following set commands:
> set distance
> set extcommunity rt
> set extcommunity nt
> set extcommunity color
> set extcommunity soo

Fixes: 48cb7ea99d10 ("bgpd: North-bound implementation for bgp rmaps")
Fixes: c9a256144479 ("bgpd: Implement Node Target Extended Communities")
Fixes: b80ebc2d8cf0 ("bgpd: add colored extended communities support")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
17 months agopathd: fix 'no msd' command not possible under pcc node 14762/head
Philippe Guibert [Thu, 9 Nov 2023 13:49:18 +0000 (14:49 +0100)]
pathd: fix 'no msd' command not possible under pcc node

It should be possible to reset the configured msd value,
and not mentioning the previous msd value.

> ubuntu2204(config-sr-te-pcep-pcc)# no msd
> % Command incomplete: no msd
> ubuntu2204(config-sr-te-pcep-pcc)#

Fix this by defining the msd parameter optional, and
separating the 'no msd' command from the 'msd' command.

Fixe: efba0985fcdd ("pathd: Add optional support for PCEP to pathd")

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
17 months agopathd: fix space before pcep port in running-config
Philippe Guibert [Thu, 9 Nov 2023 13:34:52 +0000 (14:34 +0100)]
pathd: fix space before pcep port in running-config

The below running-configuration has extra spaces before the pce
port configuration:

> segment-routing
>  traffic-engineering
>   pce test
>    address ip 192.0.2.2   port 1234
>

Fix this by keeping only one space.

>    address ip 192.0.2.2 port 1234

Fixes: efba0985fcdd ("pathd: Add optional support for PCEP to pathd")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
17 months agoMerge pull request #14834 from opensourcerouting/zclient-nexthop-update
Donald Sharp [Tue, 21 Nov 2023 15:56:47 +0000 (10:56 -0500)]
Merge pull request #14834 from opensourcerouting/zclient-nexthop-update

*: move common NHT update decoding bits into lib/

17 months agoMerge pull request #14845 from opensourcerouting/fix/bgp_conditional_double_free
Donald Sharp [Tue, 21 Nov 2023 15:48:33 +0000 (10:48 -0500)]
Merge pull request #14845 from opensourcerouting/fix/bgp_conditional_double_free

bgpd: Prevent USE case for conditional advertisements with `set` actions

17 months agoMerge pull request #14757 from ryndia/aspath_fix
Russ White [Tue, 21 Nov 2023 15:39:59 +0000 (10:39 -0500)]
Merge pull request #14757 from ryndia/aspath_fix

bgpd:aspath leak fix

17 months ago*: Let's use the native IFNAMSIZ instead of INTERFACE_NAMSIZ 14850/head
Donald Sharp [Tue, 21 Nov 2023 13:08:29 +0000 (08:08 -0500)]
*: Let's use the native IFNAMSIZ instead of INTERFACE_NAMSIZ

INTERFACE_NAMSIZ is just a redefine of IFNAMSIZ and IFNAMSIZ
is the standard for interface name length on all platforms
that FRR currently compiles on.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agomgmtd, staticd: output staticd configuration from mgmtd 14838/head
Igor Ryzhov [Mon, 20 Nov 2023 13:02:29 +0000 (14:02 +0100)]
mgmtd, staticd: output staticd configuration from mgmtd

As mgmtd now implements vty for staticd, it's logical to output the
configuration from there as well. Fully-converted backend daemons should
not handle vty commands at all.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
17 months agomgmtd: add node for writing configuration
Igor Ryzhov [Wed, 15 Nov 2023 01:14:22 +0000 (02:14 +0100)]
mgmtd: add node for writing configuration

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
17 months agolib: load nb callbacks even with ignore_cbs set
Igor Ryzhov [Wed, 15 Nov 2023 01:15:18 +0000 (02:15 +0100)]
lib: load nb callbacks even with ignore_cbs set

Don't skip NB callbacks loading when ignore_cbs is set for a YANG
module. It allows us to use cli_show, cli_show_end and cli_cmp callbacks
in mgmtd and output configuration directly from it instead of backend
daemons.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
17 months agoMerge pull request #14710 from teletajp/fix_show_ospf_gr_helper_cmd
Donatas Abraitis [Tue, 21 Nov 2023 09:39:31 +0000 (11:39 +0200)]
Merge pull request #14710 from teletajp/fix_show_ospf_gr_helper_cmd

ospfd:fix show_ip_ospf_gr_helper

17 months agobgpd: Flush attrs only if we don't have to announce a conditional route 14845/head
Donatas Abraitis [Tue, 21 Nov 2023 08:40:58 +0000 (10:40 +0200)]
bgpd: Flush attrs only if we don't have to announce a conditional route

To avoid USE:

```
==587645==ERROR: AddressSanitizer: heap-use-after-free on address 0x604000074050 at pc 0x55b34337d96c bp 0x7ffda59bb4c0 sp 0x7ffda59bb4b0
READ of size 8 at 0x604000074050 thread T0
    0 0x55b34337d96b in bgp_attr_flush bgpd/bgp_attr.c:1289
    1 0x55b34368ef85 in bgp_conditional_adv_routes bgpd/bgp_conditional_adv.c:111
    2 0x55b34368ff58 in bgp_conditional_adv_timer bgpd/bgp_conditional_adv.c:301
    3 0x7f7d41cdf81c in event_call lib/event.c:1980
    4 0x7f7d41c1da37 in frr_run lib/libfrr.c:1214
    5 0x55b343371e22 in main bgpd/bgp_main.c:510
    6 0x7f7d41517082 in __libc_start_main ../csu/libc-start.c:308
    7 0x55b3433769fd in _start (/usr/lib/frr/bgpd+0x2e29fd)

0x604000074050 is located 0 bytes inside of 40-byte region [0x604000074050,0x604000074078)
freed by thread T0 here:
    #0 0x7f7d4207540f in __interceptor_free ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:122
    1 0x55b343396afd in community_free bgpd/bgp_community.c:41
    2 0x55b343396afd in community_free bgpd/bgp_community.c:28
    3 0x55b343397373 in community_intern bgpd/bgp_community.c:458
    4 0x55b34337bed4 in bgp_attr_intern bgpd/bgp_attr.c:967
    5 0x55b34368165b in bgp_advertise_attr_intern bgpd/bgp_advertise.c:106
    6 0x55b3435277d7 in bgp_adj_out_set_subgroup bgpd/bgp_updgrp_adv.c:587
    7 0x55b34368f36b in bgp_conditional_adv_routes bgpd/bgp_conditional_adv.c:125
    8 0x55b34368ff58 in bgp_conditional_adv_timer bgpd/bgp_conditional_adv.c:301
    9 0x7f7d41cdf81c in event_call lib/event.c:1980
    10 0x7f7d41c1da37 in frr_run lib/libfrr.c:1214
    11 0x55b343371e22 in main bgpd/bgp_main.c:510
    12 0x7f7d41517082 in __libc_start_main ../csu/libc-start.c:308

previously allocated by thread T0 here:
    #0 0x7f7d42075a06 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:153
    1 0x7f7d41c3c28e in qcalloc lib/memory.c:105
    2 0x55b3433976e8 in community_dup bgpd/bgp_community.c:514
    3 0x55b34350273a in route_set_community bgpd/bgp_routemap.c:2589
    4 0x7f7d41c96c06 in route_map_apply_ext lib/routemap.c:2690
    5 0x55b34368f2d8 in bgp_conditional_adv_routes bgpd/bgp_conditional_adv.c:107
    6 0x55b34368ff58 in bgp_conditional_adv_timer bgpd/bgp_conditional_adv.c:301
    7 0x7f7d41cdf81c in event_call lib/event.c:1980
    8 0x7f7d41c1da37 in frr_run lib/libfrr.c:1214
    9 0x55b343371e22 in main bgpd/bgp_main.c:510
    10 0x7f7d41517082 in __libc_start_main ../csu/libc-start.c:308
```

And also a crash:

```
(gdb) bt
0  raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
1  0x00007ff3b7048ce0 in core_handler (signo=6, siginfo=0x7ffc8cf724b0, context=<optimized out>)
    at lib/sigevent.c:246
2  <signal handler called>
3  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
4  0x00007ff3b6bb8859 in __GI_abort () at abort.c:79
5  0x00007ff3b6c2326e in __libc_message (action=action@entry=do_abort,
    fmt=fmt@entry=0x7ff3b6d4d298 "%s\n") at ../sysdeps/posix/libc_fatal.c:155
6  0x00007ff3b6c2b2fc in malloc_printerr (
    str=str@entry=0x7ff3b6d4f628 "double free or corruption (fasttop)") at malloc.c:5347
7  0x00007ff3b6c2cc65 in _int_free (av=0x7ff3b6d82b80 <main_arena>, p=0x555c8fa70a10, have_lock=0)
    at malloc.c:4266
8  0x0000555c8da94bd3 in community_free (com=0x7ffc8cf72e70) at bgpd/bgp_community.c:41
9  community_free (com=com@entry=0x7ffc8cf72e70) at bgpd/bgp_community.c:28
10 0x0000555c8da8afc1 in bgp_attr_flush (attr=attr@entry=0x7ffc8cf73040) at bgpd/bgp_attr.c:1290
11 0x0000555c8dbc0760 in bgp_conditional_adv_routes (peer=peer@entry=0x555c8fa627c0,
    afi=afi@entry=AFI_IP, safi=SAFI_UNICAST, table=table@entry=0x555c8fa510b0, rmap=0x555c8fa71cb0,
    update_type=UPDATE_TYPE_ADVERTISE) at bgpd/bgp_conditional_adv.c:111
12 0x0000555c8dbc0b75 in bgp_conditional_adv_timer (t=<optimized out>)
    at bgpd/bgp_conditional_adv.c:301
13 0x00007ff3b705b84c in event_call (thread=thread@entry=0x7ffc8cf73440) at lib/event.c:1980
14 0x00007ff3b700bf98 in frr_run (master=0x555c8f27c090) at lib/libfrr.c:1214
15 0x0000555c8da85f05 in main (argc=<optimized out>, argv=0x7ffc8cf736a8) at bgpd/bgp_main.c:510
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
17 months agotests: Set community for conditionally advertised routes
Donatas Abraitis [Tue, 21 Nov 2023 08:38:12 +0000 (10:38 +0200)]
tests: Set community for conditionally advertised routes

Just to make sure we don't crash bgpd with double-free if an existing route
already exists.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
17 months agoMerge pull request #14835 from donaldsharp/multipath_evpn_encap_attr
Donatas Abraitis [Tue, 21 Nov 2023 07:08:40 +0000 (09:08 +0200)]
Merge pull request #14835 from donaldsharp/multipath_evpn_encap_attr

zebra: Fix fpm multipath encap addition

17 months agolib: Update int and ll decoders with new MTYPE 9012/head
Donald Lee [Mon, 9 Aug 2021 20:54:50 +0000 (04:54 +0800)]
lib: Update int and ll decoders with new MTYPE

In the master branch a new MTYPE_SCRIPT_RES was created for
frrscript_get_results, lua_to decoders should use that

Signed-off-by: Donald Lee <dlqs@gmx.com>
17 months agodoc: Remove mention of const noop decoder
Donald Lee [Thu, 8 Jul 2021 20:47:17 +0000 (04:47 +0800)]
doc: Remove mention of const noop decoder

Now handled by _lua_noop

Signed-off-by: Donald Lee <dlqs@gmx.com>
17 months agolib: Create encoders for int and rename stuff
Donald Lee [Mon, 9 Aug 2021 20:41:25 +0000 (04:41 +0800)]
lib: Create encoders for int and rename stuff

Create encoders/decoders for int and rename current int encoders
/decoders to long long.

Signed-off-by: Donald Lee <dlqs@gmx.com>
17 months agolib: Remove old noop decoders
Donald Lee [Mon, 9 Aug 2021 20:39:15 +0000 (04:39 +0800)]
lib: Remove old noop decoders

Co-authored-by: Quentin Young <qlyoung@qlyoung.net>
Signed-off-by: Quentin Young <qlyoung@qlyoung.net>
Signed-off-by: Donald Lee <dlqs@gmx.com>
17 months agolib: Add more Lua types to encoder/decoder
Donald Lee [Mon, 9 Aug 2021 20:37:32 +0000 (04:37 +0800)]
lib: Add more Lua types to encoder/decoder

Signed-off-by: Donald Lee <dlqs@gmx.com>
17 months agolib: Add polymorphic noop macro
Donald Lee [Mon, 9 Aug 2021 20:36:30 +0000 (04:36 +0800)]
lib: Add polymorphic noop macro

Co-authored-by: Quentin Young <qlyoung@qlyoung.net>
Signed-off-by: Quentin Young <qlyoung@qlyoung.net>
Signed-off-by: Donald Lee <dlqs@gmx.com>
17 months agoMerge pull request #14813 from idryzhov/vtysh-file-lock
Donald Sharp [Mon, 20 Nov 2023 20:18:42 +0000 (15:18 -0500)]
Merge pull request #14813 from idryzhov/vtysh-file-lock

vtysh: clean vtysh_file_locked when exiting config node

17 months agoMerge pull request #14833 from opensourcerouting/fix/frrtrace_bmp
Donald Sharp [Mon, 20 Nov 2023 20:17:13 +0000 (15:17 -0500)]
Merge pull request #14833 from opensourcerouting/fix/frrtrace_bmp

bgpd: Fix frrtrace arguments for bmp_eor tracing

17 months agoMerge pull request #14823 from opensourcerouting/isis-adj-cleanup
Donald Sharp [Mon, 20 Nov 2023 15:44:25 +0000 (10:44 -0500)]
Merge pull request #14823 from opensourcerouting/isis-adj-cleanup

isisd: remove unused router_address fields