Commit graph

38671 commits

Author SHA1 Message Date
Christopher Dziomba 8fc41e81f0
staticd: Add v4-via-v6 nexthop support
Routing v4 over an v6 nexthop is already well supported within zebra
(and FRR). This adds support to staticd, allowing an IPv6 nexthop to
be provided to ip route statements. For this the commands are
extended and the address family is parsed from the parameter.

When receiving nht updates from zebra, both AFIs are checked because
prefixes could exist in both. Additionally when route_node is known,
family of prefix is used instead of nexthop.

Signed-off-by: Christopher Dziomba <christopher.dziomba@telekom.de>
2025-04-14 19:22:39 +02:00
Jafar Al-Gharaibeh ac56da1f50
Merge pull request #18649 from donaldsharp/rpki_testing_and_buf_fix
Rpki testing and bug fix
2025-04-12 22:26:19 -05:00
Donald Sharp dbff585b41 tests: Add more tests to bgp_rpki_topo1 test
Looking at the gcov of the rpki code, I noticed
that there was some functionality that is not
covered in our test suites.  Add the functionality.

Signed-off-by: Donald Sharp <donaldsharp72@gmail.com>
2025-04-12 17:00:02 -04:00
Donald Sharp dcf43ae009 bgpd: Prevent crash when issuing a show rpki connections
When attempting to check rpki status and the connection
has been turned off, let's check to see if we are connected
before we ask the rpki subsystem, else we will get a crash
in the rpki library.

Signed-off-by: Donald Sharp <donaldsharp72@gmail.com>
2025-04-12 16:59:56 -04:00
Donald Sharp bd8ee74b49
Merge pull request #18645 from louis-6wind/fix-zebra-pbr-leak
zebra: fix pbr_iptable memory leak
2025-04-11 19:54:03 -04:00
Donatas Abraitis 85bb2155db
Merge pull request #18574 from y-bharath14/srib-tests-v10
tests: Shadowing the built-in function
2025-04-11 18:54:01 +03:00
Carmine Scarpitta c5dfb9f5e5
Merge pull request #18628 from raja-rajasekar/rajasekarr/fix_frr_reload_srv6
tools: fix reload script for SRv6 locators and formats
2025-04-11 17:07:05 +02:00
Jafar Al-Gharaibeh 953d92b3b2
Merge pull request #18640 from donaldsharp/fpm_listener_nhg_data
zebra: modify fpm_listener to display data about nhgs
2025-04-11 10:06:55 -05:00
Carmine Scarpitta 5ad0ba3ee9
Merge pull request #18597 from pguibert6WIND/end_b6_encaps_extensions
lib, staticd, isisd: add B6.ENCAPS codepoint extensions
2025-04-11 17:00:13 +02:00
Louis Scalbert 55ea74d630 zebra: clean pbr_iptable interface_name_list free
Clean up code related to pbr_iptable->interface_name_list free. This is
a cosmetic change.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-04-11 15:52:42 +02:00
Louis Scalbert 92cddedffd zebra: fix pbr_iptable memory leak
We are obviously doing deleting on wrong object.

