]> git.puffer.fish Git - matthieu/frr.git/log
matthieu/frr.git
10 months agobgpd: avoid clearing routes for peers that were never established
Loïc Sang [Wed, 19 Jun 2024 14:19:22 +0000 (16:19 +0200)]
bgpd: avoid clearing routes for peers that were never established

Under heavy system load with many peers in passive mode and a large
number of routes, bgpd can enter an infinite loop. This occurs while
processing timeout BGP_OPEN messages, which prevents it from accepting
new connections. The following log entries illustrate the issue:
>bgpd[6151]: [VX6SM-8YE5W][EC 33554460] 3.3.2.224: nexthop_set failed, resetting connection - intf 0x0
>bgpd[6151]: [P790V-THJKS][EC 100663299] bgp_open_receive: bgp_getsockname() failed for peer: 3.3.2.224
>bgpd[6151]: [HTQD2-0R1WR][EC 33554451] bgp_process_packet: BGP OPEN receipt failed for peer: 3.3.2.224
... repeating

The issue occurs when bgpd handles a massive number of routes in the RIB
while receiving numerous BGP_OPEN packets. If bgpd is overloaded, it
fails to process these packets promptly, leading the remote peer to
close the connection and resend BGP_OPEN packets.

When bgpd eventually starts processing these timeout BGP_OPEN packets,
it finds the TCP connection closed by the remote peer, resulting in
"bgp_stop()" being called. For each timeout peer, bgpd must iterate
through the routing table, which is time-consuming and causes new
incoming BGP_OPEN packets to timeout, perpetuating the infinite loop.

To address this issue, the code is modified to check if the peer has
been established at least once before calling "bgp_clear_route_all()".
This ensures that routes are only cleared for peers that had a
successful session, preventing unnecessary iterations over the routing
table for peers that never established a connection.

With this change, BGP_OPEN timeout messages may still occur, but in the
worst case, bgpd will stabilize. Before this patch, bgpd could enter a
loop where it was unable to accpet any new connections.

Signed-off-by: Loïc Sang <loic.sang@6wind.com>
10 months agoMerge pull request #16252 from chiragshah6/evpn_dev1
Donatas Abraitis [Fri, 21 Jun 2024 06:46:07 +0000 (09:46 +0300)]
Merge pull request #16252 from chiragshah6/evpn_dev1

zebra: fix evpn mh bond member proto reinstall

10 months agoMerge pull request #16260 from pguibert6WIND/no_backup_nexthop_for_now
Donatas Abraitis [Fri, 21 Jun 2024 06:43:40 +0000 (09:43 +0300)]
Merge pull request #16260 from pguibert6WIND/no_backup_nexthop_for_now

bgpd: fix do not use api.backup_nexthop in ZAPI message

10 months agobgpd: fix do not use api.backup_nexthop in ZAPI message
Philippe Guibert [Thu, 20 Jun 2024 16:02:26 +0000 (18:02 +0200)]
bgpd: fix do not use api.backup_nexthop in ZAPI message

The backup_nexthop entry list has been populated by mistake,
and should not. Fix this by reverting the introduced behavior.

Fixes: 237ebf8d4503 ("bgpd: rework bgp_zebra_announce() function, separate nexthop handling")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
10 months agozebra: fix evpn mh bond member proto reinstall
Chirag Shah [Wed, 19 Jun 2024 00:21:49 +0000 (17:21 -0700)]
zebra: fix evpn mh bond member proto reinstall

In case of EVPN MH bond, a member port going in
protodown state due to external reason (one case being linkflap),
frr updates the state correctly but upon manually
clearing external reason trigger FRR to reinstate
protodown without any reason code.

Fix is to ensure if the protodown reason was external
and new state is to have protodown 'off' then do no reinstate
protodown.

Ticket: #3947432
Testing:
switch:#ip link show swp1
4: swp1: <NO-CARRIER,BROADCAST,MULTICAST,SLAVE,UP> mtu 9216 qdisc
   pfifo_fast master bond1 state DOWN mode DEFAULT group default qlen
   1000
       link/ether 1c:34:da:2c:aa:68 brd ff:ff:ff:ff:ff:ff protodown on
       protodown_reason <linkflap>

switch:#ip link set swp1 protodown off protodown_reason linkflap off
switch:#ip link show swp1
 4: swp1: <NO-CARRIER,BROADCAST,MULTICAST,SLAVE,UP> mtu 9216 qdisc
    pfifo_fast master bond1 state DOWN mode DEFAULT group default qlen
    1000
        link/ether 1c:34:da:2c:aa:68 brd ff:ff:ff:ff:ff:ff

Signed-off-by: Chirag Shah <chirag@nvidia.com>
10 months agoMerge pull request #16059 from kacpekwasny/kkwasny/CLIC-139-4
Donatas Abraitis [Thu, 20 Jun 2024 07:51:06 +0000 (10:51 +0300)]
Merge pull request #16059 from kacpekwasny/kkwasny/CLIC-139-4

bgpd: fixed failing to remove VRF if there is a stale l3vni

10 months agoMerge pull request #16243 from donaldsharp/ubsan_documentation
Donatas Abraitis [Thu, 20 Jun 2024 05:08:30 +0000 (08:08 +0300)]
Merge pull request #16243 from donaldsharp/ubsan_documentation

doc: Document the usage of --enable-undefined-sanitizer

10 months agoMerge pull request #16234 from chiragshah6/fdev2
Donatas Abraitis [Thu, 20 Jun 2024 05:03:42 +0000 (08:03 +0300)]
Merge pull request #16234 from chiragshah6/fdev2

bgpd: backpressure - fix evpn route sync to zebra

10 months agodoc: Document the usage of --enable-undefined-sanitizer
Donald Sharp [Wed, 19 Jun 2024 12:01:16 +0000 (08:01 -0400)]
doc: Document the usage of --enable-undefined-sanitizer

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
10 months agoMerge pull request #16224 from donaldsharp/zebra_dplane_event_loop_starvation
Donatas Abraitis [Wed, 19 Jun 2024 07:22:36 +0000 (10:22 +0300)]
Merge pull request #16224 from donaldsharp/zebra_dplane_event_loop_starvation

zebra: Prevent starvation in dplane_thread_loop

10 months agoMerge pull request #16223 from donaldsharp/bgp_vrf_name
Donatas Abraitis [Wed, 19 Jun 2024 07:22:16 +0000 (10:22 +0300)]
Merge pull request #16223 from donaldsharp/bgp_vrf_name

bgpd: Convert over to using vrf name instead of id

10 months agobgpd: backpressure - fix evpn route sync to zebra
Chirag Shah [Mon, 17 Jun 2024 20:58:03 +0000 (13:58 -0700)]
bgpd: backpressure - fix evpn route sync to zebra

In scaled EVPN + ipv4/ipv6 uni route sync to zebra,
some of the ipv4/ipv6 routes skipped reinstallation
due to incorrect local variable's stale value.

Once the local variable value reset in each loop
iteration all skipped routes synced to zebra properly.

Ticket: #3948828

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
Signed-off-by: Chirag Shah <chirag@nvidia.com>
10 months agobgpd: Convert over to using vrf name instead of id
Donald Sharp [Fri, 14 Jun 2024 15:32:06 +0000 (11:32 -0400)]
bgpd: Convert over to using vrf name instead of id

