Commit Graph

38150 Commits

Author SHA1 Message Date
Acee Lindem
06af50eace ospf6d: Fix use after free of router in OSPFv3 ABR route calculation.
This PR fixes FRR issue https://github.com/FRRouting/frr/issues/18040. The
OSPFv3 route is locked during the ABR calculation since there are
scenarios under which it is freed. The OSPFv3 ABR computation is
sub-optimal and this PR doesn't attempt to rework it.

Signed-off-by: Acee Lindem <acee@lindem.com>
2025-02-24 21:54:10 +00:00
Donatas Abraitis
b6ae929c1d
Merge pull request #16796 from gtataranni/feat/logfmt
tools: add logfmt option for frr-reload.py
2025-02-17 23:02:27 +02:00
Giovanni Tataranni
44a6e0dfed tools: add logfmt option for frr-reload.py
Add the option of printing logs in logfmt format.

Additional machine readable information can be printed via the `extra`
argument.
Example:
```python
log.debug("exit context"), extra={"line": line, "ctx_keys": ctx_keys})

log.error(f"Failed to execute command {' '.join(cmd)}", extra={"cmd": cmd})
```

Signed-off-by: Giovanni Tataranni <g.tataranni@gmail.com>
2025-02-17 17:33:28 +01:00
Christian Hopps
e241882d8f
Merge pull request #18139 from y-bharath14/srib-yang-v2
yang: Default value for a key leaf to be ignored
2025-02-17 05:13:57 -05:00
Donald Sharp
197d12ffba
Merge pull request #18187 from cscarpitta/fix/fix_srv6_encap_src_addr_test_failures
tests: Fix intermittent failures in `srv6_encap_src_addr` topotest
2025-02-16 08:09:18 -05:00
Carmine Scarpitta
c621b5e759 tests: Fix intermittent failures in srv6_encap_src_addr topotest
The `srv6_encap_src_addr` runs a vtysh command to configure the SRv6
encapsulation source address and then immediately invokes an iproute2
command to verify that zebra has set this address in the kernel. There
is no wait between the two operations and the verification is attempted
only once. If the topotest does not find the expected address it fails
immediately.

The problem is that when topotest is run on a heavyily loaded system,
it can take some time for zebra to set the address in the kernel.
In this case, when the topotest checks the kernel address right after
running the vtysh command, it doesn't find the expected address because
zebra hasn't set it yet.

This commit gives zebra some time to configure the address. It keeps to
check that the address is the expected one for about 1 minute. If after
1 minute the address is not the expected one then the test fails.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2025-02-16 11:14:54 +01:00
Carmine Scarpitta
206a647ea6 tests: Increase retry timeout in srv6_encap_src_addr topotest
The `srv6_encap_src_addr` topotest uses a waiting time that is too
small. For this reason during startup it prints a warning:

```
2025-02-16 09:23:47,704 WARNING: topo: Waiting time is too small (count=10, wait=1), using default values (count=20, wait=3)
```

This commit increases the waiting time to fix the warning.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2025-02-16 11:01:01 +01:00
Carmine Scarpitta
d8483f410e tests: Do not load bgpd config in srv6_encap_src_addr topotest
The `srv6_encap_src_addr` topotest tries to load bgpd.conf file that
does not exist, which produces the following warning:

```
2025-02-16 09:23:35,151 WARNING: topo: missing config 'r1' for '/media/frr/tests/topotests/srv6_encap_src_addr/r1/bgpd.conf' creating empty file '/etc/frr/bgpd.conf'
```

Since this topotest doesn't actually use bgpd, there's no point in
loading the config file.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2025-02-16 11:01:01 +01:00
Carmine Scarpitta
cb38a6f962 tests: Do not load sharpd config in srv6_encap_src_addr topotest
The `srv6_encap_src_addr` topotest tries to load sharpd.conf file that
does not exist, which produces the following warning:

```
2025-02-16 09:23:35,151 WARNING: topo: missing config 'r1' for '/media/frr/tests/topotests/srv6_encap_src_addr/r1/sharpd.conf' creating empty file '/etc/frr/sharpd.conf'
```