> Direct leak of 40 byte(s) in 1 object(s) allocated from:
>     #0 0x7fcf718b4a57 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
>     #1 0x7fcf7126f8dd in qcalloc lib/memory.c:105
>     #2 0x7fcf7124401a in list_new lib/linklist.c:49
>     #3 0x55771621d86d in pbr_iptable_alloc_intern zebra/zebra_pbr.c:1015
>     #4 0x7fcf71217d79 in hash_get lib/hash.c:147
>     #5 0x55771621dad3 in zebra_pbr_add_iptable zebra/zebra_pbr.c:1030
>     #6 0x55771614d00c in zread_iptable zebra/zapi_msg.c:4131
>     #7 0x55771614e586 in zserv_handle_commands zebra/zapi_msg.c:4424
>     #8 0x5577162dae2c in zserv_process_messages zebra/zserv.c:521
>     #9 0x7fcf7137798e in event_call lib/event.c:2011
>     #10 0x7fcf71242ff1 in frr_run lib/libfrr.c:1216
>     #11 0x5577160e4d6d in main zebra/main.c:540
>     #12 0x7fcf70c29d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
>
> Indirect leak of 24 byte(s) in 1 object(s) allocated from:
>     #0 0x7fcf718b4a57 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
>     #1 0x7fcf7126f8dd in qcalloc lib/memory.c:105
>     #2 0x7fcf71244129 in listnode_new lib/linklist.c:71
>     #3 0x7fcf71244238 in listnode_add lib/linklist.c:92
>     #4 0x55771621d938 in pbr_iptable_alloc_intern zebra/zebra_pbr.c:1019
>     #5 0x7fcf71217d79 in hash_get lib/hash.c:147
>     #6 0x55771621dad3 in zebra_pbr_add_iptable zebra/zebra_pbr.c:1030
>     #7 0x55771614d00c in zread_iptable zebra/zapi_msg.c:4131
>     #8 0x55771614e586 in zserv_handle_commands zebra/zapi_msg.c:4424
>     #9 0x5577162dae2c in zserv_process_messages zebra/zserv.c:521
>     #10 0x7fcf7137798e in event_call lib/event.c:2011
>     #11 0x7fcf71242ff1 in frr_run lib/libfrr.c:1216
>     #12 0x5577160e4d6d in main zebra/main.c:540
>     #13 0x7fcf70c29d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Fixes: f80ec7e3d6 ("zebra: handle iptable list of interfaces")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-04-11 15:52:30 +02:00
Louis Scalbert cd451ff4ef zebra: split up MTYPE_PBR_OBJ
Split up MTYPE_PBR_OBJ into dedicated MTYPE to clarify the memory
allocation and free.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-04-11 15:52:30 +02:00
Donald Sharp f163168c95
Merge pull request #18642 from louis-6wind/fix-asla-leak
isisd: fix asla memory leak
2025-04-11 09:07:27 -04:00
Donald Sharp 2c37a21743
Merge pull request #16735 from zmw12306/babel_nonzeroMBZ
babeld: Add MBZ and Reserved field checking
2025-04-11 08:42:45 -04:00
Donald Sharp f34ee05f8b
Merge pull request #18633 from y-bharath14/srib-tests-v11
tests: Fix potential issues in mcast-tester.py
2025-04-11 08:41:02 -04:00
Donald Sharp 01085bfbec
Merge pull request #18635 from opensourcerouting/support_bundle_ns
tools: Add pathspace option to generate_support_bundle
2025-04-11 08:40:34 -04:00
Louis Scalbert fe2a07aea4 isisd: fix asla memory leak
> ==713776==ERROR: LeakSanitizer: detected memory leaks
>
> Direct leak of 120 byte(s) in 1 object(s) allocated from:
>     #0 0x7fdfcbeb4a57 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
>     #1 0x7fdfcb86f8dd in qcalloc lib/memory.c:105
>     #2 0x55ce707739b6 in isis_tlvs_find_alloc_asla isisd/isis_tlvs.c:8500
>     #3 0x55ce7072fae0 in isis_link_params_update_asla isisd/isis_te.c:191
>     #4 0x55ce70733881 in isis_link_params_update isisd/isis_te.c:499
>     #5 0x55ce70693f2a in isis_circuit_up isisd/isis_circuit.c:776
>     #6 0x55ce7069a120 in isis_csm_state_change isisd/isis_csm.c:135
>     #7 0x55ce7068dd80 in isis_circuit_enable isisd/isis_circuit.c:79
>     #8 0x55ce70699346 in isis_ifp_create isisd/isis_circuit.c:1618
>     #9 0x7fdfcb81f47f in hook_call_if_real lib/if.c:55
>     #10 0x7fdfcb82056e in if_new_via_zapi lib/if.c:188
>     #11 0x7fdfcb9d17da in zclient_interface_add lib/zclient.c:2706
>     #12 0x7fdfcb9df842 in zclient_read lib/zclient.c:4843
>     #13 0x7fdfcb97798e in event_call lib/event.c:2011
>     #14 0x7fdfcb842ff1 in frr_run lib/libfrr.c:1216
>     #15 0x55ce7067cbf2 in main isisd/isis_main.c:360
>     #16 0x7fdfcb229d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
>
> Indirect leak of 8 byte(s) in 1 object(s) allocated from:
>     #0 0x7fdfcbeb4a57 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
>     #1 0x7fdfcb86f8dd in qcalloc lib/memory.c:105
>     #2 0x7fdfcb79a7b7 in admin_group_init lib/admin_group.c:186
>     #3 0x55ce707739ca in isis_tlvs_find_alloc_asla isisd/isis_tlvs.c:8501
>     #4 0x55ce7072fae0 in isis_link_params_update_asla isisd/isis_te.c:191
>     #5 0x55ce70733881 in isis_link_params_update isisd/isis_te.c:499
>     #6 0x55ce70693f2a in isis_circuit_up isisd/isis_circuit.c:776
>     #7 0x55ce7069a120 in isis_csm_state_change isisd/isis_csm.c:135
>     #8 0x55ce7068dd80 in isis_circuit_enable isisd/isis_circuit.c:79
>     #9 0x55ce70699346 in isis_ifp_create isisd/isis_circuit.c:1618
>     #10 0x7fdfcb81f47f in hook_call_if_real lib/if.c:55
>     #11 0x7fdfcb82056e in if_new_via_zapi lib/if.c:188
>     #12 0x7fdfcb9d17da in zclient_interface_add lib/zclient.c:2706
>     #13 0x7fdfcb9df842 in zclient_read lib/zclient.c:4843
>     #14 0x7fdfcb97798e in event_call lib/event.c:2011
>     #15 0x7fdfcb842ff1 in frr_run lib/libfrr.c:1216
>     #16 0x55ce7067cbf2 in main isisd/isis_main.c:360
>     #17 0x7fdfcb229d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