Use the name for when putting out debugs in bgp_zebra.c.
Additionally add an evpn flag for announce_route_actual.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
10 months agoMerge pull request #16227 from y-bharath14/srib-topotest-e
Donald Sharp [Tue, 18 Jun 2024 19:52:38 +0000 (15:52 -0400)]
Merge pull request #16227 from y-bharath14/srib-topotest-e

tests: Avoid importing unused modules

10 months agoMerge pull request #16237 from pguibert6WIND/json_ttable_caml_format
Donald Sharp [Tue, 18 Jun 2024 19:26:00 +0000 (15:26 -0400)]
Merge pull request #16237 from pguibert6WIND/json_ttable_caml_format

lib: add json API to dump and override row naming convention

10 months agoMerge pull request #15604 from cscarpitta/srv6-sid-manager
Russ White [Tue, 18 Jun 2024 16:16:24 +0000 (12:16 -0400)]
Merge pull request #15604 from cscarpitta/srv6-sid-manager

Add support for SRv6 SID Manager

10 months agoMerge pull request #16230 from zhou-run/202406171103
Russ White [Tue, 18 Jun 2024 15:20:13 +0000 (11:20 -0400)]
Merge pull request #16230 from zhou-run/202406171103

isisd: After the router switches IS-IS type several times, the neighbor adjacency cannot be established.

10 months agoMerge pull request #16236 from opensourcerouting/fix/recursive_weighted_ecmp
Russ White [Tue, 18 Jun 2024 15:14:00 +0000 (11:14 -0400)]
Merge pull request #16236 from opensourcerouting/fix/recursive_weighted_ecmp

zebra: Set the weight for non-recursive next-hop

10 months agoMerge pull request #16153 from pguibert6WIND/bgp_recursive_duplicate
Russ White [Tue, 18 Jun 2024 15:00:41 +0000 (11:00 -0400)]
Merge pull request #16153 from pguibert6WIND/bgp_recursive_duplicate

bgpd: fix do not skip paths with same nexthop

10 months agoMerge pull request #16172 from LabNConsulting/dleroy/nhrpd-auth-support
Russ White [Tue, 18 Jun 2024 14:04:24 +0000 (10:04 -0400)]
Merge pull request #16172 from LabNConsulting/dleroy/nhrpd-auth-support

nhrpd: add cisco-authentication password support

10 months agoMerge pull request #16179 from pguibert6WIND/isis_psid_and_backup
Russ White [Tue, 18 Jun 2024 13:58:47 +0000 (09:58 -0400)]
Merge pull request #16179 from pguibert6WIND/isis_psid_and_backup

isisd: fix 'show isis route prefix-sid backup' command

10 months agoMerge pull request #16194 from opensourcerouting/fix/bfd_profile_shutdown
Russ White [Tue, 18 Jun 2024 13:57:00 +0000 (09:57 -0400)]
Merge pull request #16194 from opensourcerouting/fix/bfd_profile_shutdown

bgpd: Do not start BGP session if BFD profile is in shutdown state

10 months agoMerge pull request #16195 from opensourcerouting/fix/drop_recent_confdate
Russ White [Tue, 18 Jun 2024 13:56:19 +0000 (09:56 -0400)]
Merge pull request #16195 from opensourcerouting/fix/drop_recent_confdate

ospfd: Drop `interfaceIp` from `show ip ospf neigh json`

10 months agolib: add json API to dump and override row naming convention
Philippe Guibert [Tue, 18 Jun 2024 10:11:44 +0000 (12:11 +0200)]
lib: add json API to dump and override row naming convention

The following table is not compliant with caml format when displayed in
json:

>                 ttable_add_row(
>                         tt,
>                         "Vertex|Type|Metric|Next-Hop|Interface|Parent");
>
>                 ttable_json(tt, "ssdsss");

output observed:

> [..]
>        {
>          "Vertex":"r1",
>          "Type":"",
>          "Metric":0,
>          "Next-Hop":"",
>          "Interface":"",
>          "Parent":""
>        }

output expected:

> [..]
>        {
>          "vertex":"r1",
>          "type":"",
>          "metric":0,
>          "nextHop":"",
>          "interface":"",
>          "parent":""
>        }

Override the ttable_json() function with a new function which has an
extra paramter: this parameter will redefine the initial row value for
json:

> ttable_json_with_json_text(tt,
> "vertex|type|metric|nextHop|interface|parent");

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
10 months agotests: Check if recursive weighted ECMP works
Donatas Abraitis [Tue, 18 Jun 2024 09:16:54 +0000 (12:16 +0300)]
tests: Check if recursive weighted ECMP works

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
10 months agozebra: Set the weight for non-recursive next-hop
Donatas Abraitis [Tue, 18 Jun 2024 09:07:23 +0000 (12:07 +0300)]
zebra: Set the weight for non-recursive next-hop

If using weighted ECMP, the weight for non-recursive next-hop should be
inherited from recursive next-hop.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
10 months agolib: Get the weight from Zebra
Donatas Abraitis [Tue, 18 Jun 2024 09:06:46 +0000 (12:06 +0300)]
lib: Get the weight from Zebra

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
10 months agozebra, lib: add locator name in sid notify messages
Philippe Guibert [Sat, 8 Jun 2024 05:15:47 +0000 (07:15 +0200)]
zebra, lib: add locator name in sid notify messages

In the near future, some daemons may only register SIDs. This may be
the case for the pathd daemon when creating SRv6 binding SIDs.

When a locator is getting deleted at ZEBRA level, the daemon may have
an easy way to find out the SIds to unregister to.

This commit proposes to add the locator name to the SID_SRV6_NOTIFY
message whenever possible. Only case when an allocation failure happens,
the locator will not be present. In all other places, the notify API
at procol levels has the locator name extra-parameter.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agotests: Avoid importing unused modules
Y Bharath [Sat, 15 Jun 2024 17:06:32 +0000 (22:36 +0530)]
tests: Avoid importing unused modules

Signed-off-by: y-bharath14 <y.bharath@samsung.com>
10 months agoisisd: After the router switches IS-IS type several times, the neighbor adjacency...
zhou-run [Mon, 17 Jun 2024 08:45:09 +0000 (16:45 +0800)]
isisd: After the router switches IS-IS type several times, the neighbor adjacency cannot be established.

1. Router A is configured with "is-type level-1-2", while Router B is configured with "is-type level-1". Only level 1 neighbor entries are present on Router A.
2. After configuring Router B with "is-type level-2-only", both level 1 and level 2 neighbor entries exist on Router A. The state of these entries is UP, and the level 1 neighbor entry is currently aging.
3. Before the level 1 neighbor entry on Router A ages out, configuring Router B with "is-type level-1", both level 1 and level 2 neighbor entries exist on Router A. The level 2 neighbor entry is UP and will age out normally. However, the level 1 neighbor entry remains in the Initializing state, preventing the establishment of level 1 neighbor adjacency between Router A and Router B.

When the adjacency type of the link is switched in function isis_circuit_is_type_set, the function circuit_resign_level() is called to delete the old level's circuit->u.bc.lan_neighs linked list. If the old level is not level-1-2, the function circuit_commence_level() is called to create a new level's circuit->u.bc.lan_neighs linked list, but neither of these functions handle the circuit->u.bc.adjdb linked list. This leads to a situation where upon receiving hello packets again before the circuit->u.bc.adjdb linked list entries age out, the circuit->u.bc.lan_neighs linked list is not constructed based on the circuit->u.bc.adjdb linked list. As a result, the hello packets sent will consistently lack an SNPA, causing the neighbor to remain unable to establish an adjacency upon receiving the hello packets.

