Commit Graph

37996 Commits

Author SHA1 Message Date
Donald Sharp
45e7fc0bed
Merge pull request #18056 from FRRouting/mergify/bp/dev/10.3/pr-18048
pimd: fix DR election race on startup (backport #18048)
2025-02-12 12:39:27 -05:00
Donald Sharp
6d933fcbc3
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)
2025-02-12 09:30:11 -05:00
Donald Sharp
8edcdf0149
Merge pull request #18101 from FRRouting/mergify/bp/dev/10.3/pr-18060
lib: crash handlers must be allowed on threads (backport #18060)
2025-02-12 08:18:58 -05:00
Donald Sharp
57c152832b
Merge pull request #18112 from FRRouting/mergify/bp/dev/10.3/pr-18078
nhrpd: fix dont consider incomplete L2 entry (backport #18078)
2025-02-12 08:17:12 -05:00
Donald Sharp
60dbf7eeba
Merge pull request #18115 from FRRouting/mergify/bp/dev/10.3/pr-18069
bgpd: Request SRv6 locator after zebra connection (backport #18069)
2025-02-12 08:15:05 -05:00
Carmine Scarpitta
8e4f5716c5 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 16640b615d)
2025-02-12 03:00:15 +00:00
Philippe Guibert
ffcaa8ebb5 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 3202323052)
2025-02-12 02:58:06 +00:00
Russ White
624682cfe9
Merge pull request #18099 from FRRouting/mergify/bp/dev/10.3/pr-18081
bgpd: fix bgp vrf instance creation from implicit (backport #18081)
2025-02-11 12:28:57 -05:00
David Lamparter
cbcc66c5d6 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 13a6ac5b4c)
2025-02-11 17:26:42 +00:00
Chirag Shah
e2d2797f7a 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 2ff08af78e)
2025-02-11 17:20:28 +00:00
David Lamparter
a04474c061 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 001fcfa1dd)
2025-02-11 08:43:29 +00:00
David Lamparter
e9f1d637ee 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 4a0e1419a6)
2025-02-11 08:43:29 +00:00
David Lamparter
e74b0ca0fc 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 b666ee510e)
2025-02-11 08:43:29 +00:00
David Lamparter
9a8ad94ce9 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 c88589f5e9)
2025-02-11 08:43:28 +00:00
David Lamparter
a8775530a0 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 95cf0b2279)
2025-02-11 08:43:28 +00:00
David Lamparter
36534e15c0 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 ce7f5b2122)
2025-02-11 08:43:28 +00:00
Donatas Abraitis
bf16e53186
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)
2025-02-07 16:10:46 +02:00
Rafael Zalamena
b61fedd029 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 8644524606)
2025-02-07 03:42:34 +00:00
Rajesh Varatharaj
ccbe9f985b 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 afed39ea2b)
2025-02-07 03:40:41 +00:00
Jafar Al-Gharaibeh
3d61bbe0d9
Merge pull request #18042 from FRRouting/mergify/bp/dev/10.3/pr-17865
Coverity 2024 new hotness (backport #17865)
2025-02-06 17:20:22 -06:00
Jafar Al-Gharaibeh
8b5df22906
Merge pull request #18043 from FRRouting/mergify/bp/dev/10.3/pr-18038
pimd: fix memory leak and assign allocation type (backport #18038)
2025-02-06 17:20:03 -06:00
Rafael Zalamena
92792cb2ac 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 d1440dadff)
2025-02-06 16:32:34 +00:00
Donald Sharp
ae8ee154ef 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 19af3f3d7a)
2025-02-06 16:16:49 +00:00
Donald Sharp
edfcf0662b 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 f94ad538cf)
2025-02-06 16:16:48 +00:00
Donald Sharp
791ec8ebdd zebra: Add some documentation on when zserv_open should be used
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 4b96752737)
2025-02-06 16:16:48 +00:00
Donald Sharp
01af91e5ff 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 283cc51178)
2025-02-06 16:16:48 +00:00
Donald Sharp
62e01a8982
Merge pull request #18019 from FRRouting/mergify/bp/dev/10.3/pr-18000
bgpd: Fix up memory leak in processing eoiu marker (backport #18000)
2025-02-05 08:17:07 -05:00
Donald Sharp
9b99397859 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 c6b7a993fb)
2025-02-05 05:22:23 +00:00
Russ White
b2f9962550
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)
2025-02-04 11:46:15 -05:00
Donatas Abraitis
3f788da60b 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 48560b5c9b)
2025-02-04 16:37:56 +00:00
Donatas Abraitis
46d210ce80 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 739f2b566a)
2025-02-04 16:37:55 +00:00
Donatas Abraitis
388f9ef0cb doc: Say that 0.0.0.0 (0) BGP identifier is invalid
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit c9a2928954)
2025-02-04 16:37:55 +00:00
Mark Stapp
704372bf4b
Merge pull request #17969 from donaldsharp/fpm_lost_sends
zebra: Ensure dplane does not send work back to master at wrong time
2025-02-04 11:18:07 -05:00
Russ White
f74fa9543b
Merge pull request #17992 from chiragshah6/fdev5
bgpd: fix route-distinguisher in vrf leak json cmd
2025-02-04 07:40:36 -05:00
Donatas Abraitis
0ee2773149
Merge pull request #17991 from chiragshah6/bgp_dev4
zebra: fix evpn svd hash avoid double free
2025-02-04 14:34:21 +02:00
Russ White
f9e11d6974
Merge pull request #17943 from opensourcerouting/clear-event-cpu-uaf
lib: fix use after free in `clear event cpu`
2025-02-04 06:57:52 -05:00
Russ White
adeb30d8f3
Merge pull request #17336 from forrestchu/sbfd
implement SBFD
2025-02-04 06:36:43 -05:00
Donatas Abraitis
817c2c9823
Merge pull request #17990 from enkechen-panw/aigp-cfg-default
bgpd: add config default for "bgp bestpath aigp"
2025-02-04 10:51:52 +02:00
Donatas Abraitis
cb7d1cbf53
Merge pull request #17989 from cscarpitta/fix/fix_staticd_no_sid
staticd: Fix wrong xpath in `no sid X:X::X:X/M`
2025-02-04 10:47:20 +02:00
Chirag Shah
892704d07f bgpd: fix route-distinguisher in vrf leak json cmd
For auto configured value RD value comes as NULL,
switching back to original change will ensure to cover
for both auto and user configured RD value in JSON.