PR: 95719
Fixes: 5749ac83a8 ("isisd: add ASLA support")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-04-11 09:57:18 +02:00
Philippe Guibert 27fa9ac4db lib, staticd, isisd: add B6.Encaps codepoint extensions
Add codepoint extensions for END.B6.Encaps instruction.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-04-11 09:36:29 +02:00
Donald Sharp ef580f0e80 zebra: modify fpm_listener to display data about nhgs
Currently the fpm_listener completely ignores NHG's.
Let's start dumping some data about the nexthop groups:

[2025-04-10 16:55:12.939235306] FPM message - Type: 1, Length 52
[2025-04-10 16:55:12.939254252] Nexthop Group ID: 9, Protocol: Zebra(11), Contains 1 nexthops, Family: 2, Scope: 0
[2025-04-10 16:55:12.939260564] FPM message - Type: 1, Length 52
[2025-04-10 16:55:12.939263990] Nexthop Group ID: 10, Protocol: Zebra(11), Contains 1 nexthops, Family: 2, Scope: 0
[2025-04-10 16:55:12.939268659] FPM message - Type: 1, Length 56
[2025-04-10 16:55:12.939271635] Nexthop Group ID: 8, Protocol: Zebra(11), Contains 2 nexthops, Family: 0, Scope: 0

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-04-10 17:14:38 -04:00
Donatas Abraitis dc37bff8c0
Merge pull request #18376 from pguibert6WIND/show_bgp_neighbor_counter_tx
bgpd: fix add prefix sent in 'show bgp neighbor'
2025-04-10 19:38:59 +03:00
Donatas Abraitis cf351d6d05
Merge pull request #18611 from pguibert6WIND/bgp_usid
bgpd: add usid behavior for bgp srv6 instructions
2025-04-10 19:34:44 +03:00
Jafar Al-Gharaibeh fc3e1ec15f
Merge pull request #18472 from zmw12306/Update-TLV
babeld: Add input validation for update TLV.
2025-04-10 09:59:13 -05:00
Jafar Al-Gharaibeh 2355683c72
Merge pull request #18548 from zmw12306/request_subtlv_type
babeld: fix incorrect type assignment in parse_request_subtlv
2025-04-10 09:56:14 -05:00
Rajasekar Raja ce06d35fa9 tools: fix reload script for SRv6 locators and formats
Current code implementation does not have a "no" form of handling for
the following commands under segment-routing srv6
 - no formats
 - no locators
 - no prefix <> under locator XYZ

Fix the handling of segment-routing srv6 locators and formats commands
 - Ignore "no formats" and "no locators" command
 - replace "no prefix" under locator XYZ as "no locator XYZ" as prefix
   is a mandatory property of locator

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
2025-04-10 07:55:57 -07:00
Martin Winter 9acadf8d3f
tools: Add pathspace option to generate_support_bundle
Adding a `-N` pathspace option to the generate_support_bundle.py
to support FRR running in a non-default namespace with a prefix
on the config/socket options.
The same pathspace will be prepended to the output log files (if
specified)

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2025-04-10 16:47:27 +02:00
Donald Sharp 86f66afc52
Merge pull request #18586 from zmw12306/bfd_find_disc
bfdd: Fix demultiplexing to rely solely on Your Discriminator
2025-04-10 10:30:05 -04:00
Donatas Abraitis 2f0b8ff1ea
Merge pull request #18624 from louis-6wind/remove-afi2family
bgpd: remove useless calls to afi2family
2025-04-10 17:14:08 +03:00
Mark Stapp 0e8e0c5fb9
Merge pull request #18594 from soumyar-roy/soumya/netwithdraw
bgpd: Paths not deleted received from shutdown peer
2025-04-10 10:07:32 -04:00
Y Bharath 868796cf69 tests: Fix potential issues in mcast-tester.py
Fix potential issues in mcast-tester.py

