Commit Graph

35723 Commits

Author SHA1 Message Date
Donatas Abraitis
dbf83cfd36 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>
2024-06-18 12:15:33 +03:00
Donatas Abraitis
83b4706f30 lib: Get the weight from Zebra
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-06-18 12:15:33 +03:00
Renato Westphal
045029e244
Merge pull request #16225 from anlancs/doc/ldpd-fix-one-session-cmd
doc: fix one ldp neighbor command
2024-06-15 09:07:05 -03:00
anlan_cs
accdf83c57 doc: fix one ldp neighbor command
Signed-off-by: anlan_cs <anlan_cs@tom.com>
2024-06-15 13:56:30 +08:00
Jafar Al-Gharaibeh
41776f81bc
Merge pull request #16221 from donaldsharp/atomic_surprise
zebra: Use built in data structure counter
2024-06-14 11:45:47 -05:00
Donatas Abraitis
e8ce036a7b
Merge pull request #16202 from y-bharath14/srib-topotest-d
tests: suppress unused variables at topotests
2024-06-14 10:25:25 +03:00
Donald Sharp
a23a9385a7 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>
2024-06-13 15:30:00 -04:00
Olivier Dugeon
7b59adcbcb
Merge pull request #16188 from anlancs/isisd/fix-metric-style
yang: fix wrong check for isis metric style
2024-06-13 15:27:21 +02:00
Jafar Al-Gharaibeh
2e02bd2366
Merge pull request #16184 from LabNConsulting/chopps/fe-notify-select
mgmtd: add notification selection to front-end API
2024-06-13 00:20:09 -05:00
Jafar Al-Gharaibeh
d8e3121cb8 build: FRR 10.2 development version
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2024-06-12 12:03:21 -05:00
Donatas Abraitis
8dac2215ed
Merge pull request #16191 from pguibert6WIND/srte_color_not_copied
lib: fix copy srte_color from zapi_nexthop structure
2024-06-12 15:39:10 +03:00
Y Bharath
a63bfb7566 tests: supress unused variables at topotests
For code maintainability, suppressed unused variables with "_"

Signed-off-by: y-bharath14 <y.bharath@samsung.com>
2024-06-12 13:56:34 +05:30
Russ White
82dcb1d63e
Merge pull request #16190 from trots/master
doc: Add reloading script into Python dependency section
2024-06-11 14:44:14 -04:00
Russ White
b436e96853
Merge pull request #16050 from rgirada/ospfv3_helper
ospf6d: Handling Topo Change in GR-HELPER mode for max-age lsas
2024-06-11 11:48:05 -04:00
Alexander Trotsenko
ee8b65f23b doc: Add reloading script into Python dependency section
Signed-off-by: Alexander Trotsenko <trotsenko93@mail.ru>
2024-06-11 15:23:24 +00:00
Russ White
89afc70b55
Merge pull request #16193 from opensourcerouting/fix/ecommunity_linkbw_present_overrun
bgpd: Check against extended community unit size for link bandwidth
2024-06-11 11:21:42 -04:00
Christian Hopps
27e369487e 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>
2024-06-11 10:37:31 -04:00
Christian Hopps
3dad09b228 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>
2024-06-11 10:37:31 -04:00
Donald Sharp
d0bdbd129e
Merge pull request #16187 from opensourcerouting/isis_tilfa_topo_rework
isis_tilfa_topo1 rework
2024-06-11 09:49:35 -04:00
anlan_cs
ad1244f88a 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>
2024-06-11 17:16:46 +08:00
Donatas Abraitis
e7bc47b501 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>
2024-06-11 10:03:17 +03:00
Donatas Abraitis
d5b0c76edd
Merge pull request #16183 from LabNConsulting/chopps/notif-doc-update
mgmtd: add empty notif xpath map for completeness
2024-06-10 22:25:10 +03:00
Renato Westphal
dc354cbfef 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>
2024-06-10 12:28:01 -03:00
Renato Westphal
04655c5f74 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>
2024-06-10 12:28:01 -03:00
Philippe Guibert
49bc1b6c21 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: 31f937fb43 ("lib, zebra: Add SR-TE policy infrastructure to zebra")

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-06-10 12:13:56 +02:00
Donatas Abraitis
19c3e0eca6
Merge pull request #16093 from louis-6wind/fix-show-route-memory
zebra: fix Out Of Memory issue when displaying large route tables in JSON
2024-06-10 11:26:23 +03:00
Donald Sharp
f0bf36d2e6
Merge pull request #16189 from LabNConsulting/chopps/triage-github-action 2024-06-08 21:34:42 -04:00
Christian Hopps
e973c1dd48 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>
2024-06-08 17:29:19 -04:00
Donald Sharp
2a00a648f1
Merge pull request #15900 from mikemallin/v6-vtep-lib-upstream
lib, bgpd, tests, zebra: prefix_sg changes for V6 VTEP
2024-06-07 14:34:11 -04:00
Christian Hopps
491e608c55 doc: add some text on native message API and notif xpath array
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-06-07 05:50:10 -04:00
Christian Hopps
a1dd57b649 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>
2024-06-07 05:50:10 -04:00
Louis Scalbert
2d6dcc0c57 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>
2024-06-07 10:13:32 +02:00
Louis Scalbert
85eb60ffd6 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>
2024-06-07 10:13:32 +02:00
Louis Scalbert
cb440058f2 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>
2024-06-07 10:13:32 +02:00
Louis Scalbert
03b1ee7a39 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>
2024-06-07 10:13:26 +02:00
Louis Scalbert
0c6f14ec14 Revert "vtysh, zebra: Fix malformed json output for multiple vrfs in command 'show ip route vrf all json'"
This reverts commit 0e2fc3d67f.