tor-11# show bgp vrf blue ipv4 unicast route-leak json
{
  "vrf":"blue",
  "afiSafi":"ipv4Unicast",
  "importFromVrfs":[
    "purple"
  ],
  "importRts":"10.10.3.11:6",
  "exportToVrfs":[
    "purple"
  ],
  "routeDistinguisher":"(null)", <<<<<
  "exportRts":"10.10.3.11:10"
}

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2025-02-03 20:58:45 -08:00
Chirag Shah
1d4f5b9b19 zebra: evpn svd hash avoid double free
Upon zebra shutdown hash_clean_and_free is called
where user free function is passed,
The free function should not call hash_release
which lead to double free of hash bucket.

Fix:
The fix is to avoid calling hash_release from
free function if its called from hash_clean_and_free
path.

10 0x00007f0422b7df1f in free () from /lib/x86_64-linux-gnu/libc.so.6
11 0x00007f0422edd779 in qfree (mt=0x7f0423047ca0 <MTYPE_HASH_BUCKET>,
    ptr=0x55fc8bc81980) at ../lib/memory.c:130
12 0x00007f0422eb97e2 in hash_clean (hash=0x55fc8b979a60,
    free_func=0x55fc8a529478 <svd_nh_del_terminate>) at
    ../lib/hash.c:290
13 0x00007f0422eb98a1 in hash_clean_and_free (hash=0x55fc8a675920
    <svd_nh_table>, free_func=0x55fc8a529478 <svd_nh_del_terminate>) at
    ../lib/hash.c:305
14 0x000055fc8a5323a5 in zebra_vxlan_terminate () at
    ../zebra/zebra_vxlan.c:6099
15 0x000055fc8a4c9227 in zebra_router_terminate () at
    ../zebra/zebra_router.c:276
16 0x000055fc8a4413b3 in zebra_finalize (dummy=0x7fffb881c1d0) at
    ../zebra/main.c:269
17 0x00007f0422f44387 in event_call (thread=0x7fffb881c1d0) at
    ../lib/event.c:2011
18 0x00007f0422ecb6fa in frr_run (master=0x55fc8b733cb0) at
    ../lib/libfrr.c:1243
19 0x000055fc8a441987 in main (argc=14, argv=0x7fffb881c4a8) at
    ../zebra/main.c:584

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2025-02-03 16:09:20 -08:00
Carmine Scarpitta
210a7d8981 tests: Add test case to verify SID re-add
Add a new test case that re-add the deleted SIDs and verifies that all
SIDs are added back to the RIB.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2025-02-03 23:02:30 +01:00
Carmine Scarpitta
4eed9ee0a7 tests: Add test case to verify SID delete
Add a new test case that deletes a SID and verifies that only this
SID has been removed from the RIB.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2025-02-03 23:02:11 +01:00
Carmine Scarpitta
c809035cc4 staticd: Fix wrong xpath in no sid X:X::X:X/M
When a user wants to delete a specific SRv6 SID, he executes the
`no sid X:X::X:X/M` command.
However, by mistake, in addition to deleting the SID requested by the
user, this command also removes all other SIDs.

This happens because `no sid X:X::X:X/M` triggers a destroy operation
on the wrong xpath `frr-staticd:staticd/segment-routing/srv6`.

This commit fixes the issue by replacing the wrong xpath
`frr-staticd:staticd/segment-routing/srv6` with the correct xpath
`frr-staticd:staticd/segment-routing/srv6/static-sids/sid[sid='%s']`.

This ensures that the `no sid X:X::X:X/M` command only deletes the SID
that was requested by the user.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2025-02-03 22:33:00 +01:00
Donald Sharp
f54241a346
Merge pull request #17970 from mjstapp/fix_privs_no_caps
libs: return from change_caps if no caps
2025-02-03 12:57:44 -05:00
Carmine Scarpitta
0768c620e0
Merge pull request #17913 from Sokolmish/bgp-sid-release
bgpd: Release SID on router deletion
2025-02-03 14:52:00 +01:00
Enke Chen
6204db214e bgpd: add config default for "bgp bestpath aigp"
Just to make it simpler for compiling with a different default value.
No change to its default value.

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
2025-02-02 20:35:44 -08:00
Donatas Abraitis
4f43a33d42
Merge pull request #17979 from cscarpitta/fix/fix_staticd_sid_notify
staticd: Fix NULL pointer dereference when receiving `ZAPI_SRV6_SID_RELEASED` notification
2025-02-02 21:17:33 +02:00
Russ White
593e3e199a
Merge pull request #17947 from opensourcerouting/fix/bgp_disable_vrf
bgpd: Do not ignore auto generated VRF instances when deleting
2025-02-02 12:41:12 -05:00
Donatas Abraitis
91ebab35f2
Merge pull request #17964 from cscarpitta/fix/fix-srv6-sid-manager
Fix SRv6 SID Manager
2025-02-02 13:32:36 +02:00