Commit Graph

38290 Commits

Author SHA1 Message Date
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
Donald Sharp
c41155221e 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 12:38:20 -05:00
Donatas Abraitis
ce20b8cc0d
Merge pull request #17956 from pguibert6WIND/isis_srv6_codepoint_erroneous
isisd: fix erroneous srv6 information in database
2025-01-31 13:56:09 +02:00
Donatas Abraitis
28178dde4c doc: Add more details for bgp reject-as-sets command
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-01-31 09:43:00 +02:00
Donatas Abraitis
25a37e9367 tests: Check if aggregated prefix is not advertised to contributing ASes
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-01-31 09:43:00 +02:00
Donatas Abraitis
925b365a87 bgpd: Do not advertise aggregate routes to contributing ASes
draft-ietf-idr-deprecate-as-set-confed-set-16 defines that we MUST NOT
advertise an aggregate prefix to the contributing ASes.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-01-31 09:43:00 +02:00
Carmine Scarpitta
339c49bcff tests: Add testcase for static End/uN validation
This commit adds a testcase to validate static End/uN allocation.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2025-01-30 19:28:34 +01:00
Carmine Scarpitta
a879aebf69 zebra: Fix SRv6 SID Manager
The SRv6 SID Manager does not allow allocating an SRv6 End/uN function
even though it is already supported by staticd.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2025-01-30 19:28:34 +01:00
Donatas Abraitis
de8f52b525
Merge pull request #17934 from nabahr/autorp-close
pimd: Close AutoRP socket when not needed
2025-01-30 16:19:40 +02:00
Mikhail Sokolovskiy
90fe717352 topotests: Router deletion in SRv6 sid reachability
Signed-off-by: Mikhail Sokolovskiy <sokolmish@gmail.com>
2025-01-30 01:54:47 +03:00
Mikhail Sokolovskiy
f3680ab410 bgpd: Release SID on router deletion
Signed-off-by: Mikhail Sokolovskiy <sokolmish@gmail.com>
2025-01-30 01:54:31 +03:00
Donatas Abraitis
48560b5c9b tests: Check if the peer stays Idle if router-id is not set
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-01-29 23:17:20 +02:00
Donatas Abraitis
739f2b566a 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>
2025-01-29 23:03:06 +02:00
Donatas Abraitis
c9a2928954 doc: Say that 0.0.0.0 (0) BGP identifier is invalid
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-01-29 22:24:39 +02:00
David Lamparter
001fcfa1dd 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>
2025-01-29 16:48:37 +01:00
David Lamparter
4a0e1419a6 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>
2025-01-29 16:48:37 +01:00
David Lamparter
b666ee510e 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>
2025-01-29 16:48:37 +01:00
David Lamparter
c88589f5e9 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>
2025-01-29 16:48:37 +01:00
David Lamparter
95cf0b2279 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>
2025-01-29 16:48:37 +01:00
David Lamparter
ce7f5b2122 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>
2025-01-29 16:48:37 +01:00
Donald Sharp
f849511c47
Merge pull request #17935 from mjstapp/fix_nhg_hash_equal
zebra: include resolving nexthops in nhg hash
2025-01-29 10:14:37 -05:00
Donald Sharp
fb8e399e4f lib: Remove System routes from ip protocol route map choices
Do not allow system routes to be selected for ip protocol

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-01-29 09:31:53 -05:00
Donatas Abraitis
190906aaf1
Merge pull request #17946 from bobuhiro11/normalize_ebgp_multihop
tools: Fix frr-reload for ebgp-multihop TTL reconfiguration.
2025-01-29 14:05:12 +02:00
Philippe Guibert
4150f9bbb1 isisd: fix erroneous srv6 information in database
The show isis database detail command dumps invalid srv6 information:
>  SRv6 Locator: fc00:0:6::/64 (Metric: 0) ipv6-unicast
>    Sub-TLVs:
>      SRv6 End SID Endpoint Behavior: unknown, SID value: fc00:0:6:0:1::
>
>  MT Reachability: 0123.6452.1973.03 (Metric: 10) ipv6-unicast
>    Local Interface IPv6 Address(es): 192::4:3
>    SRv6 Lan End.X SID: fc00:0:3:0:43::, Algorithm: SPF, Weight: 0, Endpoint Behavior: End.DX6, Flags: B:0, S:0, P:0 Neighbor-ID: 0123.6452.1975
>        SRv6 SID Structure Locator Block length: 40, Locator Node length: 24, Function length: 16, Argument length: 0,

The behavior codepoint should use the IANA definitions to display the
correct value. Fix this by calling the appropriate convert function.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-29 12:20:24 +01:00
Nobuhiro MIKI
594e917656 tools: Fix frr-reload for ebgp-multihop TTL reconfiguration.
In ebgp-multihop, there is a difference in reload behavior when TTL is
unspecified (meaning default 255) and when 255 is explicitly specified.
For example, when reloading with 'neighbor <neighbor> ebgp-multihop
255' in the config, the following difference is created. This commit
fixes that.

    Lines To Delete
    ===============
    router bgp 65001
     no neighbor 10.0.0.4 ebgp-multihop
    exit

    Lines To Add
    ============
    router bgp 65001
     neighbor 10.0.0.4 ebgp-multihop 255
    exit

The commit 767aaa3a80 is not sufficient and frr-reload needs to be
fixed to handle both unspecified and specified cases.

Signed-off-by: Nobuhiro MIKI <nob@bobuhiro11.net>
2025-01-29 04:43:17 +00:00
Donald Sharp
73ab6a46c5 tests: Add a test that shows the v6 recursive nexthop problem
Currently FRR does not handle v6 recurisive resolution properly
when the route being recursed through changes and the most
significant bits of the route are not changed.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-01-28 13:52:32 -05:00
Russ White
bd82864d03
Merge pull request #17941 from opensourcerouting/fix-dst-src
static: fix botched staticd YANG conversion for dst-src
2025-01-28 12:23:06 -05:00
Russ White
e82788de46
Merge pull request #17802 from askorichenko/test-fix-table-map
bgpd: fix table-map option
2025-01-28 12:20:43 -05:00
Russ White
3bdb561d1c
Merge pull request #17906 from LabNConsulting/aceelindem/ospf-prune-dup-next-hops
ospfd: Prune duplicate next-hop when installing into zebra route table.
2025-01-28 12:19:07 -05:00
Russ White
e54c11d54d
Merge pull request #17848 from pguibert6WIND/isis_srv6_topo1_ping
Isis srv6 topo1 ping
2025-01-28 11:49:20 -05:00
Russ White
219b00cb74
Merge pull request #17924 from donaldsharp/evaluate_paths_optimization
bgpd: Optimize evaluate paths for a peer going down
2025-01-28 11:29:15 -05:00
Russ White
cec2e9b159
Merge pull request #17881 from opensourcerouting/fix/last_reset_reason
bgpd: last reset SNAFU
2025-01-28 10:40:50 -05:00