Signed-off-by: zhou-run <166502045+zhou-run@users.noreply.github.com>
10 months agoMerge pull request #16225 from anlancs/doc/ldpd-fix-one-session-cmd
Renato Westphal [Sat, 15 Jun 2024 12:07:05 +0000 (09:07 -0300)]
Merge pull request #16225 from anlancs/doc/ldpd-fix-one-session-cmd

doc: fix one ldp neighbor command

10 months agodoc: fix one ldp neighbor command
anlan_cs [Sat, 15 Jun 2024 05:56:25 +0000 (13:56 +0800)]
doc: fix one ldp neighbor command

Signed-off-by: anlan_cs <anlan_cs@tom.com>
10 months agozebra: Prevent starvation in dplane_thread_loop
Donald Sharp [Fri, 14 Jun 2024 17:36:51 +0000 (13:36 -0400)]
zebra: Prevent starvation in dplane_thread_loop

When removing a large number of routes, the linux kernel can take the
cpu for an extended amount of time, leaving a situation where FRR
detects a starvation event.

r1# sharp install routes 10.0.0.0 nexthop 192.168.44.33 1000000 repeat 10
2024-06-14 12:55:49.365 [NTFY] sharpd: [M7Q4P-46WDR] vty[5]@# sharp install routes 10.0.0.0 nexthop 192.168.44.33 1000000 repeat 10
2024-06-14 12:55:49.365 [DEBG] sharpd: [YP4TQ-01TYK] Inserting 1000000 routes
2024-06-14 12:55:57.256 [DEBG] sharpd: [TPHKD-3NYSB] Installed All Items 7.890085
2024-06-14 12:55:57.256 [DEBG] sharpd: [YJ486-NX5R1] Removing 1000000 routes
2024-06-14 12:56:07.802 [WARN] zebra: [QH9AB-Y4XMZ][EC 100663314] STARVATION: task dplane_thread_loop (634377bc8f9e) ran for 7078ms (cpu time 220ms)
2024-06-14 12:56:25.039 [DEBG] sharpd: [WTN53-GK9Y5] Removed all Items 27.783668
2024-06-14 12:56:25.039 [DEBG] sharpd: [YP4TQ-01TYK] Inserting 1000000 routes
2024-06-14 12:56:32.783 [DEBG] sharpd: [TPHKD-3NYSB] Installed All Items 7.743524
2024-06-14 12:56:32.783 [DEBG] sharpd: [YJ486-NX5R1] Removing 1000000 routes
2024-06-14 12:56:41.447 [WARN] zebra: [QH9AB-Y4XMZ][EC 100663314] STARVATION: task dplane_thread_loop (634377bc8f9e) ran for 5175ms (cpu time 179ms)

Let's modify the loop in dplane_thread_loop such that after a provider
has been run, check to see if the event should yield, if so, stop
and reschedule this for the future.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
10 months agoMerge pull request #16221 from donaldsharp/atomic_surprise
Jafar Al-Gharaibeh [Fri, 14 Jun 2024 16:45:47 +0000 (11:45 -0500)]
Merge pull request #16221 from donaldsharp/atomic_surprise

zebra: Use built in data structure counter

10 months agoMerge pull request #16202 from y-bharath14/srib-topotest-d
Donatas Abraitis [Fri, 14 Jun 2024 07:25:25 +0000 (10:25 +0300)]
Merge pull request #16202 from y-bharath14/srib-topotest-d

tests: suppress unused variables at topotests

10 months agoisisd: fix 'show isis route prefix-sid backup' command
Philippe Guibert [Thu, 6 Jun 2024 13:18:48 +0000 (15:18 +0200)]
isisd: fix 'show isis route prefix-sid backup' command

It is not possible to dump both backup and prefix-sid
information. Fix this by authorising it.

> rt1# show isis route prefix-sid backup
> Area 1:
> IS-IS paths to level-1 routers that speak IP
> Vertex               Type         Metric Next-Hop             Interface Parent
> rt1
> 10.12.0.0/24         IP internal  0                                     rt1(4)
> 10.13.0.0/24         IP internal  0                                     rt1(4)
> 1.1.1.1/32           IP internal  0                                     rt1(4)
> rt2                  TE-IS        10     rt2                  eth-rt2   rt1(4)
> rt3                  TE-IS        10     rt3                  eth-rt3   rt1(4)
> 10.12.0.0/24         IP TE        20     rt2                  eth-rt2   rt2(4)
> 10.23.0.0/24         IP TE        20     rt2                  eth-rt2   rt2(4)
>                                          rt3                  eth-rt3   rt3(4)
> 2.2.2.2/32           IP TE        20     rt2                  eth-rt2   rt2(4)
> 10.13.0.0/24         IP TE        20     rt3                  eth-rt3   rt3(4)
> 3.3.3.3/32           IP TE        20     rt3                  eth-rt3   rt3(4)
>
> IS-IS L1 IPv4 routing table:
>
> IS-IS paths to level-1 routers that speak IPv6
> Vertex               Type         Metric Next-Hop             Interface Parent
> rt1
> 2001:db8:1000::1/128 IP6 internal 0                                     rt1(4)
> rt2                  TE-IS        10     rt2                  eth-rt2   rt1(4)
> rt3                  TE-IS        10     rt3                  eth-rt3   rt1(4)
> 2001:db8:1000::2/128 IP6 internal 20     rt2                  eth-rt2   rt2(4)
> 2001:db8:1000::3/128 IP6 internal 20     rt3                  eth-rt3   rt3(4)
>
> IS-IS L1 IPv6 routing table:
>

Fixes: d47d6089e06c ("isisd: refactor handling of SR Prefix-SIDs")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
10 months agozebra: Use built in data structure counter
Donald Sharp [Thu, 13 Jun 2024 19:30:00 +0000 (15:30 -0400)]
zebra: Use built in data structure counter

Instead of keeping a counter that is independent
of the queue's data structure.  Just use the queue's
built-in counter.  Ensure that it's pthread safe by
keeping it wrapped inside the mutex for adding/deleting
to the queue.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
10 months agoMerge pull request #16188 from anlancs/isisd/fix-metric-style
Olivier Dugeon [Thu, 13 Jun 2024 13:27:21 +0000 (15:27 +0200)]
Merge pull request #16188 from anlancs/isisd/fix-metric-style

yang: fix wrong check for isis metric style

10 months agozebra: fix sid allocation should be different with 2 isis instances
Philippe Guibert [Tue, 11 Jun 2024 16:14:58 +0000 (18:14 +0200)]
zebra: fix sid allocation should be different with 2 isis instances

With 2 ISIS SRv6 instances, the second ISIS instance always gets
the same End SID as the first one.

> router isis 1
> segment-routing srv6
> locator loc1
> exit
> exit
> router isis 2
> segment-routing srv6
> locator loc2
> end
> segment-routing
> srv6
> locators
> locator loc1
> prefix 2001::1/64
> exit
> locator loc2
> prefix 3001::1/64
>