Signed-off-by: y-bharath14 <y.bharath@samsung.com>
2025-04-10 17:01:06 +05:30
Philippe Guibert a47a53b003 bgpd: fix add prefix sent in 'show bgp neighbor'
The 'acceptedPrefixCounter' is available in 'show bgp neighbor json', but
there is no equivalent when using the non json output. Add it.

> # show bgp neighbor
> [..]
>  Community attribute sent to this neighbor(all)
>  0 accepted prefixes, 1 sent prefixes

Fixes: 856ca177c4 ("Added json formating support to show-...-neighbors-... bgp commands.")

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-04-10 10:12:36 +02:00
Donatas Abraitis f28394313f
Merge pull request #18625 from donaldsharp/bgp_table_init_reverse
bgpd: On shutdown free up table for static routes
2025-04-10 00:56:06 +03:00
Soumya Roy 93458dcf7a test: Test for bgp route delete
This fix add tests to verify routes/path are getting
deleted properly, when the advertising neighbor is shutdown

Signed-off-by: Soumya Roy <souroy@nvidia.com>
2025-04-09 20:46:43 +00:00
Mark Stapp 67278980eb
Merge pull request #18627 from donaldsharp/irdp_shadow
zebra: Fix shadow warning in irdp_packet.c
2025-04-09 14:17:36 -04:00
Donald Sharp 64a6a2e175 zebra: Fix shadow warning in irdp_packet.c
My compiler is complaining about irdp_sock
being a shadow variable.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-04-09 12:01:30 -04:00
Soumya Roy d2bec7a691 bgpd: Paths, received from shutdown peer, not deleted
Issue:
In a scaled setup, (where number of nets > BGP_CLEARING_BATCH_MAX_DESTS
for walk_batch_table_helper), when peer is shutdown, it is seen some
of the paths are not deleted, which are received from that peer.

Fix:
This is due to, in clear_batch_rib_helper, once walk_batch_table_helper
returns after BGP_CLEARING_BATCH_MAX_DESTS is reached, we just break
from inner loop for the afi/safi for loops. So during walk for next
afi/safi that 'ret' state is overwritten with new state. Also the
resume context is overwritten. This causes to lose the start point
for next walk, some nets are skipped forever. So they are not marked
for deletion anymore. To fix this, we immediately return from current
run. This will have resume state to be stored correctly, and next walk
will start from there.

