Commit graph

38587 commits

Author SHA1 Message Date
Mark Stapp e49a2f9a53 eigrpd: clean up variable-shadow warnings
Clean up various warnings from -Wshadow in eigrp.

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

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

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-04-08 14:41:27 -04:00
Mark Stapp 5be982966c ospf6: clean up -Wshadow warnings
Clean up various "shadow" warnings.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-04-08 14:41:27 -04:00
Mark Stapp 0561943a78 ospfd: clean up -Wshadow warnings
Clean up various "shadow" warnings.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-04-08 14:41:27 -04:00
Mark Stapp e88f0a4778 isisd: clean up -Wshadow warnings
Clean up various "shadow" warnings.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-04-08 14:41:26 -04:00
Mark Stapp 028872bf40 lib: fix -Wshadow warnings in the lib modules
Fix various "shadow" warnings in lib.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-04-08 14:41:26 -04:00
David Lamparter d683c4d8de lib: don't shadow _once in frr_with_mutex
The `_once` loop variable will result in a `-Wshadow` warning when that
is turned on.  Use `__COUNTER__` to give these variables distinct names,
like is already done with `_mtx_`.

(and because I touched it, clang-format wants it reformatted... ohwell.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2025-04-08 14:41:26 -04:00
Mark Stapp 05446a2961 configure: add -Wshadow option
Start exposing variable-shadowing warnings in all builds.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-04-08 14:41:26 -04:00
Carmine Scarpitta 46a526568f
Merge pull request #18580 from raja-rajasekar/rajasekarr/check_sid_loc_block_beforehand
staticd: Avoid requesting SRv6 sid from zebra when loc and sid block dont match
2025-04-08 14:53:26 +02:00
Rajasekar Raja dbd9fed0b3 staticd: Avoid requesting SRv6 sid from zebra when loc and sid block dont match
Currently, when the locator block and sid block differs, staticd would
still go ahead and request zebra to allocate the SID which it does if
there is atleast one match (from any locators).

Only when staticd tries to install the route, it sees that the locator
block and sid block are different and avoids installing the route.

Fix:
Check if the locator block and sid block match before even requesting
Zebra to allocate one.

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
2025-04-07 10:34:07 -07:00
Donatas Abraitis 5e092d0e25
Merge pull request #18558 from spoignant-proton/master
bgpd: flowspec: remove sizelimit check applied to the wrong length field (issue 18557)
2025-04-07 03:27:02 +03:00
Mark Stapp 259ffe1dfe
Merge pull request #18562 from opensourcerouting/fix/bfd_down_if_established
bgpd: Treat the peer as not active due to BFD down only if established
2025-04-04 12:28:18 -04:00
Stephane Poignant 2cee5567bc
bgpd: flowspec: remove sizelimit check applied to the wrong length field (issue 18557)
Section 4.1 of RFC8955 defines how the length field of flowspec NLRIs is encoded.
The method use implies a maximum length of 4095 for a single flowspec NLRI.
However, in bgp_flowspec.c, we check the length attribute of the bgp_nlri structure against this maximum value, which actually is the *total* length of all NLRI included in the considered MP_REACH_NLRI path attribute.
Due to this confusion, frr would reject valid announces that contain many flowspec NLRIs, when their cummulative length exceeds 4095, and close the session.
The proposed change removes that check entirely. Indeed, there is no need to check the length field of each invidual NLRI because the method employed make it impossible to encode a length greater than 4095.

Signed-off-by: Stephane Poignant <stephane.poignant@proton.ch>
2025-04-04 13:29:02 +02:00
Donatas Abraitis 03c5ada020
Merge pull request #18567 from nabahr/proxy_init_disable
pimd: Initialize gm proxy to false
2025-04-04 02:10:35 +03:00
Mark Stapp bee5b36bbb
Merge pull request #18572 from opensourcerouting/fix/syntax_error_bgp_gr_notification
tests: Fix typo when configuring delayopen timer
2025-04-03 10:32:05 -04:00
Mark Stapp e0a97e5b85
Merge pull request #18546 from LabNConsulting/ziemba/250330-rfapi-mem-cleanup
bgpd: rfapi: track outstanding rib and import timers, free mem at exit
2025-04-03 09:01:35 -04:00
Russ White ab67e5544e
Merge pull request #18396 from pguibert6WIND/srv6l3vpn_to_bgp_vrf_redistribute
Add BGP redistribution in SRv6 BGP
2025-04-03 08:25:32 -04:00
Donatas Abraitis 55d88ee3de tests: Fix typo when configuring delayopen timer
`"` was accidentally added, and random tests failures happening.

Fixes: a4f61b78dd ("tests: Check if routes are marked as stale and retained with N-bit for GR")

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-04-03 14:01:20 +03:00
Donatas Abraitis 112663772a
Merge pull request #18553 from y-bharath14/srib-tests-v9
tests: Resource leaks in test_all_protocol_startup
2025-04-03 11:08:37 +03:00
Donatas Abraitis b977a0541c
Merge pull request #18564 from routingrocks/rvaratharaj/bug_fix_bgp
bgpd: Skip EVPN MAC processing for non-EVPN peers
2025-04-03 09:46:34 +03:00
Nathan Bahr 153d9ea3b9 pimd: Initialize gm proxy to false
Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2025-04-02 21:07:41 +00:00
Jafar Al-Gharaibeh 994fdeeb22
Merge pull request #18525 from donaldsharp/eigrp_coverity_newly_found
eigrpd: Fix possible use after free in nbr deletion
2025-04-02 14:13:37 -05:00
Jafar Al-Gharaibeh d9a00d25d9
Merge pull request #18561 from opensourcerouting/fix/ipv6_duplicate_check
lib: Return duplicate ipv6 prefix-list entry test
2025-04-02 14:08:12 -05:00
Rajesh Varatharaj 35129c88b4 bgpd: Skip EVPN MAC processing for non-EVPN peers
Issue:
"Processing EVPN MAC interface change on peer" log message is printed
even when the peer didnt have EVPN address family.

Fix:
Process only if the peer is in EVPN address family

Ticket: #17890
Signed-off-by: Rajesh Varatharaj <rvaratharaj@nvidia.com>
2025-04-02 11:48:42 -07:00
Donatas Abraitis da4a7b0356 bgpd: Treat the peer as not active due to BFD down only if established
If we have `neighbor X bfd` and BFD status is DOWN and/or ADMIN_DOWN, and BGP
session is not yet established, we never allow the session to establish.

Let's fix this regression that was in 10.2.

Fixes: 1fb48f5 ("bgpd: Do not start BGP session if BFD profile is in shutdown state")

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-04-02 17:24:09 +03:00
Russ White d10b08e4e8
Merge pull request #18097 from louis-6wind/attrhash_cmp
bgpd: optimize attrhash_cmp calls
2025-04-02 08:25:35 -04:00
Donatas Abraitis 24ae7cd30a lib: Return duplicate ipv6 prefix-list entry test
Fixes: 8384d41144 ("lib: Return duplicate prefix-list entry test")

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-04-02 11:09:59 +03:00
Russ White 90b004cd46
Merge pull request #18543 from y-bharath14/srib-yang-v8
yang: Corrected pyang errors in frr-zebra.yang
2025-04-01 17:30:30 -04:00
Louis Scalbert cbf27be5d9 bgpd: optimize attrhash_cmp calls
Only call attrhash_cmp when necessary.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-04-01 16:52:58 +02:00
Russ White 9f8027b8a4
Merge pull request #18524 from donaldsharp/eigrp_limit_asn_vrf
yang: Limit eigrp to just 1 instance per vrf
2025-04-01 10:22:21 -04:00
Russ White ec1fcc1799
Merge pull request #18470 from zmw12306/NH_Init
babeld: Add next hop initialization
2025-04-01 10:13:11 -04:00
Russ White c312917988
Merge pull request #18450 from donaldsharp/bgp_packet_reads
Bgp packet reads conversion to a FIFO
2025-04-01 10:12:37 -04:00
Y Bharath 09081f8563 tests: Resource leaks in test_all_protocol_startup
Fix resource leaks in test_all_protocol_startup.py

Signed-off-by: y-bharath14 <y.bharath@samsung.com>
2025-04-01 12:06:15 +05:30
G. Paul Ziemba 1629c05924 bgpd: rfapi: track outstanding rib and import timers, free mem at exit
While here, also make "VPN SAFI clear" test wait for clear result
    (tests/topotests/bgp_rfapi_basic_sanity{,_config2})

    Original RFAPI code relied on the frr timer system to remember
    various allocations that were supposed to be freed at future times
    rather than manage a parallel database. However, if bgpd is terminated
    before the times expire, those pending allocations are marked as
    memory leaks, even though they wouldn't be leaks under normal operation.

    This change adds some hash tables to track these outstanding
    allocations that are associated with pending timers, and uses
    those tables to free the allocations when bgpd exits.

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2025-03-31 08:45:33 -07:00
Donatas Abraitis f33dcf3fa0
Merge pull request #18544 from donaldsharp/memory_leaks_all_over
Memory leaks all over
2025-03-31 14:50:59 +03:00
Donald Sharp 354aee8932 bgpd: Free memory associated with aspath_dup
Fix this:

==3890443== 92 (48 direct, 44 indirect) bytes in 1 blocks are definitely lost in loss record 68 of 98
==3890443==    at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==3890443==    by 0x49737B3: qcalloc (memory.c:106)
==3890443==    by 0x3EA63B: aspath_dup (bgp_aspath.c:703)
==3890443==    by 0x2F5438: route_set_aspath_exclude (bgp_routemap.c:2604)
==3890443==    by 0x49BC52A: route_map_apply_ext (routemap.c:2708)
==3890443==    by 0x2C1069: bgp_input_modifier (bgp_route.c:1925)
==3890443==    by 0x2C9F12: bgp_update (bgp_route.c:5205)
==3890443==    by 0x2CF281: bgp_nlri_parse_ip (bgp_route.c:7271)
==3890443==    by 0x2A28C7: bgp_nlri_parse (bgp_packet.c:338)
==3890443==    by 0x2A7F5C: bgp_update_receive (bgp_packet.c:2448)
==3890443==    by 0x2ACCA6: bgp_process_packet (bgp_packet.c:4046)
==3890443==    by 0x49EB77C: event_call (event.c:2019)
==3890443==    by 0x495FAD1: frr_run (libfrr.c:1247)
==3890443==    by 0x208D6D: main (bgp_main.c:557)

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-03-30 17:54:34 -04:00
Donald Sharp f82682a3f9 zebra: Clean up memory associated with affinity maps
Zebra is using affinity maps but not cleaning up memory on shutdown.
BAD!

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-03-30 17:54:34 -04:00
Donald Sharp 1f09381f0f isisd: Tie isis into cleaning up affinity maps
Affinity maps are abeing leaked.  STOP

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-03-30 17:54:34 -04:00
Donald Sharp 2da251264d lib: Add a affinity_map_terminate() function
This function will clean up memory associated with affinity maps
on shutdown

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-03-30 17:54:34 -04:00
Donald Sharp fbdce3358e *: Ensure prefix lists are freed on shutdown.
Several daemons were not calling prefix_list_reset
to clean up memory on shutdown.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-03-30 17:00:38 -04:00
Donald Sharp c9d431d4db bgpd: On shutdown, unlock table when clearing the bgp metaQ
There are some tables not being freed upon shutdown.  This
is happening because the table is being locked as dests
are being put on the metaQ.  When in shutdown it was clearing
the MetaQ it was not unlocking the table

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-03-30 14:02:16 -04:00
Donald Sharp 06480c0c81 bgpd: When shutting down do not clear self peers
Commit: e0ae285eb8

Modified the fsm state machine to attempt to not
clear routes on a peer that was not established.
The peer should be not a peer self.  We do not want
to ever clear the peer self.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-03-30 14:02:16 -04:00
Christian Hopps 1ef4f19009
Merge pull request #15471 from opensourcerouting/frrreload_logfile
tools: Add option to frr-reload to specify alternate logfile
2025-03-30 05:52:43 -04:00
Y Bharath 094072e948 yang: Corrected pyang errors in frr-zebra.yang
Corrected pyang warnings or errors in frr-zebra.yang

Signed-off-by: y-bharath14 <y.bharath@samsung.com>
2025-03-29 19:36:58 +05:30
Donatas Abraitis 285fcb903a
Merge pull request #18532 from y-bharath14/srib-tests-v8
tests: Irrelevant code in lutil.py
2025-03-28 12:38:07 +02:00
Y Bharath f2d988bf71 tests: Irrelevant code in lutil.py
Irrelevant code in lutil.py

Signed-off-by: y-bharath14 <y.bharath@samsung.com>
2025-03-28 10:52:36 +05:30
Donald Sharp 694fb7f48f eigrpd: Fix possible use after free in nbr deletion
Coverity is complaining about use after free's in
clearing eigrp neighbors.  Clean the code
up to not have the problem.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-03-27 11:28:58 -04:00
Donatas Abraitis 2de45ca1b4
Merge pull request #18520 from y-bharath14/srib-tests-v7
tests: Fix potential issues at send_bsr_packet.py
2025-03-27 15:07:45 +02:00
Donald Sharp 749dc0c966 yang: Limit eigrp to just 1 instance per vrf
Currently EIGRP has built in yang code that expects only
1 ASN used per vrf.  Let's just limit the operator from
putting themselves in a bad position by allowing something like
this:

router eigrp 33
....
!
router eigrp 99
...
!

no router eigrp 99 would crash because of assumptions
made in the yang processing.

Let's just hard code that assumption into the EIGRP yang
at the moment such that it will not allow you to enter
a `router eigrp 99` instance at all.

This is purely a software limitation to prevent the code
from violating it's current assumptions.  I do not see
much need to support this at this point in time so I
fixed the problem this way instead of having to possibly
touch a bunch of code.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-03-27 08:51:05 -04:00