Since this topotest doesn't actually use sharpd, there's no point in
loading the config file.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2025-02-16 11:00:36 +01:00
Carmine Scarpitta
f2bf1f95b3 tests: Remove bgpd marker in srv6_encap_src_addr topotest
The `srv6_encap_src_addr` does not use bgp. As such, it should not have
bgpd marker.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2025-02-16 09:51:22 +01:00
Donatas Abraitis
88f4bb2761
Merge pull request #18109 from mjstapp/fix_evpn_vty_rt
bgpd: fix vty output of evpn route-target AS4
2025-02-15 22:11:00 +02:00
Donald Sharp
b2c960a19d
Merge pull request #18178 from cscarpitta/fix/isis_request_srv6_locator
isisd: Request SRv6 locator after zebra connection
2025-02-15 09:39:04 -05:00
Donald Sharp
ca46b52436
Merge pull request #18163 from opensourcerouting/sharpd-crash-command
sharpd: add `crashme` commands
2025-02-15 09:17:10 -05:00
Carmine Scarpitta
f02dba19d2 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>
2025-02-15 10:39:40 +01:00
Carmine Scarpitta
0b76fb3c13 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>
2025-02-15 10:39:30 +01:00
David Lamparter
050989d2fb
Merge pull request #18160 from donaldsharp/orf_plist_argie_bargie
bgpd: When removing the prefix list drop the pointer
2025-02-14 22:28:09 +01:00
Donatas Abraitis
d8ea27a188
Merge pull request #18122 from louis-6wind/bgp_cleanup_table-factorize
bgpd: factorize bgp_table_cleanup()
2025-02-14 23:08:51 +02:00
David Lamparter
cda7c4ed31 sharpd: add crashme commands
This adds 2 commands, one that should just straight up SEGV, another
that should trip an ASAN warning for an use-after-free.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2025-02-14 17:31:18 +01:00
Donald Sharp
3d43d7b789 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>
2025-02-14 07:58:01 -05:00
David Lamparter
196b7f1c31
Merge pull request #18127 from donaldsharp/w_option_for_watchfrr 2025-02-13 21:31:39 +01:00
Donatas Abraitis
cadfc56c89
Merge pull request #18121 from louis-6wind/fix-lable-release
bgpd: release manual vpn label on instance deletion
2025-02-13 21:08:23 +02:00
Donald Sharp
b9ac2c7b2f
Merge pull request #18080 from opensourcerouting/fix/enable_ll_capability_if_using_unnumerred
bgpd: Some fixes/improvements for Link-Local Next Hop capability
2025-02-13 14:06:24 -05:00
Donatas Abraitis
5d8bef6442
Merge pull request #18142 from donaldsharp/vrf_tableid_debugs
Vrf tableid debugs
2025-02-13 20:52:16 +02:00
Donald Sharp
8a661e5152
Merge pull request #18064 from cscarpitta/fix/fix_srv6_sid_parameters
staticd: Fix SRv6 SID installation and deletion
2025-02-13 13:37:22 -05:00
Carmine Scarpitta
caeef98e73
Merge pull request #18023 from pguibert6WIND/srv6_route_dump
lib: fix false context information for SRv6 route
2025-02-13 18:57:44 +01:00
Philippe Guibert
52a3239b26
Merge pull request #18079 from donaldsharp/labelpool_crash
bgpd: Fix crash in bgp_labelpool
2025-02-13 18:44:19 +01:00
Donald Sharp
9101bff6d2 tools: watchfrr should ignore frr_global_options
watchfrr is currently being started with $frr_global_options
This is problematic as that it has a entirely different cli
than the rest of the daemons and we have no plans to make
this equivalent.

Fixes: #18107

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-02-13 11:41:27 -05:00
Russ White
fbff0436d3
Merge pull request #18046 from LabNConsulting/aceelindem/ospf-lsa-add-delete-hook
ospfd: Replace LSDB callbacks with LSA Update/Delete hooks.
2025-02-13 11:16:42 -05:00
Donald Sharp
40744f4f3d zebra: Use tableid when displaying prefix
Found some more instances of tableid not being
displayed when trying to debug something.  Fix.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-02-13 10:40:52 -05:00
Donald Sharp
b4786a61e2 pbr: Add tableid to some debugs
Add prefix and tableid to one debug instead of several.
Consolidate a bit.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-02-13 10:40:17 -05:00
Jafar Al-Gharaibeh
f70530c8e8
Merge pull request #18032 from opensourcerouting/gmp-limit
pimd,pim6d: implement GMP group / source limits
2025-02-13 09:32:07 -06:00
Louis Scalbert
85784be2ec bgpd: remove unused afi arg from bgp_cleanup_table
Remove unused AFI argument from bgp_cleanup_table()

