Commit Graph

38268 Commits

Author SHA1 Message Date
Russ White
5f790f7875
Merge pull request #17959 from opensourcerouting/fix/bgp_deny_zero_bgp_identifier_to_establish
bgpd: Do not start BGP session if BGP identifier is not set
2025-02-04 11:31:57 -05:00
Jafar Al-Gharaibeh
23ab6c799f build: FRR 10.4 development version
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2025-02-04 10:23:20 -06: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
Donald Sharp
c6b7a993fb 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>
2025-02-04 10:56:59 -05:00
Philippe Guibert
af8e792205 bgpd: add L2 attr community support as per RFC8214
The L2 attribute extended community can not be decoded when using L2VPN
EVPN as a route reflector. Decode the extended community and dump the
detailed information about flags and MTU information.

> rt4# show bgp l2vpn evpn
> BGP table version is 1, local router ID is 4.4.4.4
> Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
> Origin codes: i - IGP, e - EGP, ? - incomplete
> EVPN type-1 prefix: [1]:[EthTag]:[ESI]:[IPlen]:[VTEP-IP]:[Frag-id]
> EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]:[IPlen]:[IP]
> EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
> EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
> EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]
>
>    Network          Next Hop            Metric LocPrf Weight Path
> Route Distinguisher: 1.1.1.1:100
>  *>i[1]:[12]:[00:00:00:00:00:00:00:00:00:00]:[32]:[0.0.0.0]:[0]
>                     1.1.1.1                       100      0 i
>                     RT:65500:100 L2: P flag:N, B Flag N, C word N, MTU 0
> Route Distinguisher: 5.5.5.5:100
>  *>i[1]:[10]:[00:00:00:00:00:00:00:00:00:00]:[32]:[0.0.0.0]:[0]
>                     5.5.5.5                       100      0 i
>                     RT:65500:100 L2: P flag:N, B Flag N, C word N, MTU 0
>

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-02-04 16:12:39 +01:00
Louis Scalbert
fcae7a401d tests: bgp_vpnv4_route_leak_basic add del static prefix
In bgp_vpnv4_route_leak_basic, remove and add back the static prefix
172.16.3.0/24 on VRF DONNA. Before the previous fixes, the 172.16.3.0/24
prefix re-appeared when it was added back in the VPN table but it was
marked as invalid.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-02-04 14:37:49 +01:00
Louis Scalbert
1e826d5d0c tests: check bgp vpn table in bgp_vpnv4_route_leak_basic
Check bgp vpn table in bgp_vpnv4_route_leak_basic

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-02-04 14:37:49 +01:00
Louis Scalbert
5b22c79c3d tests: fix no vrf1 in bgp_bmp r2
The bgp_bmp test is failing because r2 lacks the vrf1 VRF, which
prevents it from exporting VPN prefixes from the configured vrf1 BGP
instance. Previous versions allowed the export of static BGP prefixes
from a non-existent VRF, so the test passed under those conditions.

Add a vrf1 VRF on r2.

Fixes: d748544769 ("topotests: add basic bgp bmp test")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-02-04 14:37:31 +01:00
Louis Scalbert
5a0f1dd6d6 tests: update route_leak_basic tests
Update route_leak_basic tests. The routes with an unusable nexthop VRF
are no more present in the RIB.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-02-04 14:35:58 +01:00
Louis Scalbert
58a260a0a3 bgpd: do not leak if origin vrf is not usable
Do not leak if origin vrf is not usable

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-02-04 14:35:58 +01:00
Louis Scalbert
bb986e96dc bgpd: recheck leak nexthop validity
When leak_update() rechecks an existing path, it considers nothing to
update if the attributes and labels are not changed. However, it does
not take into account the nexthop validity.

Perform a leak update if the nexthop validity has changed.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-02-04 14:35:58 +01:00
Louis Scalbert
779077bf56 bgpd: check nexthop vrf usability
Mark a nexthop as invalid if the origin VRF is unusable, either because
it does not exist or its interface is down.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-02-04 14:35:58 +01:00
Louis Scalbert
3430526e11 bgpd: merge parent and source_bpi in leak_update
They are the same value.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-02-04 14:35:58 +01: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
b29332
27413dd24a isisd: 'tiebreaker' command line funtionality is inconsistent with its implementation
The command fast-reroute lfa tiebreaker [downstream | lowest-backup-metric | node-protecting] index (1-255) [level-1 | level-2] will overwrite configurations with the same index but different types. This is because the index is set as the key in frr-isisd.yang. However, the lfa_tiebreaker_cmp function uses a tuple (index, type) as the key. Therefore, the yang file should be modified to stay in sync with the business logic.

Test Scenario:
On RouterA, first configure fast-reroute lfa tiebreaker downstream index 100 level-1, then configure fast-reroute lfa tiebreaker lowest-backup-metric index 100 level-1, and check the configuration:

!
router isis 10
 fast-reroute lfa tiebreaker lowest-backup-metric index 100 level-1
exit
!

Signed-off-by: baozhen-H3C <bao.zhen@h3c.com>
2025-02-04 11:33:02 +00: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
Carmine Scarpitta
1add31d129 tests: Add topotest for SRv6 IPv4 traffic steering
Add a topotest to verify the newly introduced CLI to support
steering of IPv4 traffic over an SRv6 SID list.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2025-02-03 22:21:16 +01:00
Carmine Scarpitta
478550efc4 doc: Add documentation for SRv6 IPv4 traffic steering
Add an example of how to steer IPv4 traffic over an SRv6 SID list.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2025-02-03 22:21:16 +01:00
Carmine Scarpitta
39613ec8be staticd: Extend ip_route_vrf CLI to support SRv6 traffic steering
staticd already has a CLI to steer IPv6 traffic over a given SRv6 SID
list:

```
vrf vrf10
 ipv6 route 2001:db8:1:1::/64 sr0 segments fcbb:bbbb:1:2:3:fe00::
```

This PR extends the existing CLI `ip route` to support steering of IPv4
traffic over an SRv6 SID list.

```
vrf vrf10
 ip route 10.0.0.0/24 sr0 segments fcbb:bbbb:1:2:3:fe00::
```

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2025-02-03 22:20:58 +01:00
Carmine Scarpitta
885181acb4 staticd: Extend ip_route CLI to support SRv6 traffic steering
staticd already has a CLI to steer IPv6 traffic over a given SRv6 SID
list:

```
ipv6 route 2001:db8:1:1::/64 sr0 segments fcbb:bbbb:1:2:3:fe00::
```

This PR extends the existing CLI `ip route` to support steering of IPv4
traffic over an SRv6 SID list.

```
ip route 10.0.0.0/24 sr0 segments fcbb:bbbb:1:2:3:fe00::
```

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2025-02-03 22:20:34 +01:00
Carmine Scarpitta
e1e31e0869 staticd: Extend ip_route_address_interface_vrf to support SRv6 traffic steering
staticd already has a CLI to steer IPv6 traffic over a given SRv6 SID
list:

```
vrf vrf10
 ipv6 route 2001:db8:1:1::/64 sr0 segments fcbb:bbbb:1:2:3:fe00::
```

This PR extends the existing CLI `ip route` to support steering of IPv4
traffic over an SRv6 SID list.

```
vrf vrf10
 ip route 10.0.0.0/24 sr0 segments fcbb:bbbb:1:2:3:fe00::
```

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2025-02-03 22:20:14 +01:00
Carmine Scarpitta
6f52056f70 staticd: Extend ip_route_address_interface to support SRv6 traffic steering
staticd already has a CLI to steer IPv6 traffic over a given SRv6 SID
list:

```
ipv6 route 2001:db8:1:1::/64 sr0 segments fcbb:bbbb:1:2:3:fe00::
```

This PR extends the existing CLI `ip route` to support steering of IPv4
traffic over an SRv6 SID list.

```
ip route 10.0.0.0/24 sr0 segments fcbb:bbbb:1:2:3:fe00::
```

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2025-02-03 22:20:01 +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
Philippe Guibert
1cefe94dd3 bgpd: fix add label support to EVPN AD routes
When peering with an EVPN device from other vendor, FRR acting as route
reflector is not able to read nor transmit the label value.

Actually, EVPN AD routes completely ignore the label value in the code,
whereas in some functionalities like evpn-vpws, it is authorised to
carry and propagate label value.

Fix this by handling the label value.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-02-03 14:54:43 +01: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
Carmine Scarpitta
7a46623348 staticd: Fix NULL pointer dereference
When staticd receives a `ZAPI_SRV6_SID_RELEASED` notification from SRv6
SID Manager, it tries to unset the validity flag of `sid`. But since
the `sid` variable is NULL, we get a NULL pointer dereference.

```
=================================================================
==13815==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000060 (pc 0xc14b813d9eac bp 0xffffcb135a40 sp 0xffffcb135a40 T0)
==13815==The signal is caused by a READ memory access.
==13815==Hint: address points to the zero page.
    #0 0xc14b813d9eac in static_zebra_srv6_sid_notify staticd/static_zebra.c:1172
    #1 0xe44e7aa2c194 in zclient_read lib/zclient.c:4746
    #2 0xe44e7a9b69d8 in event_call lib/event.c:1984
    #3 0xe44e7a85ac28 in frr_run lib/libfrr.c:1246
    #4 0xc14b813ccf98 in main staticd/static_main.c:193
    #5 0xe44e7a4773f8 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    #6 0xe44e7a4774c8 in __libc_start_main_impl ../csu/libc-start.c:392
    #7 0xc14b813cc92c in _start (/usr/lib/frr/staticd+0x1c92c)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV staticd/static_zebra.c:1172 in static_zebra_srv6_sid_notify
==13815==ABORTING
```

