]> git.puffer.fish Git - mirror/frr.git/log
mirror/frr.git
2 months agotests: check as number in show run 18272/head
Louis Scalbert [Fri, 14 Feb 2025 10:58:24 +0000 (11:58 +0100)]
tests: check as number in show run

Creates the default VRF instance after the other VRF instances. The
default VRF instance is created in hidden state. Check that AS number
in show run is correctly written.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit 077a2b0dfc71443b41d5feceb52023c259436956)
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2 months agobgpd: fix leaving hidden state
Louis Scalbert [Fri, 14 Feb 2025 14:03:00 +0000 (15:03 +0100)]
bgpd: fix leaving hidden state

Upon configuration of a VRF instance that references an absent default
VRF with "import vrf default", the default instance is created in hidden
state. However, the default instance is not properly un-hidden when
configured.

Restore the behavior prior to commit below.

Fixes: 9f7177af13 ("bgpd: fix duplicate BGP instance created with unified config")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit 70e07678bfe554dd5be30a605ddf6c0fe3a8a39b)
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2 months agotests: add bgp_l3vpn_hidden topotest
Louis Scalbert [Fri, 14 Feb 2025 13:07:40 +0000 (14:07 +0100)]
tests: add bgp_l3vpn_hidden topotest

Test that leaving the hidden BGP instance state is working.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit 118afe4690d5563887c1b2095d18e23cc77a21a2)
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2 months agobgpd: update AS value of a hidden bgp instance
Alexander Skorichenko [Sat, 1 Feb 2025 00:52:17 +0000 (01:52 +0100)]
bgpd: update AS value of a hidden bgp instance

'import vrf VRF' could define a hidden bgp instance with
the default AS_UNSPECIFIED (i.e. = 1) value.
When a
router bgp AS vrf VRF
gets configured later on, replace this AS_UNSPECIFIED setting
with a requested value.

Fixes: 9680831518 ("bgpd: fix as_pretty mem leaks when un-hiding")
Signed-off-by: Alexander Skorichenko <askorichenko@netgate.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit 1515a59202280933936b41c4cb2cb11c7889b279)
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2 months agoRevert "bgpd: fix bgp vrf instance creation from implicit"
Louis Scalbert [Fri, 14 Feb 2025 17:01:00 +0000 (18:01 +0100)]
Revert "bgpd: fix bgp vrf instance creation from implicit"

This reverts commit 2ff08af78e315c69795417d150cd23649f68c655.

The fix is obviously wrong.

Link: 2ff08af78e315c69795417d150cd23649f68c655
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit 339206341fa08c57316559eb3733d216236dfe9d)
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2 months agobgpd: fix process_queue when un-hiding
Louis Scalbert [Wed, 12 Feb 2025 12:09:37 +0000 (13:09 +0100)]
bgpd: fix process_queue when un-hiding

bgp_process_queue_init() is not called in bgp_create() when leaving the
BGP instance hidden state because of the following goto:

> if (hidden) {
> bgp = bgp_old;
> goto peer_init;
> }

Upon reconfiguration of the default instance, the prefixes are never set
into a meta queue by mq_add_handler(). They are never processed for
zebra RIB installation and announcements of update/withdraw.

Do not delete the BGP process_queue when hiding.

Fixes: 4d0e7a49cf ("bgpd: VRF-Lite fix default bgp delete")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit 71a3756f2dda272e69727fa416bca12c016d9567)
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2 months agobgpd: fix default instance name when un-hiding
Louis Scalbert [Wed, 12 Feb 2025 11:56:49 +0000 (12:56 +0100)]
bgpd: fix default instance name when un-hiding

When unconfiguring a default BGP instance with VPN SAFI configurations,
the default BGP structure remains but enters a hidden state. Upon
reconfiguration, the instance name incorrectly appears as "VIEW ?"
instead of "VRF default". And the name_pretty pointer

The name_pretty pointer is replaced by another one with the incorrect
name. This also leads to a memory leak as the previous pointer is not
properly freed.

Do not rewrite the instance name.

Fixes: 4d0e7a49cf ("bgpd: VRF-Lite fix default bgp delete")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit d2ff7e8a2117ad4bc38cec0e48c6b3c11dc49c91)
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2 months agoMerge pull request #18207 from FRRouting/mergify/bp/dev/10.3/pr-17666
Donald Sharp [Wed, 26 Feb 2025 16:15:31 +0000 (11:15 -0500)]
Merge pull request #18207 from FRRouting/mergify/bp/dev/10.3/pr-17666