Fixes: ec6e09c271 ("bgpd: fix flushing ipv6 flowspec entries when peering stops")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-02-13 16:04:33 +01:00
Louis Scalbert
b5014d371c bgpd: factorize bgp_table_cleanup()
Factorize bgp_table_cleanup(). Cosmetic change. It will help adding
AFI / SAFI in the future.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-02-13 15:59:06 +01:00
Y Bharath
4f7b45f28b yang: Default value for a key leaf to be ignored
In YANG, key leaves are used to uniquely identify list entries, and they
cannot have default values

Signed-off-by: y-bharath14 <y.bharath@samsung.com>
2025-02-13 17:10:46 +05:30
Donatas Abraitis
007243d94d
Merge pull request #18120 from louis-6wind/fix-bgp-rd-json-show
bgpd: fix incorrect JSON in bgp_show_table_rd
2025-02-12 22:09:39 +02:00
Christian Hopps
4d4e85a541
Merge pull request #18118 from y-bharath14/srib-yang-v1
yang: Reorder the revision statements
2025-02-12 14:46:59 -05:00
Mark Stapp
6d14b169e6
Merge pull request #18125 from donaldsharp/bfd_fd_zero
bfdd: 0 is a valid fd.
2025-02-12 14:21:42 -05:00
Donald Sharp
9219fa39f2
Merge pull request #17649 from ariel-anieli/calloc-warns
tests: clear `-Wcalloc-transposed-args` warnings
2025-02-12 13:00:36 -05:00
Jafar Al-Gharaibeh
acd10af3fb
Merge pull request #18026 from donaldsharp/bfd_fixups
Bfd fixups
2025-02-12 12:00:23 -06:00
Donald Sharp
7535465284 bfdd: 0 is a valid fd.
It's unlikely that this would ever get a 0 fd to use
but let's just let the code assume it is ok.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-02-12 10:33:22 -05:00
Donald Sharp
cea55c9223
Merge pull request #18062 from pguibert6WIND/cid_1636504
Cid 1636504
2025-02-12 09:36:21 -05:00
Donald Sharp
418d0064bc
Merge pull request #18068 from opensourcerouting/fix/coverity_link_local_capability
bgpd: Do not check for capability length for Link-Local Next Hop capability
2025-02-12 09:35:16 -05:00
Donald Sharp
9623612fc0
Merge pull request #18094 from opensourcerouting/event-tardy-bfd
lib (+bfd): improve late timer warnings
2025-02-12 09:29:54 -05:00
Mark Stapp
75bc4a47b7
Merge pull request #18049 from donaldsharp/fpm_keep_on_trying
zebra: Allow fpm_listener to continue to try to read
2025-02-12 08:47:02 -05:00
Acee Lindem
b44258413f ospfd: Replace LSDB callbacks with LSA Update/Delete hooks.
Replace the LSDB callbacks with LSA update and delete hooks using the
the FRR hook mechanism. Remove redundant callbacks by placing the LSA
update and delete hooks in a single place so that deletes don't need
to be handled by the update hook. Simplify existing OSPF TE and OSPF
API Server callbacks now that there is no ambiguity or redundancy.
Also cleanup the debugging by separating out opaque-lsa debugging
from the overloaded event debugging.

Signed-off-by: Acee Lindem <acee@lindem.com>
2025-02-12 08:21:34 -05:00
Louis Scalbert
d6363625c3 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>
2025-02-12 14:03:02 +01:00
Louis Scalbert
cf0269649c 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>
2025-02-12 13:34:21 +01:00
Y Bharath
3b9191fcc9 yang: Reorder the revision statements
According to the YANG specification, the revision statements should be
ordered with the most recent revision first

Signed-off-by: y-bharath14 <y.bharath@samsung.com>
2025-02-12 12:13:06 +05:30
Jafar Al-Gharaibeh
d275f551c3
Merge pull request #18069 from cscarpitta/fix/bgp_request_srv6_locator
bgpd: Request SRv6 locator after zebra connection
2025-02-11 20:59:22 -06:00
Jafar Al-Gharaibeh
c821a7a207
Merge pull request #18078 from pguibert6WIND/nhrp_incomplete_msg
nhrpd: fix dont consider incomplete L2 entry
2025-02-11 20:57:09 -06:00