output:
> 2024/06/11 17:30:15 ISIS: [N6PCR-FQ5ZA] SRv6 locator (locator loc1, prefix 2001::1/64) set for IS-IS area 1
> 2024/06/11 17:30:15 ISIS: [V4RBG-TYW5S] Requesting SRv6 SIDs for IS-IS area 1
> 2024/06/11 17:30:15 ISIS: [ZRHYM-6RMYK] isis_zebra_srv6_sid_notify: received SRv6 SID notify: ctx End USP sid_value 2001::1 sid_func 0 note ZAPI_SRV6_SID_ALLOCATED
> [..]
> 2024/06/11 17:36:49 ISIS: [N6PCR-FQ5ZA] SRv6 locator (locator loc2, prefix 3001::1/64) set for IS-IS area 2
> 2024/06/11 17:36:49 ISIS: [V4RBG-TYW5S] Requesting SRv6 SIDs for IS-IS area 2
> 2024/06/11 17:36:49 ISIS: [ZRHYM-6RMYK] isis_zebra_srv6_sid_notify: received SRv6 SID notify: ctx End USP sid_value 2001::1 sid_func 0 note ZAPI_SRV6_SID_ALLOCATED

Actually, at the second request, ZEBRA always gives an existing dynamic
SID of the first available locator, because the locator name is never
checked.

> 2024/06/11 17:36:49 ZEBRA: [XMBTQ-GE6EY] get_srv6_sid: received SRv6 SID alloc request: SID ctx End USP ((null)), mode=dynamic
> 2024/06/11 17:36:49 ZEBRA: [R61Q3-QWR23] get_srv6_sid_dynamic: returning existing SID End USP 2001::1
> 2024/06/11 17:36:49 ZEBRA: [J1GMY-B6CAK] srv6_manager_get_sid_internal: got existing SRv6 SID for ctx End USP: sid_value=2001::1 (func=0) (proto=9, instance=0, sessionId=0), notify client

Fix this by checking the locator of the existing SID.

Fixes: b771bf8ce687 ("zebra: Add functions to alloc/release SRv6 SIDs")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
10 months agozebra: fix display explicit sid refused
Philippe Guibert [Fri, 7 Jun 2024 13:46:53 +0000 (15:46 +0200)]
zebra: fix display explicit sid refused

> 2024/06/07 15:09:43 ZEBRA: [MZYPC-GBDGR] srv6_manager_get_sid_internal: getting SRv6 SID for ctx End.DT4 vrf vrf1, sid_value=1003::4, locator_name=
> [..]
> 2024/06/07 15:09:43 ZEBRA: [QGJBT-YJ11W] zsend_srv6_sid_notify: notifying ZEBRA_SRV6_SID_NOTIFY ctx End.DT4 vrf vrf2, sid (null) note ZAPI_SRV6_SID_FAIL_ALLOC (proto=30, instance=0, sessionId=0)

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
10 months agozebra: fix display srv6 address only for explicit-sid
Philippe Guibert [Fri, 7 Jun 2024 13:46:20 +0000 (15:46 +0200)]
zebra: fix display srv6 address only for explicit-sid

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
10 months agozebra: Fix checkpatch warning
Carmine Scarpitta [Fri, 3 May 2024 17:31:56 +0000 (19:31 +0200)]
zebra: Fix checkpatch warning

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agodoc: Add documentation for SRv6 SID formats CLI
Carmine Scarpitta [Thu, 2 May 2024 15:08:15 +0000 (17:08 +0200)]
doc: Add documentation for SRv6 SID formats CLI

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agozebra: Notify all daemons about locator delete
Carmine Scarpitta [Thu, 2 May 2024 21:50:38 +0000 (23:50 +0200)]
zebra: Notify all daemons about locator delete

Currently, when a locator is deleted in zebra, zebra notifies only the
zclient that owns the locator.

With the introduction of SID Manager, the locator is no longer owned by
any client. Instead, the locator is owned by Zebra, and clients can
allocate and release SIDs from the locator using the ZAPI
ZEBRA_SRV6_MANAGER_GET_SID and ZEBRA_SRV6_MANAGER_RELEASE_SID.

Therefore, when a locator is removed in Zebra, we need to notify all
daemons so that they can release/uninstall the SIDs allocated by that
locator.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agozebra: Notify daemons about SIDs
Carmine Scarpitta [Thu, 2 May 2024 11:39:49 +0000 (13:39 +0200)]
zebra: Notify daemons about SIDs

Send asynchronous notifications to zclients when an SRv6 SID is
allocated/released and when a SID alloc/release operation fails.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agolib: Add ZAPI command `ZEBRA_SRV6_SID_NOTIFY`
Carmine Scarpitta [Mon, 6 May 2024 15:53:18 +0000 (17:53 +0200)]
lib: Add ZAPI command `ZEBRA_SRV6_SID_NOTIFY`

Add a new ZAPI command `ZEBRA_SRV6_SID_NOTIFY` used by zebra to send
asynchronous SRv6 SIDs notifications to zclients.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agozebra: Alloc/Release SIDs to daemons upon request
Carmine Scarpitta [Sat, 23 Mar 2024 16:25:39 +0000 (17:25 +0100)]
zebra: Alloc/Release SIDs to daemons upon request

Previous commits introduced two new ZAPI operations,
`ZEBRA_SRV6_MANAGER_GET_SRV6_SID` and
`ZEBRA_SRV6_MANAGER_RELEASE_SRV6_SID`. These operations allow a daemon
to interact with the SRv6 SID Manager to get and release an SRv6 SID,
respectively.

This commit extends the SID Manager by adding logic to process the
requests `ZEBRA_SRV6_MANAGER_GET_SRV6_SID` and
`ZEBRA_SRV6_MANAGER_RELEASE_SRV6_SID`, and allocate/release SIDs to
requesting daemons.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agozebra: Add functions to alloc/release SRv6 SIDs
Carmine Scarpitta [Sat, 23 Mar 2024 15:30:58 +0000 (16:30 +0100)]
zebra: Add functions to alloc/release SRv6 SIDs

Add functions to allocate/release SRv6 SIDs. SIDs can be allocated
either explicitly (allocate a specific SID) or dynamically (allocate any
available SID).

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agozebra: Repond to `GET_LOCATOR` ZAPI request
Carmine Scarpitta [Sat, 23 Mar 2024 14:50:24 +0000 (15:50 +0100)]
zebra: Repond to `GET_LOCATOR` ZAPI request

The previous commits introduced a new operation,
`ZEBRA_SRV6_MANAGER_GET_LOCATOR`, allowing a daemon to request
information about a specific SRv6 locator from the SRv6 SID Manager.

This commit extends the SID Manager to respond to a
`ZEBRA_SRV6_MANAGER_GET_LOCATOR` request and provide the requested
locator information.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agolib: Add missing info to locator encode/decode
Carmine Scarpitta [Mon, 6 May 2024 15:46:44 +0000 (17:46 +0200)]
lib: Add missing info to locator encode/decode

Include block/node/function/argument lengthi when
encoding/decoding an SRv6 locator.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agolib: Add ZAPI operations to get/release SRv6 SIDs
Carmine Scarpitta [Sat, 23 Mar 2024 17:31:12 +0000 (18:31 +0100)]
lib: Add ZAPI operations to get/release SRv6 SIDs

Add two new ZAPI operations: `ZEBRA_SRV6_MANAGER_GET_SRV6_SID` and
`ZEBRA_SRV6_MANAGER_RELEASE_SRV6_SID`. These APIs allow a daemon to get and
release an SRv6 SID, respectively.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agolib: Add ZAPI operation get SRv6 locator
Carmine Scarpitta [Sat, 23 Mar 2024 14:49:43 +0000 (15:49 +0100)]
lib: Add ZAPI operation get SRv6 locator

