]> git.puffer.fish Git - matthieu/frr.git/log
matthieu/frr.git
16 months agolib: fix nexthop_group_nexthop_num_no_recurse() is static
Philippe Guibert [Mon, 27 Nov 2023 08:25:59 +0000 (09:25 +0100)]
lib: fix nexthop_group_nexthop_num_no_recurse() is static

No need to declare 'nexthop_group_nexthop_num_no_recurse()' as external.

Fixes: 98cda54a9543 ("zebra: Add recursive functionality to NHE's")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
16 months agoMerge pull request #14938 from rampxxxx/ubi8_protobuf
Donatas Abraitis [Tue, 5 Dec 2023 07:15:38 +0000 (09:15 +0200)]
Merge pull request #14938 from rampxxxx/ubi8_protobuf

docker/ubi8-minimal: add protobuf-c runtime dep

16 months agodocker/ubi8-minimal: add protobuf-c runtime dep
lynnemorrison [Mon, 4 Dec 2023 22:41:04 +0000 (17:41 -0500)]
docker/ubi8-minimal: add protobuf-c runtime dep

FRR's RPM package requires protobuf-c to be installed on the runtime
system, otherwise it will refuse to be installed.

Signed-off-by: Juan Vidal Allende <juan.vidal1@ibm.com>
16 months agoMerge pull request #14885 from pguibert6WIND/misc_nhg_fixes
Donald Sharp [Mon, 4 Dec 2023 12:31:14 +0000 (07:31 -0500)]
Merge pull request #14885 from pguibert6WIND/misc_nhg_fixes

various nexthop group fixes

16 months agoMerge pull request #14929 from opensourcerouting/fix/add_rfc9494
Donald Sharp [Mon, 4 Dec 2023 12:30:40 +0000 (07:30 -0500)]
Merge pull request #14929 from opensourcerouting/fix/add_rfc9494

doc: Add RFC 9494 to the supported RFC list

16 months agodoc: Add RFC 9494 to the supported RFC list
Donatas Abraitis [Sun, 3 Dec 2023 17:27:11 +0000 (19:27 +0200)]
doc: Add RFC 9494 to the supported RFC list

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
16 months agoMerge pull request #14923 from opensourcerouting/fix/array_overrun_for_fqdn_domainname
Igor Ryzhov [Sat, 2 Dec 2023 17:42:52 +0000 (19:42 +0200)]
Merge pull request #14923 from opensourcerouting/fix/array_overrun_for_fqdn_domainname

bgpd: Do not null-terminate the domainname when receiving FQDN capability

16 months agoMerge pull request #14925 from pguibert6WIND/doctring_pathd_fix
Jafar Al-Gharaibeh [Fri, 1 Dec 2023 17:24:30 +0000 (11:24 -0600)]
Merge pull request #14925 from pguibert6WIND/doctring_pathd_fix

pathd: fix excessive doc string on pcep msd command

16 months agopathd: fix excessive doc string on pcep msd command
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 #14911 from LabNConsulting/chopps/speed-xpath-up
Igor Ryzhov [Fri, 1 Dec 2023 11:32:32 +0000 (13:32 +0200)]
Merge pull request #14911 from LabNConsulting/chopps/speed-xpath-up

lib: all: remove './' from xpath 22% speedup

16 months agobgpd: Do not null-terminate the domainname when receiving FQDN capability
Donatas Abraitis [Fri, 1 Dec 2023 08:35:19 +0000 (10:35 +0200)]
bgpd: Do not null-terminate the domainname when receiving FQDN capability

This is already handled above, no need to do here, because we could have an
overrun situation where len > 64 and we do out-of-bound actions.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
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 agolib: fix nexthop node entry from nhg_list
Philippe Guibert [Thu, 30 Nov 2023 12:57:57 +0000 (13:57 +0100)]
lib: fix nexthop node entry from nhg_list

When stopping a VRF, the linked list entries must be
removed too.

Fixes: 98cbbaea91f6 ("lib: Handle if up/down and vrf enable/disable events")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
16 months agolib: remove useless nexthop_group_active_nexthop_num_no_recurse()
Philippe Guibert [Mon, 27 Nov 2023 11:28:52 +0000 (12:28 +0100)]
lib: remove useless nexthop_group_active_nexthop_num_no_recurse()

The nexthop_group_active_nexthop_num_no_recurse() function is no more
used. Let us remove the function call.

Fixes: 148813c22a8d ("zebra: zebra_nhg check each nexthop for active, not just number")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
16 months agozebra: fix wrong nexthop id debug message
Philippe Guibert [Fri, 24 Nov 2023 15:38:31 +0000 (16:38 +0100)]
zebra: fix wrong nexthop id debug message