pimd: During prefix-list update, behave as PIM_UPSTREAM_NOTJOINED sta… (backport #17666)

2 months agoMerge pull request #18255 from Jafaral/no-bgp-hidden
Donald Sharp [Wed, 26 Feb 2025 13:24:51 +0000 (08:24 -0500)]
Merge pull request #18255 from Jafaral/no-bgp-hidden

Revert "bgpd: fix default instance when leaving the hidden state (backport 10.3)" #18162

2 months agoMerge pull request #18227 from FRRouting/mergify/bp/dev/10.3/pr-18210
Russ White [Tue, 25 Feb 2025 15:40:48 +0000 (10:40 -0500)]
Merge pull request #18227 from FRRouting/mergify/bp/dev/10.3/pr-18210

bgpd: remove dmed check not required in bestpath selection (backport #18210)

2 months agoMerge pull request #18232 from FRRouting/mergify/bp/dev/10.3/pr-18231
Donald Sharp [Tue, 25 Feb 2025 15:38:16 +0000 (10:38 -0500)]
Merge pull request #18232 from FRRouting/mergify/bp/dev/10.3/pr-18231

Fix oper-state queries that involve choice/case nodes (backport #18231)

2 months agoMerge pull request #18244 from FRRouting/mergify/bp/dev/10.3/pr-18225
Donald Sharp [Tue, 25 Feb 2025 15:37:55 +0000 (10:37 -0500)]
Merge pull request #18244 from FRRouting/mergify/bp/dev/10.3/pr-18225

pim: Fix autorp group joins (backport #18225)

2 months agoMerge pull request #18246 from FRRouting/mergify/bp/dev/10.3/pr-18226
Donald Sharp [Tue, 25 Feb 2025 15:37:12 +0000 (10:37 -0500)]
Merge pull request #18246 from FRRouting/mergify/bp/dev/10.3/pr-18226

pim: Fix vrf binding of autorp and mroute socket (backport #18226)

2 months agoMerge pull request #18248 from FRRouting/mergify/bp/dev/10.3/pr-18216
Donald Sharp [Tue, 25 Feb 2025 15:36:56 +0000 (10:36 -0500)]
Merge pull request #18248 from FRRouting/mergify/bp/dev/10.3/pr-18216

pimd: Fix PIM VRF support (send register/register stop in VRF) (backport #18216)

2 months agoRevert "bgpd: fix default instance name when un-hiding" 18255/head
Jafar Al-Gharaibeh [Mon, 24 Feb 2025 23:17:30 +0000 (17:17 -0600)]
Revert "bgpd: fix default instance name when un-hiding"

This reverts commit 20664936afc7f952a51a19ab26daece5105bbee5.

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2 months agoRevert "bgpd: fix process_queue when un-hiding"
Jafar Al-Gharaibeh [Mon, 24 Feb 2025 23:17:27 +0000 (17:17 -0600)]
Revert "bgpd: fix process_queue when un-hiding"

This reverts commit a2c1956efa399c6770605712d0b53e5f24979acc.

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2 months agoReapply "bgpd: fix bgp vrf instance creation from implicit"
Jafar Al-Gharaibeh [Mon, 24 Feb 2025 23:17:10 +0000 (17:17 -0600)]
Reapply "bgpd: fix bgp vrf instance creation from implicit"

This reverts commit d9d74d33bca0e23a2cd4723fbc4709dc83fd1332.

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2 months agoRevert "bgpd: update AS value of a hidden bgp instance"
Jafar Al-Gharaibeh [Mon, 24 Feb 2025 23:17:09 +0000 (17:17 -0600)]
Revert "bgpd: update AS value of a hidden bgp instance"

This reverts commit 8e04277fff9597412198da123250e1951bfc580d.

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2 months agoRevert "tests: add bgp_l3vpn_hidden topotest"
Jafar Al-Gharaibeh [Mon, 24 Feb 2025 23:17:07 +0000 (17:17 -0600)]
Revert "tests: add bgp_l3vpn_hidden topotest"

This reverts commit bb79a6562ffd520329246920597f83ca32e9a468.

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2 months agoRevert "tests: check as number in show run"
Jafar Al-Gharaibeh [Mon, 24 Feb 2025 23:17:02 +0000 (17:17 -0600)]
Revert "tests: check as number in show run"

This reverts commit 85c5598bb95aa2eb17e8f617965affa7de627c69.

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2 months agopimd: Fix PIM VRF support (send register/register stop in VRF) 18248/head
Martin Buck [Fri, 21 Feb 2025 07:54:49 +0000 (08:54 +0100)]
pimd: Fix PIM VRF support (send register/register stop in VRF)

In 946195391406269003275850e1a4d550ea8db38b and
8ebcc02328c6b63ecf85e44fdfbf3365be27c127, transmission of PIM register and
register stop messages was changed to use a separate socket. However, that
socket is not bound to a possible VRF, so the messages were sent in the
default VRF instead. Call vrf_bind() once after socket creation and when the
VRF is ready to ensure transmission in the correct VRF. vrf_bind() handles
the non-VRF case (i.e. VRF_DEFAULT) automatically, so it may be called
unconditionally.

Signed-off-by: Martin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
(cherry picked from commit 5a01011e0d2db538a8ba523904bd4f08b786edfb)

2 months agopim: Fix vrf binding of autorp and mroute socket 18246/head
Nathan Bahr [Fri, 21 Feb 2025 17:55:16 +0000 (17:55 +0000)]
pim: Fix vrf binding of autorp and mroute socket

Bind the autorp socket to the vrf device.
Also fixed mroute socket to use vrf_bind instead of directly
setting the socket option.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
(cherry picked from commit 7e181a771c2e525aeda6e8f6c2d58e9ee2503949)

2 months agopim: Fix autorp group joins 18244/head
Nathan Bahr [Fri, 21 Feb 2025 17:59:04 +0000 (17:59 +0000)]
pim: Fix autorp group joins

Group joining got broken when moving the autorp socket to open/close
as needed. This fixes it so autorp group joining is properly handled
as part of opening the socket.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
(cherry picked from commit d840560b74e3a6117aa1e4b1203dcdd8fb254ef6)

2 months agotests: add unit-test for choice/case node queries 18232/head
Christian Hopps [Sat, 22 Feb 2025 14:09:38 +0000 (14:09 +0000)]
tests: add unit-test for choice/case node queries

Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit 73df7da40a107eab52a6819e6325d950ba569220)

2 months agolib: nb: fix oper-state queries that involve choice/case nodes
Christian Hopps [Sat, 22 Feb 2025 14:08:27 +0000 (14:08 +0000)]
lib: nb: fix oper-state queries that involve choice/case nodes

Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit b9ff10b0863a81e95ca72778a2f1230b47ee2fae)

2 months agobgpd: remove dmed check not required in bestpath selection 18227/head
Donald Sharp [Thu, 20 Feb 2025 19:28:15 +0000 (14:28 -0500)]
bgpd: remove dmed check not required in bestpath selection

As part of the upstream master commit (f3575f61c7 bgpd: Sort the
bgp_path_inf) the snippet of the code for dmed check condition
left out, which leads to an issue of selecting incorrect bestpath.

As an example:

During the bestpath selection local route looses to another path due
to dmed condition being hit.

The snippet of the logs:

2025/02/20 03:06:20.131441 BGP: [JW7VP-K1YVV]
[2]:[0]:[48]:[00:92:00:00:00:10](VRF default): Comparing path
27.0.0.7 flags Valid  with path Static announcement flags Selected Valid Attr Changed Unsorted
2025/02/20 03:06:20.131445 BGP: [SYTDR-QV6X9] [2]:[0]:[48]:[00:92:00:00:00:10]: path 27.0.0.7 loses to path Static announcement as ES 03:44:38:39:ff:ff:02:00:00:01 is same and local
2025/02/20 03:06:20.131452 BGP: [JW7VP-K1YVV] [2]:[0]:[48]:[00:92:00:00:00:10](VRF default): Comparing path 27.0.0.8 flags Valid  with path Static announcement flags Selected Valid Attr Changed Unsorted
2025/02/20 03:06:20.131456 BGP: [SYTDR-QV6X9] [2]:[0]:[48]:[00:92:00:00:00:10]: path 27.0.0.8 loses to path Static announcement as ES 03:44:38:39:ff:ff:02:00:00:01 is same and local
2025/02/20 03:06:20.131458 BGP: [WEWEC-8SE72] [2]:[0]:[48]:[00:92:00:00:00:10](VRF default): path Static announcement is the bestpath from AS 0   <<<< static is best
2025/02/20 03:06:20.131463 BGP: [Z3A78-GM3G5] bgp_best_selection: [2]:[0]:[48]:[00:92:00:00:00:10](VRF default) pi 27.0.0.7 dmed
2025/02/20 03:06:20.131467 BGP: [Z3A78-GM3G5] bgp_best_selection: [2]:[0]:[48]:[00:92:00:00:00:10](VRF default) pi 27.0.0.8 dmed
2025/02/20 03:06:20.131471 BGP: [N6CTF-2RSKS] [2]:[0]:[48]:[00:92:00:00:00:10](VRF default): After path selection, newbest is path 27.0.0.7 oldbest was Static announce

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 83ad94694bc061e1ff5f43db42cba46320e0df73)

2 months agoMerge pull request #18203 from FRRouting/mergify/bp/dev/10.3/pr-14227
Donald Sharp [Thu, 20 Feb 2025 21:20:09 +0000 (16:20 -0500)]
Merge pull request #18203 from FRRouting/mergify/bp/dev/10.3/pr-14227

pimd: Fix for data packet loss when FHR is LHR and RP (backport #14227)

2 months agopimd: During prefix-list update, behave as PIM_UPSTREAM_NOTJOINED state (conformance... 18207/head
Rajesh Varatharaj [Wed, 21 Jun 2023 17:59:12 +0000 (10:59 -0700)]
pimd: During prefix-list update, behave as PIM_UPSTREAM_NOTJOINED state (conformance issue)

Issue:
If there are any changes to the prefix list, we perform a re-lookup to map the correct RP for the group.
Even if the S,G entry is PIM_UPSTREAM_NOTJOINED and in FHR, In the case of IGMPv3, an S,G entry can be
created with no joins. this is not necessary.
 https://www.rfc-editor.org/rfc/rfc4601#section-4.5.7 says no op in case of NOTJOINED

Solution:
To solve this issue, Stop RP mapping when the state is NOTJOINED

Ticket: #3496931

Signed-off-by: Rajesh Varatharaj <rvaratharaj@nvidia.com>
(cherry picked from commit 51f26d17da288af44a8a0e536dbe317a7e678514)

2 months agopimd: Fix for data packet loss when FHR is LHR and RP 18203/head
Rajesh Varatharaj [Thu, 17 Aug 2023 20:11:42 +0000 (13:11 -0700)]
pimd: Fix for data packet loss when FHR is LHR and RP

Topology:
A single router is acting as the First Hop Router (FHR), Last Hop Router (LHR), and RP.

RC and Issue:
When an upstream S,G is in join state, it sends a register message to the RP.
If the RP has the receiver, it sends a register stop message and switches to the shortest path.
When the register stop message is processed, it removes pimreg, moves to prune,
and starts the reg stop timer.

When the reg stop timer expires, PIM changes S,G state to Join Pending and sends out a NULL
register message to RP. RP receives it and fails to send Reg stop because SPT is not set at that point.

The problem is when the register stop timer pops and state is in Join Pending.
According to https://www.rfc-editor.org/rfc/rfc4601#section-4.4.1,
we need to put back the pimreg reg tunnel into the S,G mroute.
This causes data to be sent to the control plane and subsequently interrupts the line rate.

Fix:
If the router is FHR and RP to the group,
ignore SPT status and send out a register stop message back to the DR (in this context, the same router).

Ticket: #3506780

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Signed-off-by: Rajesh Varatharaj <rvaratharaj@nvidia.com>
(cherry picked from commit 8280257cc99e071c205e469399f2fb41671b30eb)

2 months agoMerge pull request #18162 from louis-6wind/bgp-hidden-10.3
Donald Sharp [Wed, 19 Feb 2025 13:08:58 +0000 (08:08 -0500)]
Merge pull request #18162 from louis-6wind/bgp-hidden-10.3

bgpd: fix default instance when leaving the hidden state (backport 10.3)

2 months agoMerge pull request #18191 from FRRouting/mergify/bp/dev/10.3/pr-18082
Jafar Al-Gharaibeh [Tue, 18 Feb 2025 05:14:16 +0000 (23:14 -0600)]
Merge pull request #18191 from FRRouting/mergify/bp/dev/10.3/pr-18082

lib: nb: call child destroy CBs when YANG container is deleted (backport #18082)

2 months agolib: nb: call child destroy CBs when YANG container is deleted 18191/head
Christian Hopps [Tue, 11 Feb 2025 07:12:06 +0000 (07:12 +0000)]
lib: nb: call child destroy CBs when YANG container is deleted

Previously the code was only calling the child destroy callbacks if the target
deleted node was a non-presence container. We now add a flag to the callback
structure to instruct northbound to perform the rescursive delete for code that
wishes for this to happen.

- Fix wrong relative path lookup in keychain destroy callback

Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit d03ecf4562ef3ade6b7b83bf6c683c4741f395ba)

2 months agoMerge pull request #18143 from FRRouting/mergify/bp/dev/10.3/pr-18079
Jafar Al-Gharaibeh [Mon, 17 Feb 2025 19:05:21 +0000 (13:05 -0600)]
Merge pull request #18143 from FRRouting/mergify/bp/dev/10.3/pr-18079

bgpd: Fix crash in bgp_labelpool (backport #18079)

2 months agoMerge pull request #18166 from FRRouting/mergify/bp/dev/10.3/pr-18160
Donald Sharp [Sun, 16 Feb 2025 20:50:34 +0000 (15:50 -0500)]
Merge pull request #18166 from FRRouting/mergify/bp/dev/10.3/pr-18160

bgpd: When removing the prefix list drop the pointer (backport #18160)

2 months agoMerge pull request #18179 from FRRouting/mergify/bp/dev/10.3/pr-18178
Donald Sharp [Sun, 16 Feb 2025 20:50:08 +0000 (15:50 -0500)]
Merge pull request #18179 from FRRouting/mergify/bp/dev/10.3/pr-18178

isisd: Request SRv6 locator after zebra connection (backport #18178)

2 months agoMerge pull request #18183 from FRRouting/mergify/bp/dev/10.3/pr-18109
Donald Sharp [Sun, 16 Feb 2025 13:10:09 +0000 (08:10 -0500)]
Merge pull request #18183 from FRRouting/mergify/bp/dev/10.3/pr-18109

bgpd: fix vty output of evpn route-target AS4 (backport #18109)

2 months agobgpd: fix vty output of evpn route-target AS4 18183/head
Mark Stapp [Tue, 11 Feb 2025 19:35:28 +0000 (14:35 -0500)]
bgpd: fix vty output of evpn route-target AS4

evpn route-targets are decoded in  ... multiple places; at least
two have a bug where the AS4 form doesn't have its AS decoded.

Signed-off-by: Mark Stapp <mjs@cisco.com>
(cherry picked from commit 9943a08720ccbed87cd6938791066a0de94a92c6)

2 months agoisisd: Request SRv6 locator after zebra connection 18179/head
Carmine Scarpitta [Sat, 15 Feb 2025 09:39:40 +0000 (10:39 +0100)]
isisd: Request SRv6 locator after zebra connection

When SRv6 is enabled and an SRv6 locator is specified in the IS-IS
configuration, IS-IS may attempt to request SRv6 locator information from
zebra before the connection is fully established. If this occurs, the
request fails with the following error:

```
2025/02/14 21:41:20 ISIS: [HR66R-TWQYD][EC 100663302] srv6_manager_get_locator: invalid zclient socket
````

As a result, IS-IS is unable to obtain the locator information,
preventing SRv6 from working.

This commit fixes the issue by ensuring IS-IS requests SRv6 locator
information once the connection with zebra is successfully established.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
(cherry picked from commit f02dba19d20b0a53645a439924e736155c8de63f)

2 months agoisisd: Add helper function to request SRv6 locator information
Carmine Scarpitta [Sat, 15 Feb 2025 09:39:30 +0000 (10:39 +0100)]
isisd: Add helper function to request SRv6 locator information

This commit adds a function that iterates over all IS-IS areas and asks
the SRv6 Manager for information about the configured locators.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
(cherry picked from commit 0b76fb3c133951c8d1203dbe7c2e5a4e1b67dffe)

2 months agobgpd: When removing the prefix list drop the pointer 18166/head
Donald Sharp [Fri, 14 Feb 2025 12:55:09 +0000 (07:55 -0500)]
bgpd: When removing the prefix list drop the pointer

We are very very rarely seeing this crash:

    0 0x7f36ba48e389 in prefix_list_apply_ext lib/plist.c:789
    1 0x55eff3fa4126 in subgroup_announce_check bgpd/bgp_route.c:2334
    2 0x55eff3fa858e in subgroup_process_announce_selected bgpd/bgp_route.c:3440
    3 0x55eff4016488 in subgroup_announce_table bgpd/bgp_updgrp_adv.c:808
    4 0x55eff401664e in subgroup_announce_route bgpd/bgp_updgrp_adv.c:861
    5 0x55eff40111df in peer_af_announce_route bgpd/bgp_updgrp.c:2223
    6 0x55eff3f884cb in bgp_announce_route_timer_expired bgpd/bgp_route.c:5892
    7 0x7f36ba4ec239 in event_call lib/event.c:2019
    8 0x7f36ba41a22a in frr_run lib/libfrr.c:1295
    9 0x55eff3e668b7 in main bgpd/bgp_main.c:557
    10 0x7f36b9e2d249 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    11 0x7f36b9e2d304 in __libc_start_main_impl ../csu/libc-start.c:360
    12 0x55eff3e64a30 in _start (/home/ci/cibuild.1407/frr-source/bgpd/.libs/bgpd+0x2fda30)
0x608000037038 is located 24 bytes inside of 88-byte region [0x608000037020,0x608000037078)
freed by thread T0 here:
    0 0x7f36ba8b76a8 in __interceptor_free ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:52
    1 0x7f36ba439bd7 in qfree lib/memory.c:131
    2 0x7f36ba48d3a3 in prefix_list_free lib/plist.c:156
    3 0x7f36ba48d3a3 in prefix_list_delete lib/plist.c:247
    4 0x7f36ba48fbef in prefix_bgp_orf_remove_all lib/plist.c:1516
    5 0x55eff3f679c4 in bgp_route_refresh_receive bgpd/bgp_packet.c:2841
    6 0x55eff3f70bab in bgp_process_packet bgpd/bgp_packet.c:4069
    7 0x7f36ba4ec239 in event_call lib/event.c:2019
    8 0x7f36ba41a22a in frr_run lib/libfrr.c:1295
    9 0x55eff3e668b7 in main bgpd/bgp_main.c:557
    10 0x7f36b9e2d249 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
previously allocated by thread T0 here:
    0 0x7f36ba8b83b7 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:77
    1 0x7f36ba4392e4 in qcalloc lib/memory.c:106
    2 0x7f36ba48d0de in prefix_list_new lib/plist.c:150
    3 0x7f36ba48d0de in prefix_list_insert lib/plist.c:186
    4 0x7f36ba48d0de in prefix_list_get lib/plist.c:204
    5 0x7f36ba48f9df in prefix_bgp_orf_set lib/plist.c:1479
    6 0x55eff3f67ba6 in bgp_route_refresh_receive bgpd/bgp_packet.c:2920
    7 0x55eff3f70bab in bgp_process_packet bgpd/bgp_packet.c:4069
    8 0x7f36ba4ec239 in event_call lib/event.c:2019
    9 0x7f36ba41a22a in frr_run lib/libfrr.c:1295
    10 0x55eff3e668b7 in main bgpd/bgp_main.c:557
    11 0x7f36b9e2d249 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Let's just stop trying to save the pointer around in the peer->orf_plist
data structure.  There are other design problems but at least lets
stop the crash from possibly happening.

Fixes: #18138
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 3d43d7b78971520854903c11b6aec23754fdca34)

2 months agotests: check as number in show run 18162/head
Louis Scalbert [Fri, 14 Feb 2025 10:58:24 +0000 (11:58 +0100)]
tests: check as number in show run

Creates the default VRF instance after the other VRF instances. The
default VRF instance is created in hidden state. Check that AS number
in show run is correctly written.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2 months agotests: add bgp_l3vpn_hidden topotest
Louis Scalbert [Fri, 14 Feb 2025 13:07:40 +0000 (14:07 +0100)]
tests: add bgp_l3vpn_hidden topotest

Test that leaving the hidden BGP instance state is working.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2 months agobgpd: update AS value of a hidden bgp instance
Alexander Skorichenko [Sat, 1 Feb 2025 00:52:17 +0000 (01:52 +0100)]
bgpd: update AS value of a hidden bgp instance

'import vrf VRF' could define a hidden bgp instance with
the default AS_UNSPECIFIED (i.e. = 1) value.
When a
router bgp AS vrf VRF
gets configured later on, replace this AS_UNSPECIFIED setting
with a requested value.

Fixes: 9680831518 ("bgpd: fix as_pretty mem leaks when un-hiding")
Signed-off-by: Alexander Skorichenko <askorichenko@netgate.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2 months agoRevert "bgpd: fix bgp vrf instance creation from implicit"
Louis Scalbert [Fri, 14 Feb 2025 17:01:00 +0000 (18:01 +0100)]
Revert "bgpd: fix bgp vrf instance creation from implicit"

This reverts commit 2ff08af78e315c69795417d150cd23649f68c655.

The fix is obviously wrong.

Link: 2ff08af78e315c69795417d150cd23649f68c655
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2 months agobgpd: fix process_queue when un-hiding
Louis Scalbert [Wed, 12 Feb 2025 12:09:37 +0000 (13:09 +0100)]
bgpd: fix process_queue when un-hiding

bgp_process_queue_init() is not called in bgp_create() when leaving the
BGP instance hidden state because of the following goto:

> if (hidden) {
> bgp = bgp_old;
> goto peer_init;
> }

Upon reconfiguration of the default instance, the prefixes are never set
into a meta queue by mq_add_handler(). They are never processed for
zebra RIB installation and announcements of update/withdraw.

Do not delete the BGP process_queue when hiding.

Fixes: 4d0e7a49cf ("bgpd: VRF-Lite fix default bgp delete")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2 months agobgpd: fix default instance name when un-hiding
Louis Scalbert [Wed, 12 Feb 2025 11:56:49 +0000 (12:56 +0100)]
bgpd: fix default instance name when un-hiding

When unconfiguring a default BGP instance with VPN SAFI configurations,
the default BGP structure remains but enters a hidden state. Upon
reconfiguration, the instance name incorrectly appears as "VIEW ?"
instead of "VRF default". And the name_pretty pointer

The name_pretty pointer is replaced by another one with the incorrect
name. This also leads to a memory leak as the previous pointer is not
properly freed.

Do not rewrite the instance name.

Fixes: 4d0e7a49cf ("bgpd: VRF-Lite fix default bgp delete")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2 months agoMerge pull request #18146 from FRRouting/mergify/bp/dev/10.3/pr-18023
Jafar Al-Gharaibeh [Fri, 14 Feb 2025 01:04:18 +0000 (19:04 -0600)]
Merge pull request #18146 from FRRouting/mergify/bp/dev/10.3/pr-18023

lib: fix false context information for SRv6 route (backport #18023)

2 months agoMerge pull request #18151 from FRRouting/mergify/bp/dev/10.3/pr-18064
Jafar Al-Gharaibeh [Fri, 14 Feb 2025 01:03:50 +0000 (19:03 -0600)]
Merge pull request #18151 from FRRouting/mergify/bp/dev/10.3/pr-18064

staticd: Fix SRv6 SID installation and deletion (backport #18064)

2 months agoMerge pull request #18154 from FRRouting/mergify/bp/dev/10.3/pr-18121
Donald Sharp [Thu, 13 Feb 2025 22:44:20 +0000 (17:44 -0500)]
Merge pull request #18154 from FRRouting/mergify/bp/dev/10.3/pr-18121

bgpd: release manual vpn label on instance deletion (backport #18121)

2 months agobgpd: release manual vpn label on instance deletion 18154/head
Louis Scalbert [Wed, 12 Feb 2025 12:49:50 +0000 (13:49 +0100)]
bgpd: release manual vpn label on instance deletion

When a BGP instance with a manually assigned VPN label is deleted, the
label is not released from the Zebra label registry. As a result,
reapplying a configuration with the same manual label leads to VPN
prefix export failures.

For example, with the following configuration:

> router bgp 65000 vrf BLUE
>  address-family ipv4 unicast
>   label vpn export <int>

Release zebra label registry on unconfiguration.

Fixes: d162d5f6f5 ("bgpd: fix hardset l3vpn label available in mpls pool")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit d6363625c35a99933bf60c9cf0b79627b468c9f7)

2 months agotests: Extend SRv6 static SIDs topotest to verify SID structure 18151/head
Carmine Scarpitta [Sat, 8 Feb 2025 21:26:13 +0000 (22:26 +0100)]
tests: Extend SRv6 static SIDs topotest to verify SID structure

The `static_srv6_sids` topotest verifies that staticd correctly
programs the SIDs in the zebra RIB. Currently, the topotest only
validates the programmed behavior and SID attributes.

This commit extends the topotest to also validate the SID structure.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
(cherry picked from commit a6d02fe2fb38b8e0c2e1c25fd863f6f96c2c40a6)

2 months agolib: Add sidStructure in SRv6 SIDs JSON output
Carmine Scarpitta [Sat, 8 Feb 2025 21:17:09 +0000 (22:17 +0100)]
lib: Add sidStructure in SRv6 SIDs JSON output

The `show ipv6 route json` command displays the IPv6 routing table in
JSON format, including SRv6 SIDs. For each SRv6 SID, it provides
behavior and SID attributes. However, it does not include the SID
structure.

This commit adds the SID structure to the SRv6 SID JSON output.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
(cherry picked from commit 312f7b3f8c7382afef6993aa2110326db2327c35)

2 months agostaticd: Fix SRv6 SID installation and deletion
Carmine Scarpitta [Fri, 7 Feb 2025 16:47:45 +0000 (17:47 +0100)]
staticd: Fix SRv6 SID installation and deletion

The SRv6 support in staticd (PR #16894) does not set the correct SID
parameters (block length, node length, function length).

This commit fixes the issue and computes the correct parameters.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
(cherry picked from commit e1654ba5548625981d2b9ff580b2fb6e2ae9d5dc)

2 months agolib: fix false context information for SRv6 route 18146/head
Philippe Guibert [Wed, 5 Feb 2025 08:52:59 +0000 (09:52 +0100)]
lib: fix false context information for SRv6 route

The seg6local route dumped by 'show ipv6 route' makes think that the USP
flavor is supported, whereas it is not the case. This information is a
context information, and for End, the context information should be
empty.

> # show ipv6 route
> [..]
> I>* fc00:0:4::/128 [115/0] is directly connected, sr0, seg6local End USP, weight 1, 00:49:01

Fix this by suppressing the USP information from the output.

Fixes: e496b4203055 ("bgpd: prefix-sid srv6 l3vpn service tlv")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
(cherry picked from commit 658bf0281d99461849453628ddc792ec424d0bd4)

2 months agobgpd: Fix crash in bgp_labelpool 18143/head
Donald Sharp [Mon, 10 Feb 2025 17:02:00 +0000 (12:02 -0500)]
bgpd: Fix crash in bgp_labelpool

The bgp labelpool code is grabbing the vpn policy data structure.
This vpn_policy has a pointer to the bgp data structure.  If
a item placed on the bgp label pool workqueue happens to sit
there for the microsecond or so and the operator issues a
`no router bgp...` command that corresponds to the vpn_policy
bgp pointer, when the workqueue is run it will crash because
the bgp pointer is now freed and something else owns it.

Modify the labelpool code to store the vrf id associated
with the request on the workqueue.  When you wake up
if the vrf id still has a bgp pointer allow the request
to continue, else drop it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 14eac319e8ae9314f5270f871106a70c4986c60c)

2 months agoMerge pull request #18129 from FRRouting/mergify/bp/dev/10.3/pr-18026
Donald Sharp [Thu, 13 Feb 2025 16:19:28 +0000 (11:19 -0500)]
Merge pull request #18129 from FRRouting/mergify/bp/dev/10.3/pr-18026

Bfd fixups (backport #18026)

2 months agoMerge pull request #18132 from opensourcerouting/fix/backport_82d28f137aed2e60380807a...
Jafar Al-Gharaibeh [Thu, 13 Feb 2025 04:26:21 +0000 (22:26 -0600)]
Merge pull request #18132 from opensourcerouting/fix/backport_82d28f137aed2e60380807a302e2b312408eff6e_10.3

Cid 1636504 (backport)

2 months agoMerge pull request #18133 from FRRouting/mergify/bp/dev/10.3/pr-18120
Jafar Al-Gharaibeh [Thu, 13 Feb 2025 04:25:55 +0000 (22:25 -0600)]
Merge pull request #18133 from FRRouting/mergify/bp/dev/10.3/pr-18120

bgpd: fix incorrect JSON in bgp_show_table_rd (backport #18120)

2 months agobgpd: fix incorrect json in bgp_show_table_rd 18133/head
Louis Scalbert [Wed, 12 Feb 2025 11:50:42 +0000 (12:50 +0100)]
bgpd: fix incorrect json in bgp_show_table_rd

In bgp_show_table_rd(), the is_last argument is determined using the
expression "next == NULL" to check if the RD table is the last one. This
helps ensure proper JSON formatting.

However, if next is not NULL but is no longer associated with a BGP
table, the JSON output becomes malformed.

Updates the condition to also verify the existence of the next bgp_dest
table.

Fixes: 1ae44dfcba ("bgpd: unify 'show bgp' with RD with normal unicast bgp show")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit cf0269649cdd09b8d3f2dd8815caf6ecf9cdeef9)

2 months agobgpd: fix bgp label evpn CID 1636504 18132/head
Philippe Guibert [Fri, 7 Feb 2025 14:49:10 +0000 (15:49 +0100)]
bgpd: fix bgp label evpn CID 1636504

The following static analysis can be seen :

> *** CID 1636504:    (ARRAY_VS_SINGLETON)
> /bgpd/bgp_evpn_mh.c: 1241 in bgp_evpn_type1_route_process()
> 1235            build_evpn_type1_prefix(&p, eth_tag, &esi, vtep_ip);
> 1236            /* Process the route. */
> 1237            if (attr) {
> 1238                    bgp_update(peer, (struct prefix *)&p, addpath_id, attr, afi, safi, ZEBRA_ROUTE_BGP,
> 1239                               BGP_ROUTE_NORMAL, &prd, &label, num_labels, 0, NULL);
> 1240            } else {
> >>>     CID 1636504:    (ARRAY_VS_SINGLETON)
> >>>     Passing "&label" to function "bgp_withdraw" which uses it as an array. This might corrupt or misinterpret adjacent memory locations.
> 1241                    bgp_withdraw(peer, (struct prefix *)&p, addpath_id, afi, safi, ZEBRA_ROUTE_BGP,
> 1242                                 BGP_ROUTE_NORMAL, &prd, &label, num_labels);
> 1243            }
> 1244            return 0;
> 1245     }
> 1246
> /bgpd/bgp_evpn_mh.c: 1238 in bgp_evpn_type1_route_process()
> 1232             * table
> 1233             */
> 1234            vtep_ip.s_addr = INADDR_ANY;
> 1235            build_evpn_type1_prefix(&p, eth_tag, &esi, vtep_ip);
> 1236            /* Process the route. */
> 1237            if (attr) {
> >>>     CID 1636504:    (ARRAY_VS_SINGLETON)
> >>>     Passing "&label" to function "bgp_update" which uses it as an array. This might corrupt or misinterpret adjacent memory locations.
> 1238                    bgp_update(peer, (struct prefix *)&p, addpath_id, attr, afi, safi, ZEBRA_ROUTE_BGP,
> 1239                               BGP_ROUTE_NORMAL, &prd, &label, num_labels, 0, NULL);
> 1240            } else {
> 1241                    bgp_withdraw(peer, (struct prefix *)&p, addpath_id, afi, safi, ZEBRA_ROUTE_BGP,
> 1242                                 BGP_ROUTE_NORMAL, &prd, &label, num_labels);
> 1243            }

Fix this by declaring a label array instead of a single array.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2 months agobgpd: simplify bgp_evpn_process_rt1 with label
Philippe Guibert [Fri, 7 Feb 2025 14:40:29 +0000 (15:40 +0100)]
bgpd: simplify bgp_evpn_process_rt1 with label

Remove the num_labels variable, the received bgp_update() and
bgp_withdraw() function will read the message as including one
label or vni value.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2 months agobfdd: Use pass by reference for bfd_key_delete 18129/head
Donald Sharp [Wed, 5 Feb 2025 13:47:31 +0000 (08:47 -0500)]
bfdd: Use pass by reference for bfd_key_delete

Coverity is pointing out that bfd_key_delete is
passing by value instead of reference for a very
large structure.  Double plus not good.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 8119e167b0ae95927618696ba11d7252d9d5637c)

2 months agobfdd: Use pass by reference instead of pass by value for a struct
Donald Sharp [Wed, 5 Feb 2025 13:42:00 +0000 (08:42 -0500)]
bfdd: Use pass by reference instead of pass by value for a struct

The function bfd_key_lookup is currently sending by value for
a now very large structure.  Let's convert this over to pass
by reference.  This is noticed by coverity.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 6d80d0c595fd073c56f4fc5b3cd5568ef8a9d5ae)

2 months agoMerge pull request #18056 from FRRouting/mergify/bp/dev/10.3/pr-18048
Donald Sharp [Wed, 12 Feb 2025 17:39:27 +0000 (12:39 -0500)]
Merge pull request #18056 from FRRouting/mergify/bp/dev/10.3/pr-18048

pimd: fix DR election race on startup (backport #18048)

2 months agoMerge pull request #18083 from FRRouting/mergify/bp/dev/10.3/pr-17901
Donald Sharp [Wed, 12 Feb 2025 14:30:11 +0000 (09:30 -0500)]
Merge pull request #18083 from FRRouting/mergify/bp/dev/10.3/pr-17901

lib: actually hash all 16 bytes of IPv6 addresses, not just 4 (backport #17901)

2 months agoMerge pull request #18101 from FRRouting/mergify/bp/dev/10.3/pr-18060
Donald Sharp [Wed, 12 Feb 2025 13:18:58 +0000 (08:18 -0500)]
Merge pull request #18101 from FRRouting/mergify/bp/dev/10.3/pr-18060

lib: crash handlers must be allowed on threads (backport #18060)

2 months agoMerge pull request #18112 from FRRouting/mergify/bp/dev/10.3/pr-18078
Donald Sharp [Wed, 12 Feb 2025 13:17:12 +0000 (08:17 -0500)]
Merge pull request #18112 from FRRouting/mergify/bp/dev/10.3/pr-18078

nhrpd: fix dont consider incomplete L2 entry (backport #18078)

2 months agoMerge pull request #18115 from FRRouting/mergify/bp/dev/10.3/pr-18069
Donald Sharp [Wed, 12 Feb 2025 13:15:05 +0000 (08:15 -0500)]
Merge pull request #18115 from FRRouting/mergify/bp/dev/10.3/pr-18069

bgpd: Request SRv6 locator after zebra connection (backport #18069)

2 months agobgpd: Request SRv6 locator after zebra connection 18115/head
Carmine Scarpitta [Sat, 8 Feb 2025 23:44:01 +0000 (00:44 +0100)]
bgpd: Request SRv6 locator after zebra connection

When SRv6 is enabled and an SRv6 locator is specified in the BGP
configuration, BGP may attempt to request SRv6 locator information from
zebra before the connection is fully established. If this occurs, the
request fails with the following error:

```
2025/02/06 16:37:32 BGP: [HR66R-TWQYD][EC 100663302] srv6_manager_get_locator: invalid zclient socket
````

As a result, BGP is unable to obtain the locator information,
preventing SRv6 VPN from working.

This commit fixes the issue by ensuring BGP requests SRv6 locator
information once the connection with zebra is successfully established.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
(cherry picked from commit 16640b615dfabfd8e18dd091b1d4a63dfa7bf9fe)

2 months agonhrpd: fix dont consider incomplete L2 entry 18112/head
Philippe Guibert [Mon, 10 Feb 2025 15:15:44 +0000 (16:15 +0100)]
nhrpd: fix dont consider incomplete L2 entry

Sometimes, NHRP receives L2 information on a cache entry with the
0.0.0.0 IP address. NHRP considers it as valid and updates the binding
with the new IP address.

> Feb 09 20:09:54 aws-sin-vpn01 nhrpd[2695]: [QQ0NK-1H449] Netlink: new-neigh 10.2.114.238 dev dmvpn1 lladdr 162.251.180.10 nud 0x2 cache used 0 type 4
> Feb 09 20:10:35 aws-sin-vpn01 nhrpd[2695]: [QQ0NK-1H449] Netlink: new-neigh 10.2.114.238 dev dmvpn1 lladdr 162.251.180.10 nud 0x4 cache used 1 type 4
> Feb 09 20:10:48 aws-sin-vpn01 nhrpd[2695]: [QQ0NK-1H449] Netlink: del-neigh 10.2.114.238 dev dmvpn1 lladdr 162.251.180.10 nud 0x4 cache used 1 type 4
> Feb 09 20:10:49 aws-sin-vpn01 nhrpd[2695]: [QQ0NK-1H449] Netlink: who-has 10.2.114.238 dev dmvpn1 lladdr (unspec) nud 0x1 cache used 1 type 4
> Feb 09 20:10:49 aws-sin-vpn01 nhrpd[2695]: [QVXNM-NVHEQ] Netlink: update binding for 10.2.114.238 dev dmvpn1 from c 162.251.180.10 peer.vc.nbma 162.251.180.10 to lladdr (unspec)
> Feb 09 20:10:49 aws-sin-vpn01 nhrpd[2695]: [QQ0NK-1H449] Netlink: new-neigh 10.2.114.238 dev dmvpn1 lladdr 0.0.0.0 nud 0x2 cache used 1 type 4
> Feb 09 20:11:30 aws-sin-vpn01 nhrpd[2695]: [QQ0NK-1H449] Netlink: new-neigh 10.2.114.238 dev dmvpn1 lladdr 0.0.0.0 nud 0x4 cache used 1 type 4

Actually, the 0.0.0.0 IP addressed mentiones in the 'who-has' message is
wrong because the nud state value means that value is incomplete and
should not be handled as a valid entry. Instead of considering it, fix
this by by invalidating the current binding. This step is necessary in
order to permit NHRP to trigger resolution requests again.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
(cherry picked from commit 3202323052485d8138a3440e9c9907594ad99c57)

2 months agoMerge pull request #18099 from FRRouting/mergify/bp/dev/10.3/pr-18081
Russ White [Tue, 11 Feb 2025 17:28:57 +0000 (12:28 -0500)]
Merge pull request #18099 from FRRouting/mergify/bp/dev/10.3/pr-18081

bgpd: fix bgp vrf instance creation from implicit (backport #18081)

2 months agolib: crash handlers must be allowed on threads 18101/head
David Lamparter [Fri, 7 Feb 2025 12:22:25 +0000 (13:22 +0100)]
lib: crash handlers must be allowed on threads

Blocking all signals on non-main threads is not the way to go, at least
the handlers for SIGSEGV, SIGBUS, SIGILL, SIGABRT and SIGFPE need to run
so we get backtraces.  Otherwise the process just exits.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit 13a6ac5b4ca8fc08b348f64de64a787982f24250)

2 months agobgpd: fix bgp vrf instance creation from implicit 18099/head
Chirag Shah [Tue, 11 Feb 2025 02:56:15 +0000 (18:56 -0800)]
bgpd: fix bgp vrf instance creation from implicit

In bgp route leak, when import vrf x is executed,
it creates bgp instance as hidden with asn value as unspecified.

When router bgp x is configured ensure the correct as,
asnotation is applied otherwise running config shows asn value as 0.

This can lead to frr-reload failure when any FRR config change.

Fix:
Move asn and asnotiation, as_pretty value in common done section,
so when bgp_create gets existing instance but before returning
update asn and required fields in common section.

In bgp_create(): when returning for hidden at least update asn
and required when bgp instance created implicitly due to vrf leak.

if (hidden) {
    bgp = bgp_old;
    goto peer_init; <<<
}

Before fix:
show running:

router bgp 0 vrf purple
 bgp router-id 10.10.3.11
 !
 address-family ipv4 unicast
  redistribute static
  import vrf blue
 exit-address-family
 !
 address-family ipv6 unicast
  import vrf blue
 exit-address-family
 !
 address-family l2vpn evpn
  advertise ipv4 unicast
  advertise ipv6 unicast
 exit-address-family
exit

Testing:

1) following snippet config:
router bgp 63420 vrf blue
 import vrf purple
router bgp 63420 vrf purple
 import vrf blue
2) restart frr leads to the running config with 0 asn value.

Signed-off-by: Chirag Shah <chirag@nvidia.com>
(cherry picked from commit 2ff08af78e315c69795417d150cd23649f68c655)

2 months agolib: clean up nexthop hashing mess 18083/head
David Lamparter [Wed, 22 Jan 2025 10:23:31 +0000 (11:23 +0100)]
lib: clean up nexthop hashing mess

We were hashing 4 bytes of the address.  Even for IPv6 addresses.

Oops.

The reason this was done was to try to make it faster, but made a
complex maze out of everything.  Time for a refactor.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit 001fcfa1dd9f7dc2639b4f5c7a52ab59cc425452)

2 months agolib: guard against padding garbage in ZAPI read
David Lamparter [Wed, 22 Jan 2025 10:19:04 +0000 (11:19 +0100)]
lib: guard against padding garbage in ZAPI read

When reading in a nexthop from ZAPI, only set the fields that actually
have meaning.  While it shouldn't happen to begin with, we can otherwise
carry padding garbage into the unused leftover union bytes.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit 4a0e1419a69d07496c7adfb744beecd00e1efef2)

2 months agozebra: guard against junk in nexthop->rmap_src
David Lamparter [Wed, 22 Jan 2025 10:17:21 +0000 (11:17 +0100)]
zebra: guard against junk in nexthop->rmap_src

rmap_src wasn't initialized, so for IPv4 the unused 12 bytes would
contain whatever junk is on the stack on function entry.  Also move
the IPv4 parse before the IPv6 parse so if it's successful we can be
sure the other bytes haven't been touched.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit b666ee510eb480da50476b1bbc84bdf8365df95c)

2 months agopbrd: initialize structs used in hash_lookup
David Lamparter [Wed, 22 Jan 2025 10:16:10 +0000 (11:16 +0100)]
pbrd: initialize structs used in hash_lookup

Doesn't seem to break anything but really poor style to pass potentially
uninitialized data to hash_lookup.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit c88589f5e9351654c04322eb395003297656989d)

2 months agofpm: guard against garbage in unused address bytes
David Lamparter [Wed, 22 Jan 2025 10:15:17 +0000 (11:15 +0100)]
fpm: guard against garbage in unused address bytes

Zero out the 12 unused bytes (for the IPv6 address) when reading in an
IPv4 address.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit 95cf0b227980999e2af22a2c171e5237e5ffca8e)

2 months agobgpd: don't reuse nexthop variable in loop/switch
David Lamparter [Wed, 22 Jan 2025 10:13:21 +0000 (11:13 +0100)]
bgpd: don't reuse nexthop variable in loop/switch

While the loop is currently exited in all cases after using nexthop, it
is a footgun to have "nh" around to be reused in another iteration of
the loop.  This would leave nexthop with partial data from the previous
use.  Make it local where needed instead.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit ce7f5b21221f0b3557d1f4a40793230d8bc4cf02)

2 months agoMerge pull request #18053 from FRRouting/mergify/bp/dev/10.3/pr-14105 mergify/bp/dev/10.3/pr-17935
Donatas Abraitis [Fri, 7 Feb 2025 14:10:46 +0000 (16:10 +0200)]
Merge pull request #18053 from FRRouting/mergify/bp/dev/10.3/pr-14105

pimd: Fix for FHR mroute taking longer to age out (backport #14105)

2 months agopimd: fix DR election race on startup 18056/head
Rafael Zalamena [Thu, 6 Feb 2025 22:28:50 +0000 (19:28 -0300)]
pimd: fix DR election race on startup

In case interface address is learnt during configuration, make sure to
run DR election when configuring PIM/PIM passive on interface.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
(cherry picked from commit 86445246062583197d4a6dff7b8c74003cd8049d)

2 months agopimd: Fix for FHR mroute taking longer to age out 18053/head
Rajesh Varatharaj [Thu, 27 Jul 2023 06:57:04 +0000 (23:57 -0700)]
pimd: Fix for FHR mroute taking longer to age out

Issue:
When there is no traffic for a group, the LHR and RP take the default KAT+Join timer expiry of
a maximum of 480 seconds to clear the S,G . However, in the FHR, we update the state from JOINED
to NOT Joined, downstream state from PPto NOINFO.  This restarts the ET timer, causing S,G on FHR to
take more than 10 minutes to age out.

In other words,
Consider a case where (S,G) is in Join state. When the traffic stops and the KAT (210) expires,
 the Join expiry timer restarts. At this time, if we receive a prune, the expectation is to set
 PPT to 0 (RFC 4601 sec 4.5.2).
 When the PPT expires, we move to the noinfo state and restart the expiry timer one more time. We remove the
 (S,G) entry only after ~10 minutes when there is no active traffic.

Summary:
KAT Join ET 210 + PP ET 210 + NOINFO ET 210.

Solution:
Delete the ifchannel when in noinfo state, and KAT is not running.

Ticket: #13703

Signed-off-by: Rajesh Varatharaj <rvaratharaj@nvidia.com>
(cherry picked from commit afed39ea2be25bf30d50ac49b4edf424deadcb17)

2 months agoMerge pull request #18042 from FRRouting/mergify/bp/dev/10.3/pr-17865
Jafar Al-Gharaibeh [Thu, 6 Feb 2025 23:20:22 +0000 (17:20 -0600)]
Merge pull request #18042 from FRRouting/mergify/bp/dev/10.3/pr-17865

Coverity 2024 new hotness (backport #17865)

2 months agoMerge pull request #18043 from FRRouting/mergify/bp/dev/10.3/pr-18038
Jafar Al-Gharaibeh [Thu, 6 Feb 2025 23:20:03 +0000 (17:20 -0600)]
Merge pull request #18043 from FRRouting/mergify/bp/dev/10.3/pr-18038

pimd: fix memory leak and assign allocation type (backport #18038)

2 months agopimd: fix memory leak and assign allocation type 18043/head
Rafael Zalamena [Thu, 6 Feb 2025 13:14:55 +0000 (10:14 -0300)]
pimd: fix memory leak and assign allocation type

Use a memory allocation specific type for filter names (to help detect memory
leaks) and fix a memory leak when releasing peer memory.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
(cherry picked from commit d1440dadffe90dc743c5b83126b021d7a4a08766)

2 months agozebra: Ensure that changes to dg_update_list are protected by mutex 18042/head
Donald Sharp [Thu, 16 Jan 2025 16:17:11 +0000 (11:17 -0500)]
zebra: Ensure that changes to dg_update_list are protected by mutex

The dg_update_list access is controlled by the dg_mutex in all
other locations.  Let's just add a mutex usage around the initialization
of the dg_update_list even if it's part of the startup, just to keep
things consistent.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 19af3f3d7af0f8904794dae3c36f60ed1d5a3cc8)

2 months agobgpd: Ensure ibuf count is protected by mutex
Donald Sharp [Wed, 15 Jan 2025 18:26:58 +0000 (13:26 -0500)]
bgpd: Ensure ibuf count is protected by mutex

Grab the count of streams in ibuf when it is protected
by a mutex.  Since this data is written to it in another
pthread.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit f94ad538cf93d2b18fa4181e8508f08f94f0a2cc)

2 months agozebra: Add some documentation on when zserv_open should be used
Donald Sharp [Wed, 15 Jan 2025 18:03:52 +0000 (13:03 -0500)]
zebra: Add some documentation on when zserv_open should be used

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 4b967527376db4f08c50f9c32cc77556700d0eec)

2 months agoospfd: Fix Coverity SA #1617470, 76 and 78
Donald Sharp [Wed, 15 Jan 2025 16:16:10 +0000 (11:16 -0500)]
ospfd: Fix Coverity SA #1617470, 76 and 78

msg_new takes a uint16_t, the length passed
down variable is a unsigned int, thus 32 bit.
It's possible, but highly unlikely, that the
msglen could be greater than 16 bit.
Let's just add some checks to ensure that
this could not happen.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 283cc511781f9e076baf8564dae234de52cb290a)

2 months agoMerge pull request #18019 from FRRouting/mergify/bp/dev/10.3/pr-18000
Donald Sharp [Wed, 5 Feb 2025 13:17:07 +0000 (08:17 -0500)]
Merge pull request #18019 from FRRouting/mergify/bp/dev/10.3/pr-18000

bgpd: Fix up memory leak in processing eoiu marker (backport #18000)

2 months agobgpd: Fix up memory leak in processing eoiu marker 18019/head
Donald Sharp [Tue, 4 Feb 2025 15:56:59 +0000 (10:56 -0500)]
bgpd: Fix up memory leak in processing eoiu marker

Memory is being leaked when processing the eoiu marker.
BGP is creating a dummy dest to contain the data but
it was never freed.  As well as the eoiu info was
not being freed either.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit c6b7a993fb2961e04d069f1779498342aa7932fd)

2 months agoMerge pull request #18006 from FRRouting/mergify/bp/dev/10.3/pr-17959
Russ White [Tue, 4 Feb 2025 16:46:15 +0000 (11:46 -0500)]
Merge pull request #18006 from FRRouting/mergify/bp/dev/10.3/pr-17959

bgpd: Do not start BGP session if BGP identifier is not set (backport #17959)

2 months agotests: Check if the peer stays Idle if router-id is not set 18006/head
Donatas Abraitis [Wed, 29 Jan 2025 21:11:35 +0000 (23:11 +0200)]
tests: Check if the peer stays Idle if router-id is not set

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 48560b5c9b8084e903ebf0ef5987b4e581459608)

2 months agobgpd: Do not start BGP session if BGP identifier is not set
Donatas Abraitis [Wed, 29 Jan 2025 21:03:06 +0000 (23:03 +0200)]
bgpd: Do not start BGP session if BGP identifier is not set

If we have IPv6-only network and no IPv4 addresses at all, then by default
0.0.0.0 is created which is treated as malformed according to RFC 6286.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 739f2b566a8217acce84d4c21aaf033314f535bb)