Add a new ZAPI operation, ZEBRA_SRV6_MANAGER_GET_LOCATOR, which allows a
daemon to request information about a specific locator from the SRv6 SID
Manager.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agozebra: Add support for SRv6 SIDs
Carmine Scarpitta [Sat, 23 Mar 2024 12:42:19 +0000 (13:42 +0100)]
zebra: Add support for SRv6 SIDs

Add a data structure to represent an SRv6 SID context and the related
management functions (allocate/free).

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agolib: Add support for SRv6 SIDs
Carmine Scarpitta [Mon, 6 May 2024 15:44:18 +0000 (17:44 +0200)]
lib: Add support for SRv6 SIDs

Add a data structure to represent an SRv6 SID context and the related
management functions (allocate/free).

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agozebra: CLI to specify format of an SRv6 locator
Carmine Scarpitta [Fri, 22 Mar 2024 18:31:01 +0000 (19:31 +0100)]
zebra: CLI to specify format of an SRv6 locator

Add the CLI to choose the SID format of a locator. When the SID format
of a locator is changed, the SIDs allocated from that locator might no
longer be valid (for example, because the new format might involve a
different SID allocation schema). In such a case, it is necessary to
notify all the zclients so that they can withdraw/uninstall the old SIDs
that use the previous format and allocate/install/advertise the new SIDs
based on the new format.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agolib: Add function to copy an SRv6 locator
Carmine Scarpitta [Wed, 8 May 2024 14:41:05 +0000 (16:41 +0200)]
lib: Add function to copy an SRv6 locator

Add a new function to copy an SRv6 locator.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agozebra: Add support for SRv6 SID blocks
Carmine Scarpitta [Fri, 22 Mar 2024 17:19:36 +0000 (18:19 +0100)]
zebra: Add support for SRv6 SID blocks

An SRv6 block is an IPv6 prefix from which SIDs are allocated. This
commit adds support for SRv6 SID blocks. Specifically, it adds a data
structure to store information about an SRv6 block (e.g., its occupancy
status, which SIDs have been allocated and which are available, which
SID format is used for that block, etc.). It also adds some functions to
manage the block (allocate / free / lookup).

These functions will be used in the next commits to support the
allocation of SIDs from a block in the SID Manager.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agozebra: CLI to override default SID format config
Carmine Scarpitta [Tue, 26 Mar 2024 07:53:55 +0000 (08:53 +0100)]
zebra: CLI to override default SID format config

Add CLI commands to support overriding default configuration of the SID
format.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agovtysh: CLI to override default SID format config
Carmine Scarpitta [Tue, 26 Mar 2024 07:53:17 +0000 (08:53 +0100)]
vtysh: CLI to override default SID format config

Add CLI commands to support overriding default configuration of the SID
format.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agolib: Add CLI nodes to support SRv6 SID format
Carmine Scarpitta [Fri, 22 Mar 2024 14:56:15 +0000 (15:56 +0100)]
lib: Add CLI nodes to support SRv6 SID format

Add CLI commands to support overriding default configuration of the SID
format.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agozebra: Add support for SRv6 SID formats
Carmine Scarpitta [Thu, 6 Jun 2024 15:23:11 +0000 (17:23 +0200)]
zebra: Add support for SRv6 SID formats

Add functionalities to manage SRv6 SID formats (register / unregister /
lookup) and create two SID formats upon SRv6 Manager initialization:
`uncompressed-f4024` and `usid-f3216`.

In future commits, we will add the CLI to allow the user to choose
between the two formats.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agolib: Add support for SRv6 SID formats
Carmine Scarpitta [Fri, 22 Mar 2024 14:13:00 +0000 (15:13 +0100)]
lib: Add support for SRv6 SID formats

Add functionalities to manage SRv6 SID formats (allocate / free).

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agoMerge pull request #16184 from LabNConsulting/chopps/fe-notify-select
Jafar Al-Gharaibeh [Thu, 13 Jun 2024 05:20:09 +0000 (00:20 -0500)]
Merge pull request #16184 from LabNConsulting/chopps/fe-notify-select

mgmtd: add notification selection to front-end API

10 months agobuild: FRR 10.2 development version frr-10.2-dev
Jafar Al-Gharaibeh [Wed, 12 Jun 2024 17:03:21 +0000 (12:03 -0500)]
build: FRR 10.2 development version

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
10 months agoospfd: Fix memory leak after cleaning cleaning up interfaceIp JSON field
Donatas Abraitis [Wed, 12 Jun 2024 13:28:38 +0000 (16:28 +0300)]
ospfd: Fix memory leak after cleaning cleaning up interfaceIp JSON field

```
=================================================================
==6717==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 1008 byte(s) in 14 object(s) allocated from:
    0 0x7f9ea0dc7d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    1 0x7f9ea034d51f in json_object_new_object (/lib/x86_64-linux-gnu/libjson-c.so.3+0x351f)
    2 0x564b56d0fed6 in show_ip_ospf_interface_common ospfd/ospf_vty.c:4011
    3 0x564b56d1068c in show_ip_ospf_interface ospfd/ospf_vty.c:4285
    4 0x7f9ea06fe1c0 in cmd_execute_command_real lib/command.c:1002
    5 0x7f9ea06fe684 in cmd_execute_command lib/command.c:1060
    6 0x7f9ea06feb03 in cmd_execute lib/command.c:1227
    7 0x7f9ea08415b2 in vty_command lib/vty.c:616
    8 0x7f9ea0841a5d in vty_execute lib/vty.c:1379
    9 0x7f9ea084b367 in vtysh_read lib/vty.c:2374
    10 0x7f9ea08350cd in event_call lib/event.c:2011
    11 0x7f9ea0764386 in frr_run lib/libfrr.c:1217
    12 0x564b56c25b18 in main ospfd/ospf_main.c:295
    13 0x7f9e9fd5bc86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Indirect leak of 7168 byte(s) in 14 object(s) allocated from:
    0 0x7f9ea0dc7d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    1 0x7f9ea0350fa4 in lh_table_new (/lib/x86_64-linux-gnu/libjson-c.so.3+0x6fa4)

Indirect leak of 1232 byte(s) in 14 object(s) allocated from:
    0 0x7f9ea0dc7d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    1 0x7f9ea0350f82 in lh_table_new (/lib/x86_64-linux-gnu/libjson-c.so.3+0x6f82)

SUMMARY: AddressSanitizer: 9408 byte(s) leaked in 42 allocation(s).
***********************************************************************************
```

Fixes: e24ff4c275f0729f75be9f68d08be80ac1e0ec56 ("ospfd: Drop `interfaceIp` from `show ip ospf neigh json")
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
10 months agoMerge pull request #16191 from pguibert6WIND/srte_color_not_copied base_10.1
Donatas Abraitis [Wed, 12 Jun 2024 12:39:10 +0000 (15:39 +0300)]
Merge pull request #16191 from pguibert6WIND/srte_color_not_copied

lib: fix copy srte_color from zapi_nexthop structure

10 months agotests: supress unused variables at topotests
Y Bharath [Wed, 12 Jun 2024 08:26:34 +0000 (13:56 +0530)]
tests: supress unused variables at topotests

For code maintainability, suppressed unused variables with "_"