When allocating big protocol level identifiers, the number range is
big, and when pushing to netlink messages, the first nexthop group
is truncated, whereas the nexthop has been installed on the kernel.

> ubuntu2204(config)# nexthop-group A
> ubuntu2204(config-nh-group)# group 1
> ubuntu2204(config-nh-group)# group 2
> ubuntu2204(config-nh-group)# exi
> ubuntu2204(config)# nexthop-group 1
> ubuntu2204(config-nh-group)# nexthop 192.0.2.130 loop1 enable-proto-nhg-control
> ubuntu2204(config-nh-group)# exi
> ubuntu2204(config)# nexthop-group 2
> ubuntu2204(config-nh-group)# nexthop 192.0.2.131 loop1 enable-proto-nhg-control
> [..]
> 2023/11/24 16:47:40 ZEBRA: [VNMVB-91G3G] _netlink_nexthop_build_group: ID (179687500): group 17968/179687502

> # ip nexthop ls
> id 179687500 group 179687501/179687502 proto 194

Fix this by increasing the buffer size when appending the first number.

Fixes: 8d03bc501b5f ("zebra: Handle nhg_hash_entry encaps/more debugging")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
16 months agozebra: add client counter for nhg operations
Philippe Guibert [Thu, 23 Nov 2023 16:18:23 +0000 (17:18 +0100)]
zebra: add client counter for nhg operations

Add three counters that account for the nhg operations
that are using the zebra API with the NHG_ADD and NHG_DEL
commands.

> # show zebra client
> [..]
> Type        Add         Update      Del
> ==================================================
> IPv4        100         0           0
> IPv6        0           0           0
> Redist:v4   0           0           0
> Redist:v6   0           0           0
> NHG         1           1           1
> VRF         3           0           0
> [..]

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
16 months agozebra: clarify error when calling zebra_nhg_rib_find_nhe()
Philippe Guibert [Mon, 4 Sep 2023 13:43:37 +0000 (15:43 +0200)]
zebra: clarify error when calling zebra_nhg_rib_find_nhe()

Display a specific log message when the rt_nhe parameter is not
set at all.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
16 months agosharpd: fix deleting nhid when suppressing nexthop from nh group
Philippe Guibert [Thu, 23 Nov 2023 13:19:04 +0000 (14:19 +0100)]
sharpd: fix deleting nhid when suppressing nexthop from nh group

When removing the last nexthop from a nexthop-group, the nexthop
group remains in the zebra contexts:

> ubuntu2204(config)# nexthop-group gdgd
> 2023/11/23 14:06:36 SHARP: [Q5NBA-GN1BG] NHG ID assigned: 179687502
> ubuntu2204(config-nh-group)# nexthop 192.0.2.7 loop1
> ubuntu2204(config-nh-group)# 2023/11/23 14:06:38 ZEBRA: [VNMVB-91G3G] _netlink_nexthop_build_group: ID (179687502): group 338
> 2023/11/23 14:06:38 ZEBRA: [R43C6-KYHWT] netlink_nexthop_msg_encode: RTM_NEWNEXTHOP, id=179687502
> 2023/11/23 14:06:38 ZEBRA: [HYEHE-CQZ9G] nl_batch_send: netlink-dp (NS 0), batch size=44, msg cnt=1
> 2023/11/23 14:06:38 SHARP: [JWRCN-N9K90] Installed nhg 179687502
>
> ubuntu2204(config-nh-group)# no nexthop 192.0.2.7 loop1
> 2023/11/23 14:06:47 SHARP: [Y2G2F-ZTW6M] nhg_add: nhg 179687502 not sent: no valid nexthops
> ubuntu2204(config-nh-group)# do show nexthop-group rib 179687502
> ID: 179687502 (sharp)
>      RefCnt: 1
>      Uptime: 00:00:23
>      VRF: default
>      Valid, Installed
>      Depends: (338)
>            via 192.0.2.7, loop1 (vrf default), weight 1

Fix this by sending an NHG_DEL message when no nexthops are attached,
and when the id was already installed.

Fixes: 5a9c0931aa95 ("sharpd: don't send invalid nexthop-groups to zebra")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
17 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

17 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

17 months agobgpd: lttng tp add evpn route events
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>
17 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
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 agolib: all: remove './' from xpath 22% speedup
Christian Hopps [Wed, 29 Nov 2023 19:37:23 +0000 (14:37 -0500)]
lib: all: remove './' from xpath 22% speedup

fixes #8299

Signed-off-by: Christian Hopps <chopps@labn.net>
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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