This fix was correct but not optimal for memory consumption at scale.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-06-07 10:12:42 +02:00
Donatas Abraitis
0cbe6dfc08
Merge pull request #16143 from eremcan/patch-1
docker: fix chmod issues when running container for debian
2024-06-07 10:49:55 +03:00
Christian Hopps
56ce19891b tests: switch test to new fe_client notify selector syntax
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-06-06 22:39:53 -04:00
Christian Hopps
8772e444a7 tests: add notify select support in fe client test utility
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-06-06 22:39:53 -04:00
Christian Hopps
657f1650e6 mgmtd: add front-end notification selector support
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-06-06 22:39:53 -04:00
Christian Hopps
33b73f8e3a lib: native msg add array of strings support
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-06-06 22:39:47 -04:00
Christian Hopps
22eccbfab9 lib: fix incorrect use of error checking macro
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-06-06 22:38:48 -04:00
Christian Hopps
e14781eb1d lib: darr: add free with element cleanup functions
- `darr_free_free` to `darr_free` each element prior to `darr_free`
  the array.
- `darr_free_func` to call `func` on each element prior to `darr_free`
  the array.

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-06-06 22:38:48 -04:00
Russ White
64f447fb10
Merge pull request #11906 from louis-6wind/show_isis_db_json
isisd: fix show isis database [detail] json
2024-06-06 16:27:57 -04:00
Russ White
84af49b0ae
Merge pull request #15434 from louis-6wind/labels-hash
bgpd: move labels from extra to extra->labels and add them to adj-rib-in and adj-rib-out
2024-06-06 16:27:38 -04:00
Donald Sharp
b70a773aa6
Merge pull request #16151 from pguibert6WIND/srv6_fix_source_address
zebra: display srv6 encapsulation source-address when configured
2024-06-06 12:22:15 -04:00
Donald Sharp
e1e84a70a0
Merge pull request #16171 from mjstapp/fix_fpm_nl_len_check
zebra: fix incoming FPM message length validation
2024-06-06 08:20:53 -04:00
Donald Sharp
3962ec5338
Merge pull request #16176 from LabNConsulting/chopps/munet-version-update
tests: munet: update to version 0.14.9
2024-06-06 08:20:37 -04:00
Rajesh Girada
a41b484f0a ospf6d: Handling Topo Change in GR-HELPER mode for max-age lsas
Description:
OSPF6 GR HELPER router should  consider as TOPOCHANGE when
it receives lsas with max age and should exit from Helper.
But, it is not exiting from helper because this max age lsa is
considered as duplicated lsa since the sender uses same seq
number for max age lsa from the previous lsa update.
Currently, topo change is not considered for duplicated lsas.
So removed the duplicated check when validating TOPOCHNAGE.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2024-06-06 04:34:39 -07:00
Christian Hopps
a465000035 tests: munet: update to version 0.14.9
Topotest relevant changes:

    - add support for `timeout` arg to `cmd_*()`
    - handle invalid regexp in CLI commands
    - fix long interface name support

Full munet changelog:

    munet: 0.14.9: add support for `timeout` arg to `cmd_*()`
    munet: 0.14.8: cleanup the cleanup (kill) on launch options
    munet: 0.14.7: allow multiple extra commands for shell console init
    munet: 0.14.6:
      - qemu: gather gcda files where munet can find them
      - handle invalid regexp in CLI commands
    munet: 0.14.5:
      - (podman) pull missing images for containers
      - fix long interface name support
      - add another router example
    munet: 0.14.4: mutest: add color to PASS/FAIL indicators on tty consoles
    munet: 0.14.3: Add hostnet node that runs it's commands in the host network namespace.
    munet: 0.14.2:
      - always fail mutest tests on bad json inputs
      - improve ssh-remote for common use-case of connecting to host connected devices
      - fix ready-cmd for python v3.11+
    munet: 0.14.1: Improved host interface support.

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-06-06 08:50:05 +00:00