Signed-off-by: y-bharath14 <y.bharath@samsung.com>
10 months agobgpd: Do not start BGP session if BFD profile is in shutdown state
Donatas Abraitis [Wed, 12 Jun 2024 05:39:48 +0000 (08:39 +0300)]
bgpd: Do not start BGP session if BFD profile is in shutdown state

If we do:

```
bfd
 profile foo
  shutdown
```

The session is dropped, but immediately established again because we don't
have a proper check on BFD.

If BFD is administratively shutdown, ignore starting the session.

Fixes: https://github.com/FRRouting/frr/issues/16186
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
10 months agoMerge pull request #16190 from trots/master
Russ White [Tue, 11 Jun 2024 18:44:14 +0000 (14:44 -0400)]
Merge pull request #16190 from trots/master

doc: Add reloading script into Python dependency section

10 months agoMerge pull request #16050 from rgirada/ospfv3_helper
Russ White [Tue, 11 Jun 2024 15:48:05 +0000 (11:48 -0400)]
Merge pull request #16050 from rgirada/ospfv3_helper

ospf6d: Handling Topo Change in GR-HELPER mode for max-age lsas

10 months agodoc: Add reloading script into Python dependency section
Alexander Trotsenko [Sat, 8 Jun 2024 22:10:02 +0000 (01:10 +0300)]
doc: Add reloading script into Python dependency section

Signed-off-by: Alexander Trotsenko <trotsenko93@mail.ru>
10 months agoMerge pull request #16193 from opensourcerouting/fix/ecommunity_linkbw_present_overrun
Russ White [Tue, 11 Jun 2024 15:21:42 +0000 (11:21 -0400)]
Merge pull request #16193 from opensourcerouting/fix/ecommunity_linkbw_present_overrun

bgpd: Check against extended community unit size for link bandwidth

10 months agotests: add native session-req/reply support to fe_client.py
Christian Hopps [Tue, 11 Jun 2024 14:26:08 +0000 (10:26 -0400)]
tests: add native session-req/reply support to fe_client.py

Use this to test new native message format for creating sessions.

Signed-off-by: Christian Hopps <chopps@labn.net>
10 months agomgmtd: add native session-req (create/delete) messages
Christian Hopps [Tue, 11 Jun 2024 09:08:49 +0000 (05:08 -0400)]
mgmtd: add native session-req (create/delete) messages

This addition allows for a limited native-message-only front-end
interaction.

Signed-off-by: Christian Hopps <chopps@labn.net>
10 months agoMerge pull request #16187 from opensourcerouting/isis_tilfa_topo_rework
Donald Sharp [Tue, 11 Jun 2024 13:49:35 +0000 (09:49 -0400)]
Merge pull request #16187 from opensourcerouting/isis_tilfa_topo_rework

isis_tilfa_topo1 rework

10 months agobgpd: Keep last notification's state about hard reset
Donatas Abraitis [Tue, 11 Jun 2024 08:41:53 +0000 (11:41 +0300)]
bgpd: Keep last notification's state about hard reset

When we receive a hard-reset notification, we always show it if it was a hard,
or not.

For sending side, we missed that. Let's display it too.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
10 months agotests: Check if BFD notification is sent and session remains in down state
Donatas Abraitis [Tue, 11 Jun 2024 08:40:40 +0000 (11:40 +0300)]
tests: Check if BFD notification is sent and session remains in down state

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
10 months agotests: Drop `interfaceIp` from OSPF tests
Donatas Abraitis [Tue, 11 Jun 2024 12:48:23 +0000 (15:48 +0300)]
tests: Drop `interfaceIp` from OSPF tests

Deprecated.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
10 months agoyang: fix wrong check for isis metric style
anlan_cs [Sat, 8 Jun 2024 15:38:05 +0000 (23:38 +0800)]
yang: fix wrong check for isis metric style

Before:
```
anlan(config)# route isis ix
anlan(config-router)# metric-style transition
...
anlan(config-if)# isis metric 200
% Configuration failed.

Error type: validation
Error description: YANG error(s):
 Path: Data location "/frr-interface:lib/interface[name='x']/frr-isisd:isis/metric/level-1".
 Error: Must condition ". < 64 or /frr-isisd:isis/instance[area-tag = current()/../../area-tag]/metric-style = 'wide' or not(/frr-isisd:isis/instance[area-tag = current()/../../area-tag]/metric-style)" not satisfied.
 Path: Data location "/frr-interface:lib/interface[name='x']/frr-isisd:isis/metric/level-2".
 Error: Must condition ". < 64 or /frr-isisd:isis/instance[area-tag = current()/../../area-tag]/metric-style = 'wide' or not(/frr-isisd:isis/instance[area-tag = current()/../../area-tag]/metric-style)" not satisfied
```

After:
```
anlan(config)# route isis ix
anlan(config-router)# metric-style transition
...
anlan(config-if)# isis metric 200
anlan(config-if)#
```

Signed-off-by: anlan_cs <anlan_cs@tom.com>
10 months agoospfd: Drop `interfaceIp` from `show ip ospf neigh json`
Donatas Abraitis [Tue, 11 Jun 2024 08:59:37 +0000 (11:59 +0300)]
ospfd: Drop `interfaceIp` from `show ip ospf neigh json`

Deprecated. Now it's under interface field directly:

```
{
  "interfaces":{
    "enp3s0":{
      "ifUp":true,
      "ifIndex":2,
      "mtuBytes":1500,
      "bandwidthMbit":100,
      "ifFlags":"<UP,LOWER_UP,BROADCAST,RUNNING,MULTICAST>",
      "ospfEnabled":true,
      "ipAddress":"192.168.10.19",
      "ipAddressPrefixlen":24,
      "ospfIfType":"Broadcast",
      "localIfUsed":"192.168.10.255",
      "area":"0.0.0.0",
      "routerId":"100.100.100.100",
      "networkType":"POINTOPOINT",
      "cost":1000,
      "transmitDelaySecs":1,
      "state":"Point-To-Point",
      "priority":1,
      "opaqueCapable":true,
      "mcastMemberOspfAllRouters":true,
      "timerMsecs":10000,
      "timerDeadSecs":40,
      "timerWaitSecs":40,
      "timerRetransmitSecs":5,
      "timerHelloInMsecs":2924,
      "nbrCount":0,
      "nbrAdjacentCount":0,
      "grHelloDelaySecs":10,
      "prefixSuppression":false,
      "nbrFilterPrefixList":"N\/A"
    }
  }
}
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
10 months agotopotests: add bgp duplicate nexthop test
Philippe Guibert [Tue, 4 Jun 2024 16:50:26 +0000 (18:50 +0200)]
topotests: add bgp duplicate nexthop test

Add a topotest that ensures that when addpath is enabled and two
paths with same nexthop are received, they are sent to ZEBRA which
detects 'duplicate nexthop'.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
10 months agotopotests: add API to detect if iproute2 is json capable
Philippe Guibert [Mon, 10 Jun 2024 06:38:22 +0000 (08:38 +0200)]
topotests: add API to detect if iproute2 is json capable

Some tests may want to use the json facility of iproute2 to
dump some results.
Add an internal API in lib/topotest.py that tells whether iproute2
is json capable or not.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
10 months agobgpd: fix do not skip paths with same nexthop
Philippe Guibert [Thu, 30 May 2024 13:47:11 +0000 (15:47 +0200)]
bgpd: fix do not skip paths with same nexthop

Under a setup where two BGP prefixes are available from multiple sources,
if one of the two prefixes is recursive over the other BGP prefix, then
it will not be considered as multipath. The below output shows the two
prefixes 192.0.2.24/32 and 192.0.2.21/32. The 192.0.2.[5,6,8] are the
known IP addresses visible from the IGP.

> # show bgp ipv4 192.0.2.24/32
> *>i 192.0.2.24/32    192.0.2.21               0    100      0 i
> * i                  192.0.2.21               0    100      0 i
> * i                  192.0.2.21               0    100      0 i
> # show bgp ipv4 192.0.2.21/32
>  *>i 192.0.2.21/32    192.0.2.5                0    100      0 i
>  *=i                  192.0.2.6                0    100      0 i
>  *=i                  192.0.2.8                0    100      0 i

The bgp best selection algorithm refuses to consider the paths to
'192.0.2.24/32' as multipath, whereas the BGP paths which use the
BGP peer as nexthop are considered multipath.

> ... has the same nexthop as the bestpath, skip it ...

Previously, this condition has been added to prevent ZEBRA from
installing routes with same nexthop:

>     Here you can see the two paths with nexthop 210.2.2.2
>     superm-redxp-05# show ip route 2.23.24.192/28
>     Routing entry for 2.23.24.192/28
>       Known via "bgp", distance 20, metric 0, best
>       Last update 00:32:12 ago
>       * 210.2.2.2, via swp3
>       * 210.2.0.2, via swp1
>       * 210.2.1.2, via swp2
>       * 210.2.2.2, via swp3
> [..]

But today, ZEBRA knows how to handle it. When receiving incoming routes,
nexthop groups are used. At creation, duplicated nexthops are
identified, and will not be installed. The below output illustrate the
duplicate paths to 172.16.0.200 received by an other peer.

> r1# show ip route 172.18.1.100 nexthop-group
> Routing entry for 172.18.1.100/32
>   Known via "bgp", distance 200, metric 0, best
>   Last update 00:03:03 ago
>   Nexthop Group ID: 75757580
>     172.16.0.200 (recursive), weight 1
>   *   172.31.0.3, via r1-eth1, label 16055, weight 1
>   *   172.31.2.4, via r1-eth2, label 16055, weight 1
>   *   172.31.0.3, via r1-eth1, label 16006, weight 1
>   *   172.31.2.4, via r1-eth2, label 16006, weight 1
>   *   172.31.8.7, via r1-eth4, label 16008, weight 1
>     172.16.0.200 (duplicate nexthop removed) (recursive), weight 1
>       172.31.0.3, via r1-eth1 (duplicate nexthop removed), label 16055, weight 1
>       172.31.2.4, via r1-eth2 (duplicate nexthop removed), label 16055, weight 1
>       172.31.0.3, via r1-eth1 (duplicate nexthop removed), label 16006, weight 1
>       172.31.2.4, via r1-eth2 (duplicate nexthop removed), label 16006, weight 1
>       172.31.8.7, via r1-eth4 (duplicate nexthop removed), label 16008, weight 1

Fix this by proposing to let ZEBRA handle this duplicate decision.

Fixes: 7dc9d4e4e360 ("bgp may add multiple path entries with the same nexthop")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
10 months agobgpd: Check against extended community unit size for link bandwidth
Donatas Abraitis [Tue, 11 Jun 2024 07:03:17 +0000 (10:03 +0300)]
bgpd: Check against extended community unit size for link bandwidth

If we receive a malformed packets, this could lead ptr_get_be64() reading
the packets more than needed (heap overflow).

```
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
    0 0xaaaaaadf86ec in __asan_memcpy (/home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/.libs/bgpd+0x3586ec) (BuildId: 78123cd26ada92b8b59fc0d74d292ba70c9d2e01)
    1 0xaaaaaaeb60fc in ptr_get_be64 /home/ubuntu/frr-public/frr_public_private-libfuzzer/./lib/stream.h:377:2
    2 0xaaaaaaeb5b90 in ecommunity_linkbw_present /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_ecommunity.c:1895:10
    3 0xaaaaaae50f30 in bgp_attr_ext_communities /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_attr.c:2639:8
    4 0xaaaaaae49d58 in bgp_attr_parse /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_attr.c:3776:10
    5 0xaaaaab063260 in bgp_update_receive /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_packet.c:2371:20
    6 0xaaaaab05df00 in bgp_process_packet /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_packet.c:4063:11
    7 0xaaaaaae36110 in LLVMFuzzerTestOneInput /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_main.c:582:3
```

This is triggered when receiving such a packet (malformed):

```
(gdb) bt
0  ecommunity_linkbw_present (ecom=0x555556287990, bw=bw@entry=0x7fffffffda68)
    at bgpd/bgp_ecommunity.c:1802
1  0x000055555564fcac in bgp_attr_ext_communities (args=0x7fffffffd840) at bgpd/bgp_attr.c:2619
2  bgp_attr_parse (peer=peer@entry=0x55555628cdf0, attr=attr@entry=0x7fffffffd960, size=size@entry=20,
    mp_update=mp_update@entry=0x7fffffffd940, mp_withdraw=mp_withdraw@entry=0x7fffffffd950)
    at bgpd/bgp_attr.c:3755
3  0x00005555556aa655 in bgp_update_receive (connection=connection@entry=0x5555562aa030,
    peer=peer@entry=0x55555628cdf0, size=size@entry=41) at bgpd/bgp_packet.c:2324
4  0x00005555556afab7 in bgp_process_packet (thread=<optimized out>) at bgpd/bgp_packet.c:3897
5  0x00007ffff7ac2f73 in event_call (thread=thread@entry=0x7fffffffdc70) at lib/event.c:2011
6  0x00007ffff7a6fb90 in frr_run (master=0x555555bc7c90) at lib/libfrr.c:1212
7  0x00005555556457e1 in main (argc=<optimized out>, argv=<optimized out>) at bgpd/bgp_main.c:543
(gdb) p *ecom
$1 = {refcnt = 1, unit_size = 8 '\b', disable_ieee_floating = false, size = 2, val = 0x555556282150 "",
  str = 0x5555562a9c30 "UNK:0, 255 UNK:2, 6"}