2 months agodoc: Say that 0.0.0.0 (0) BGP identifier is invalid
Donatas Abraitis [Wed, 29 Jan 2025 20:24:39 +0000 (22:24 +0200)]
doc: Say that 0.0.0.0 (0) BGP identifier is invalid

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit c9a29289548028163a8d1edd55dbf03f27d53484)

2 months agoMerge pull request #17969 from donaldsharp/fpm_lost_sends base_10.3
Mark Stapp [Tue, 4 Feb 2025 16:18:07 +0000 (11:18 -0500)]
Merge pull request #17969 from donaldsharp/fpm_lost_sends

zebra: Ensure dplane does not send work back to master at wrong time

2 months agoMerge pull request #17992 from chiragshah6/fdev5
Russ White [Tue, 4 Feb 2025 12:40:36 +0000 (07:40 -0500)]
Merge pull request #17992 from chiragshah6/fdev5

bgpd: fix route-distinguisher in vrf leak json cmd

2 months agoMerge pull request #17991 from chiragshah6/bgp_dev4
Donatas Abraitis [Tue, 4 Feb 2025 12:34:21 +0000 (14:34 +0200)]
Merge pull request #17991 from chiragshah6/bgp_dev4

zebra: fix evpn svd hash avoid double free

2 months agoMerge pull request #17943 from opensourcerouting/clear-event-cpu-uaf
Russ White [Tue, 4 Feb 2025 11:57:52 +0000 (06:57 -0500)]
Merge pull request #17943 from opensourcerouting/clear-event-cpu-uaf

lib: fix use after free in `clear event cpu`

2 months agoMerge pull request #17336 from forrestchu/sbfd
Russ White [Tue, 4 Feb 2025 11:36:43 +0000 (06:36 -0500)]
Merge pull request #17336 from forrestchu/sbfd

implement SBFD