Testing:
32 ecmp paths were received from the shutdown peer
Before fix:
show bgp ipv6 2052:52:1:167::/64
BGP routing table entry for 2052:52:1:167::/64, version 495
Paths: (246 available, best #127, table default)
  Not advertised to any peer

<snip>
  4200165500 4200165002
    2021:21:51:101::2(spine-5) from spine-5(2021:21:51:101::2) (6.0.0.17)
    (fe80::202:ff:fe00:55) (prefer-global)
      Origin incomplete, valid, external, multipath
      Last update: Fri Apr  4 17:25:05 2025
  4200165500 4200165002
    2021:21:11:116::2(spine-1) from spine-1(2021:21:11:116::2) (0.0.0.0)
    (fe80::202:ff:fe00:3d) (prefer-global)<<<<path not deleted
      Origin incomplete, valid, external
      Last update: Fri Apr  4 17:25:05 2025
  4200165500 4200165002
    2021:21:11:115::2(spine-1) from spine-1(2021:21:11:115::2) (0.0.0.0)
    (fe80::202:ff:fe00:3d) (prefer-global)<<<<path not deleted
      Origin incomplete, valid, external
      Last update: Fri Apr  4 17:25:05 2025
<snip>

 32 paths are supposed to be withdrawn:
root@leaf-1:mgmt:# vtysh -c "show bgp ipv6 2052:52:1:167::/64" | grep "prefer-global" | wc -l
256
root@leaf-1:mgmt# vtysh -c "show bgp ipv6 2052:52:1:167::/64" | grep "prefer-global" | wc -l
246<<should be 224, but showing 246, which is wrong
After fix:
 32 paths are supposed to be withdrawn:
root@leaf-1:mgmt:# vtysh -c "show bgp ipv6 2052:52:1:167::/64" | grep "prefer-global" | wc -l
256
root@leaf-1:mgmt:# vtysh -c "show bgp ipv6 2052:52:1:167::/64" | grep "prefer-global" | wc -l
224<<<shows correctly

Signed-off-by: Soumya Roy <souroy@nvidia.com>
2025-04-09 14:32:23 +00:00
Mark Stapp 2aa6e786a2
Merge pull request #18601 from LabNConsulting/chopps/mgmtd-candidate-overwrite
mgmtd: remove bogus "hedge" code which corrupted active candidate DS
2025-04-09 09:51:47 -04:00
Donald Sharp b2d8d9b37a bgpd: On shutdown free up table for static routes
Indirect leak of 56 byte(s) in 1 object(s) allocated from:
    0 0x7fdaf6cb83b7 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:77
    1 0x7fdaf683a480 in qcalloc lib/memory.c:106
    2 0x7fdaf68dd706 in route_table_init_with_delegate lib/table.c:38
    3 0x5649b22c05b0 in bgp_table_init bgpd/bgp_table.c:139
    4 0x5649b2273da0 in bgp_static_set bgpd/bgp_route.c:7779
    5 0x5649b21eba58 in vpnv4_network bgpd/bgp_mplsvpn.c:3244
    6 0x7fdaf67b6d61 in cmd_execute_command_real lib/command.c:1003
    7 0x7fdaf67b7080 in cmd_execute_command lib/command.c:1062
    8 0x7fdaf67b75ac in cmd_execute lib/command.c:1228
    9 0x7fdaf68ffb20 in vty_command lib/vty.c:626
    10 0x7fdaf6900073 in vty_execute lib/vty.c:1389
    11 0x7fdaf6903e24 in vtysh_read lib/vty.c:2408
    12 0x7fdaf68f0222 in event_call lib/event.c:2019
    13 0x7fdaf681b3c6 in frr_run lib/libfrr.c:1247
    14 0x5649b211c903 in main bgpd/bgp_main.c:565
    15 0x7fdaf630c249 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Table was being created but never deleted.  Let's delete it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-04-09 09:28:31 -04:00
Louis Scalbert a0a0749568 bgpd: remove useless calls to afi2family
Remove useless calls to afi2family(). str2prefix() always sets the
prefix family.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-04-09 13:07:56 +02:00
Christian Hopps 1f9c880297
Merge pull request #18604 from y-bharath14/srib-yang-v9
yang: Pyang errors in frr-bfdd.yang
2025-04-09 06:24:22 -04:00
Christian Hopps 59d2368b0f mgmtd: normalize argument order to copy(dst, src)
Having just completed a code audit during RCA, the fact that we have 2
different argument orders for the related datastore copying functions
was unnecessary and super confusing.

Fix this code-maintenance/comprehension mistake and move the newer mgmtd
copy routines to use the same arg order as the pre-existing underlying
northbound copy functions (i.e., use `copy(dst, src)`)

Signed-off-by: Christian Hopps <chopps@labn.net>
2025-04-09 10:14:58 +00:00
David Lamparter 8418e57791
Merge pull request #17915 from mjstapp/compile_wshadow 2025-04-09 09:59:06 +02:00
Jafar Al-Gharaibeh 1d426d9961
Merge pull request #18614 from donaldsharp/bgp_memory_fixes_vrf_different_asn
bgpd: On shutdown free up memory leak found by topotest
2025-04-08 14:31:15 -05:00
Mark Stapp 27ba9956a1 lib,ripd: resolve clang SA warnings
Looks like there were a couple of SA warnings lurking; fix
them.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-04-08 14:41:27 -04:00
Mark Stapp e2515f7a4f tests: clean up variable-shadow warnings
Clean up -Wshadow warnings in unit-tests

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-04-08 14:41:27 -04:00
Mark Stapp edb330686d tools,pceplib,ospfclient: clean up variable-shadow warnings
Clean up -Wshadow warnings in these components

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-04-08 14:41:27 -04:00
Mark Stapp 2998eeb0a5 pbrd,staticd,vrrpd: clean up variable-shadow warnings
Clean up -Wshadow warnings in three daemons

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-04-08 14:41:27 -04:00
Mark Stapp 14b74d50ec sharpd: clean up variable-shadowing compiler warnings
Clean up -Wshadow in sharpd

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-04-08 14:41:27 -04:00
Mark Stapp 660cbf5651 bgpd: clean up variable-shadowing compiler warnings
Clean up -Wshadow warnings in bgp.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-04-08 14:41:27 -04:00
Mark Stapp aece400f10 pimd: clean up variable-shadow warnings
Clean up -Wshadow warnings in pimd

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-04-08 14:41:27 -04:00
Mark Stapp 7c98a27f3e zebra: clean up -Wshadow compiler warnings
Clean up variable-shadowing compiler warnings.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-04-08 14:41:27 -04:00