This commit fixes the problem by doing a SID lookup first. If the SID
can't be found, we log an error and return. If the SID is found, we go
ahead and unset the validity flag.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2025-02-02 10:06:22 +01:00
Donatas Abraitis
43a04450e0
Merge pull request #17972 from enkechen-panw/rr-policy
bgpd: add config default for "route-reflector allow-outbound-policy"
2025-02-02 09:53:16 +02:00
Enke Chen
a2018b3ee9 bgpd: add config default for "route-reflector allow-outbound-policy"
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-01 10:24:19 -08:00
Donatas Abraitis
69b763f730
Merge pull request #17971 from donaldsharp/suppress_fib_giving_us_the_business
bgpd: With suppress-fib-pending ensure withdrawal is sent
2025-02-01 13:25:37 +02:00
Donald Sharp
4e8eda74ec bgpd: With suppress-fib-pending ensure withdrawal is sent
When you have suppress-fib-pending turned on it is possible
to end up in a situation where the prefix is not withdrawn
from downstream peers.

Here is the timing that I believe is happening:

a) have 2 paths to a peer.
b) receive a withdrawal from 1 path, set BGP_NODE_FIB_INSTALL_PENDING
   and send the route install to zebra.
c) receive a withdrawal from the other path.
d) At this point we have a dest->flags set BGP_NODE_FIB_INSTALL_PENDING
   old_select the path_info going away, new_select is NULL
e) A bit further down we call group_announce_route() which calls
   the code to see if we should advertise the path.  It sees the
   BGP_NODE_FIB_INSTALL_PENDING flag and says, nope.
f) the route is sent to zebra to withdraw, which unsets the
   BGP_NODE_FIB_INSTALL_PENDING.
g) This function winds up and deletes the path_info.  Dest now
   has no path infos.
h) BGP receives the route install(from step b) and unsets the
   BGP_NODE_FIB_INSTALL_PENDING flag
i) BGP receives the route removed from zebra (from step f) and
   unsets the flag again.

We know if there is no new_select, let's go ahead and just
unset the PENDING flag to allow the withdrawal to go out
at the time when the second withdrawal is received.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-01-31 18:53:30 -05:00
Donald Sharp
64709ec2a9 zebra: Ensure dplane does not send work back to master at wrong time
When looping through the dplane providers, the worklist was
being populated with items from the last provider and then
the event system was checked to see if we should stop processing.
If the event system says `yes` then the dplane code would stop
and send the worklist to the master zebra pthread for collection.
This obviously skipped the next dplane provider on the list
which is double plus not good.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-01-31 15:05:40 -05:00
Donald Sharp
07a803a7b3 zebra: Stop buffering output from fpm_listener
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-01-31 15:05:40 -05:00
Donald Sharp
c58da10d2a zebra: Limit mutex for obuf to when we access obuf
The mutex that wraps access to the output buffer
is being held for the entire time the data is
being generated to send down the pipe.  Since
the generation has absolutely nothing to do
with the obuf, let's limit the mutex holding some.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-01-31 15:05:40 -05:00
Donald Sharp
22c7151c23 tests: Show that asic offload works in the fpm testing
The fpm_testing_topo1 didn't turn on the fpm_listener
sending the routes back to zebra to set the asic offload.

Modify the test to tell the fpm_listener to set the offloaded
flag and reflect the route back to the dplane_fpm_nl.c code.
Also modify zebra to expect a response to the underlying fpm listener.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-01-31 15:05:40 -05:00
Donald Sharp
e71d29983a zebra: fpm_listener allow continued operation
In fpm_listener, when a error is detected it would
stop listening and not recover.  Modify the code
to close the socket and allow the connection to
recover.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-01-31 15:05:40 -05:00
Donald Sharp
b2fc167978 zebra: Fix pass back of data from dplane through fpm pipe
A recent code change 29122bc9b8
changed the passing of data up the fpm from passing the
tableid and vrf to the sonic expected tableid contains
the vrfid.  This violates the assumptions in the code
that the netlink message passes up the tableid as the
tableid.  Additionally this code change did not modify
the rib_find_rn_from_ctx to actually properly decode
what could be passed up.  Let's just fix this and let
Sonic carry the patch as appropriate for themselves
since they are not the only users of dplane_fpm_nl.c

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-01-31 15:05:40 -05:00
Mark Stapp
e13a4485bf libs: return from change_caps if no caps
When called without caps/privs, just return from "change_caps"
instead of exiting - it's possible that a process may not need
privs, but a lib (for example) may use the api.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-01-31 13:13:48 -05:00