```

Reported-by: Iggy Frankovic <iggyfran@amazon.com>
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
10 months agonhrpd: add cisco-authentication password support
Dave LeRoy [Wed, 5 Jun 2024 19:10:11 +0000 (12:10 -0700)]
nhrpd: add cisco-authentication password support

Taking over this development from https://github.com/FRRouting/frr/pull/14788

This commit addresses 4 issues found in the previous PR

1) FRR would accept messages from a spoke without authentication when FRR NHRP had auth configured.
2) The error indication was not being sent in network byte order
3) The debug print in nhrp_connection_authorized was not correctly printing the received password
4) The addresses portion of the mandatory part of the error indication was invalid on the wire (confirmed in wireshark)

Signed-off-by: Dave LeRoy <dleroy@labn.net>
Co-authored-by: Volodymyr Huti <volodymyr.huti@gmail.com>
10 months agonhrp: add `cisco-authentication` password support
Volodymyr Huti [Mon, 13 Nov 2023 20:47:31 +0000 (22:47 +0200)]
nhrp: add `cisco-authentication` password support

Implemented:
- handling 8 char long password, aka Cisco style.
- minimal error inidication routine
- test case, password change affects conection

Signed-off-by: Volodymyr Huti <v.huti@vyos.io>
10 months agoMerge pull request #16183 from LabNConsulting/chopps/notif-doc-update
Donatas Abraitis [Mon, 10 Jun 2024 19:25:10 +0000 (22:25 +0300)]
Merge pull request #16183 from LabNConsulting/chopps/notif-doc-update

mgmtd: add empty notif xpath map for completeness

10 months agotests: introduce method to update reference data in isis_tilfa_topo1
Renato Westphal [Fri, 7 Jun 2024 15:03:17 +0000 (12:03 -0300)]
tests: introduce method to update reference data in isis_tilfa_topo1

The isis_tilfa_topo1 topotest is comprehensive and contains a large
amount of reference data. One problem is that, when changes occur,
updating this reference data can be difficult.

To address this problem, this commit introduces a method to
automatically regenerate the reference data by setting the `REGEN_DATA`
environment variable.

Usage:
$ REGEN_DATA=true python3 ./test_isis_tilfa_topo1.py

When `REGEN_DATA` is set, the topotest regenerates reference data
from the current run instead of comparing against existing reference
data. Note that regenerated data must be manually verified for
correctness.

This commit also simplifies the reference data by replacing all diff
files with complete JSON snapshots.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
10 months agotests: rework isis_tilfa_topo1 to fix timing issues
Renato Westphal [Fri, 7 Jun 2024 13:41:38 +0000 (10:41 -0300)]
tests: rework isis_tilfa_topo1 to fix timing issues

In this topotest, steps 10-15 were added to test the IS-IS switchover
functionality. In short, two cases were tested: switchover after a
link down event and switchover after a BFD down event. Both cases
were tested in sequence on the same router, rt6. This involved the
following steps:
- Setting the SPF delay timer to 15 seconds
- Shutting down the eth-rt5 interface from the switch side
- Testing the post-switchover RIB and LIB (triggered by the link down
  event)
- Testing the post-SPF RIB and LIB
- Bringing the eth-rt5 interface back up
- Configuring a BFD session between rt6 and rt5
- Shutting down the eth-rt5 interface from the switch side once again
- Testing the post-switchover RIB and LIB (triggered by the BFD down
  event)
- Testing the post-SPF RIB and LIB

Since the time window to test the post-switchover RIB and LIB was too
narrow (10 seconds), these tests were having sporadic failures.

To resolve this problem, we can simplify the switchover test as follows:
- Setting the SPF delay timer to 60 seconds (not 15)
- Disabling "link-detect" on rt6's eth-rt5 interface
- Shutting down the eth-rt5 interface from the switch side
- On rt6, testing the post-switchover RIB and LIB (triggered by the
  BFD down event)
- On rt5, testing the post-switchover RIB and LIB (triggered by the
  link down event)

Notice how we can test both post-link-down and post-BFD-down switchover
cases simultaneously by having different "link-detect" configurations
on rt5 and rt6. Additionally, by using a larger SPF delay timer, the
time window to test the post-switchover RIB and LIB is much larger
and less prone to sporadic failures.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
10 months agolib: fix copy srte_color from zapi_nexthop structure
Philippe Guibert [Sun, 17 Dec 2023 20:04:31 +0000 (21:04 +0100)]
lib: fix copy srte_color from zapi_nexthop structure

When switching from nexthop to zapi_nexthop, the srte color
is copied. Do the same in reverse.

Fixes: 31f937fb43f4 ("lib, zebra: Add SR-TE policy infrastructure to zebra")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
10 months agoMerge pull request #16093 from louis-6wind/fix-show-route-memory
Donatas Abraitis [Mon, 10 Jun 2024 08:26:23 +0000 (11:26 +0300)]
Merge pull request #16093 from louis-6wind/fix-show-route-memory

zebra: fix Out Of Memory issue when displaying large route tables in JSON

10 months agoMerge pull request #16189 from LabNConsulting/chopps/triage-github-action
Donald Sharp [Sun, 9 Jun 2024 01:34:42 +0000 (21:34 -0400)]
Merge pull request #16189 from LabNConsulting/chopps/triage-github-action

10 months agoci: do apt-get update before installing required modules
Christian Hopps [Sat, 8 Jun 2024 19:37:47 +0000 (15:37 -0400)]
ci: do apt-get update before installing required modules

- Use `uname -r` to also install specific module versions since
  with github runners the running kernel can become out-dated with
  the deployed packages.

Signed-off-by: Christian Hopps <chopps@labn.net>
10 months agoMerge pull request #15900 from mikemallin/v6-vtep-lib-upstream
Donald Sharp [Fri, 7 Jun 2024 18:34:11 +0000 (14:34 -0400)]
Merge pull request #15900 from mikemallin/v6-vtep-lib-upstream

lib, bgpd, tests, zebra: prefix_sg changes for V6 VTEP

10 months agodoc: add some text on native message API and notif xpath array
Christian Hopps [Thu, 6 Jun 2024 23:49:40 +0000 (19:49 -0400)]
doc: add some text on native message API and notif xpath array

Signed-off-by: Christian Hopps <chopps@labn.net>
10 months agomgmtd: add empty notif xpath map for completeness
Christian Hopps [Thu, 6 Jun 2024 18:08:00 +0000 (14:08 -0400)]
mgmtd: add empty notif xpath map for completeness

New back-end clients may need to add notification static allocations so
we should have it available for those users, rather than requiring the
new user delve into the mgmtd infra and modify it themselves.

Signed-off-by: Christian Hopps <chopps@labn.net>
10 months agotests: check show route vrf all json output
Louis Scalbert [Mon, 27 May 2024 08:35:26 +0000 (10:35 +0200)]
tests: check show route vrf all json output

Check that "show ip route vrf XXX json" and the JSON at key "XXX" of
"show ip route vrf all json" gives the same output.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
10 months agozebra: fix show route memory consumption
Louis Scalbert [Fri, 24 May 2024 14:34:23 +0000 (16:34 +0200)]
zebra: fix show route memory consumption

When displaying a route table in JSON, a table JSON object is storing
all the prefix JSON objects containing the prefix information. This
results in excessive memory allocation for JSON objects, potentially
leading to an out-of-memory error on the machine with large routing
tables.

To Fix the memory consumption issue for the "show ip[v6] route [vrf XX]
json" command, display the prefixes one by one and free the memory of
each JSON object after it has been displayed.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
10 months agozebra: fix show route vrf all memory consumption
Louis Scalbert [Fri, 24 May 2024 15:06:59 +0000 (17:06 +0200)]
zebra: fix show route vrf all memory consumption

0e2fc3d67f ("vtysh, zebra: Fix malformed json output for multiple vrfs
in command 'show ip route vrf all json'") has been reverted in the
previous commit. Although the fix was correct, it was consuming too muca
memory when displaying large route tables.

A root JSON object was storing all the JSON objects containing the route
tables, each containing their respective prefixes in JSON objects. This
resulted in excessive memory allocation for JSON objects, potentially
leading to an out-of-memory error on the machine.

To Fix the memory consumption issue for the "show ip[v6] route vrf all
json" command, display the tables one by one and free the memory of each
JSON object after it has been displayed.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
10 months agolib: add helpers to print json keys
Louis Scalbert [Mon, 27 May 2024 08:04:14 +0000 (10:04 +0200)]
lib: add helpers to print json keys

Add helpers to print json keys in order to prepare the next commits.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>