Commit graph

6232 commits

Author SHA1 Message Date
Russ White 5398e01dca
Merge pull request #18605 from pguibert6WIND/sharp_usid
Add sharp support for seg6local routes with uSID flavor
2025-04-29 11:16:21 -04:00
Philippe Guibert 593ad76f99
Merge pull request #18309 from chdxD1/fix/zebra-evpn-vrf
Some checks are pending
build-test / Build the x86 ubuntu 22.04 docker image (push) Waiting to run
build-test / Test ubuntu x86 docker image (push) Blocked by required conditions
build-test / Build the ARM ubuntu 22.04 docker image (push) Waiting to run
build-test / Test ubuntu ARM docker image (push) Blocked by required conditions
zebra: use nexthop instead of route vrf_id for EVPN
2025-04-29 09:42:02 +02:00
Mark Stapp 6b939c6f20
Merge pull request #18731 from donaldsharp/no_returns_some_more
Some checks are pending
build-test / Build the x86 ubuntu 22.04 docker image (push) Waiting to run
build-test / Test ubuntu x86 docker image (push) Blocked by required conditions
build-test / Build the ARM ubuntu 22.04 docker image (push) Waiting to run
build-test / Test ubuntu ARM docker image (push) Blocked by required conditions
*: Allow returns to work with --enable-undefined-behavior
2025-04-28 16:53:26 -04:00
Christopher Dziomba 6288875e42
zebra: free nl batch buffer on termination
The nl batch buffer was destroyed too early when a netns was
terminated. Now freeing the buffer later in router_terminate allows
netlink messages to be still processed.

Signed-off-by: Christopher Dziomba <christopher.dziomba@telekom.de>
2025-04-28 20:29:11 +02:00
Donald Sharp d7e19c604f *: Allow returns to work with --enable-undefined-behavior
If you have undefined behavior compilation checking gcc
starts to complain about a bunch of places that do not
have return's.  When most of them actually do and we
have the assert's to prove it.  I'm just doing this
to make the compiler happy for me, so I can continue
to do work.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-04-28 14:05:28 -04:00
Russ White fc21c74db5
Merge pull request #18704 from Pdoijode/pdoijode/zapi-cancel-new-accept
Some checks are pending
build-test / Build the x86 ubuntu 22.04 docker image (push) Waiting to run
build-test / Test ubuntu x86 docker image (push) Blocked by required conditions
build-test / Build the ARM ubuntu 22.04 docker image (push) Waiting to run
build-test / Test ubuntu ARM docker image (push) Blocked by required conditions
zebra: Cancel new client accept events after zsock is closed
2025-04-28 07:43:33 -04:00
Christopher Dziomba ec06de8403
zebra: use nexthop instead of route vrf_id for EVPN
Today zebra tracks EVPN vtep_ips in the L3-VNI of the route_entry.
Leaking routes in bgpd and using different RMACs on the remote side
for different L3-VNIs for a single VTEP leads to updates in the leak
destination VRF which is not desired. Zebra gets the source VRF in
vrf_id of the nexthops. This nexthop vrf_id is now used for adding/
updating/deleting the l3vni nexthop.

Signed-off-by: Christopher Dziomba <christopher.dziomba@telekom.de>
2025-04-26 20:10:37 +02:00
Pooja Jagadeesh Doijode 7a935bb1ad zebra: Change zserv_accept to use global zsock FD
Problem:
Zebra crashed while going down. This happened because zebra was
trying to process a new client accept request after closing ZAPI's
listener socket zsock and setting it to -1.

Fix:
Skip rescheduling zserv_accept() and accepting a new client if global
ZAPI listener socket FD, zsock is already closed and set to -1.
Also use global ZAPI listener socket FD zsock in zserv_accept() instead
of using a copy of zsock.

Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2025-04-25 20:27:38 -07:00
Dmytro Shytyi 426f861268 zebra: add End.B6.Encaps to rt_netlink
Introduce the End.B6.Encaps in the rt_netlink code.

Signed-off-by: Dmytro Shytyi <dmytro.shytyi@6wind.com>
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-04-25 15:22:43 +02:00
Donald Sharp 8875befc7f zebra: Display nhg's afi as No Afi
When displaying `show nexthop-group rib` the afi
displayed for Nexthop Groups ( not singletons ) is
`bad-value` which while true to the specific of
the AFI it's not necessarily what we want to display
to the end operator.  Add a wrapper function for
nhg's to do the right thing.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-04-23 12:00:55 -04:00
Philippe Guibert f7ae2c17ea
Merge pull request #18677 from chdxD1/fix-rmac-nhlist
zebra: add vtep_ip to rmac nh_list in all cases
2025-04-23 15:07:01 +02:00
Donatas Abraitis 0ffed03d4a
Merge pull request #16836 from cscarpitta/feature/srv6-show-sids
Some checks are pending
build-test / Build the x86 ubuntu 22.04 docker image (push) Waiting to run
build-test / Test ubuntu x86 docker image (push) Blocked by required conditions
build-test / Build the ARM ubuntu 22.04 docker image (push) Waiting to run
build-test / Test ubuntu ARM docker image (push) Blocked by required conditions
zebra: Add CLI to display SRv6 SIDs allocated
2025-04-23 05:22:27 +03:00
Christopher Dziomba 0c14dd3af6
zebra: add vtep_ip to rmac nh_list in all cases
zebra rmac has a nh_list which tracks the assigned VTEP IPs to RMACs.
It can also receive IPv6 encoded IPv4 addresses as VTEPs. Changing/
Installing the RMAC into the Kernel is only important when the IPv4
address changes. However because nh_list is a nodup list used to
track usage or RMACs by VTEP IPs, both IP addresses (IPv4 and IPv6
encoded IPv4) should be written into it, as both could be removed
in l3vni_rmac_nh_list_nh_delete independently.

Signed-off-by: Christopher Dziomba <christopher.dziomba@telekom.de>
2025-04-22 17:22:43 +02:00
Russ White e525972513
Merge pull request #18158 from chdxD1/evpn-no-withdraw-for-update
Update EVPN prefix routes properly instead of withdraw/install
2025-04-22 10:54:57 -04:00
Russ White 87923c8cb0
Merge pull request #18626 from donaldsharp/RA_me
Some checks are pending
build-test / Build the x86 ubuntu 22.04 docker image (push) Waiting to run
build-test / Test ubuntu x86 docker image (push) Blocked by required conditions
build-test / Build the ARM ubuntu 22.04 docker image (push) Waiting to run
build-test / Test ubuntu ARM docker image (push) Blocked by required conditions
Implement RFC8781 (NAT64 prefix in RA's)
2025-04-21 17:32:58 -04:00
Carmine Scarpitta bd0d8218b7 zebra: Fix missing blank line checkpatch warning
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2025-04-19 10:59:43 +00:00
Carmine Scarpitta 9c80d265f9 zebra: Add CLI to display SRv6 SIDs allocated
```
router# show segment-routing srv6 sid
 SID                   Behavior    Context                Daemon/Instance    Locator    Allocation Type
 --------------------  ----------  ---------------------  -----------------  ---------  -----------------
 fcbb:bbbb:1::         uN          -                      isis(0)            MAIN       dynamic
 fcbb:bbbb:1:fe00::    uDT6        VRF 'vrf10'            bgp(0)             MAIN       dynamic
 fcbb:bbbb:1:fe01::    uDT6        VRF 'vrf20'            bgp(0)             MAIN       dynamic
 fcbb:bbbb:1:e000::    uA          Interface 'eth-sw1'    isis(0)            MAIN       dynamic
 fcbb:bbbb:1:e001::    uA          Interface 'eth-sw1'    isis(0)            MAIN       dynamic
```

```
router# show segment-routing srv6 sid json
{
  "fc00:0:1::":{
    "sid":"fc00:0:1::",
    "behavior":"uN",
    "context":{},
    "locator":"loc1",
    "allocationMode":"dynamic",
    "clients":[
      {
        "proto":"isis",
        "instance":0
      }
    ]
  },
  "fc00:0:1:1::":{
    "sid":"fc00:0:1:1::",
    "behavior":"uA",
    "context":{
      "interfaceIndex":2,
      "interfaceName":"eth-sw1",
      "nexthopIpv6Address":"fe80::4423:f3ff:fe8b:fed"
    },
    "locator":"loc1",
    "allocationMode":"dynamic",
    "clients":[
      {
        "proto":"isis",
        "instance":0
      }
    ]
  },
  "fc00:0:1:2::":{
    "sid":"fc00:0:1:2::",
    "behavior":"uA",
    "context":{
      "interfaceIndex":2,
      "interfaceName":"eth-sw1",
      "nexthopIpv6Address":"fe80::9005:fdff:fe18:1237"
    },
    "locator":"loc1",
    "allocationMode":"dynamic",
    "clients":[
      {
        "proto":"isis",
        "instance":0
      }
    ]
  }
}
```

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2025-04-19 10:59:38 +00:00
Donatas Abraitis 004c6c0260
Merge pull request #18692 from donaldsharp/event_cleanups
zebra: Save event pointer for rib sweeping
2025-04-19 03:40:27 +03:00
Donald Sharp 547894c087 zebra: Save event pointer for rib sweeping
The rib_sweep_route function when not doing graceful
restart does not attempt to save the event on the
t_rib_sweep pointer for shutdown.  Prevent any
weird shenanigans by allowing shutdown to clean
up the rib_sweep_route event.

Signed-off-by: Donald Sharp <donaldsharp72@gmail.com>
2025-04-18 17:44:39 -04:00
Mark Stapp 1ca756f315
Merge pull request #18497 from krishna-samy/show-metaq-counters
zebra: show command to display metaq info
2025-04-16 09:16:40 -04:00
Mark Stapp 21a32b010b
Merge pull request #18579 from krishna-samy/krishna/dplane_fpm_read
zebra: change fpm_read to batch the messages
2025-04-16 08:47:11 -04:00
Krishnasamy 7e8c18d0b0 zebra: change fpm_read to batch the messages
Make code changes in fpm_read to create a list of ctx and send it to
zebra for processing rather than sending individual ctx

Signed-off-by: Krishnasamy <krishnasamyr@nvidia.com>
2025-04-16 07:14:55 +00:00
David Lamparter 38ea0258ae zebra: implement RFC8781 (NAT64 prefix in RAs)
This tells hosts on the subnet if (and which) NAT64 prefix is in use.
Useful for things like xlat464, or local dns64.

Updated from the previous -03 draft implementation.  (PLC field did not
exist before.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2025-04-15 14:20:05 +02:00
Jafar Al-Gharaibeh 0dc71bcfca
Merge pull request #18641 from donaldsharp/fpm_listener_storage
zebra: Add ability to dump routes received from fpm_listener
2025-04-14 15:21:13 -05:00
Donald Sharp bd8ee74b49
Merge pull request #18645 from louis-6wind/fix-zebra-pbr-leak
zebra: fix pbr_iptable memory leak
2025-04-11 19:54:03 -04:00
Louis Scalbert 55ea74d630 zebra: clean pbr_iptable interface_name_list free
Clean up code related to pbr_iptable->interface_name_list free. This is
a cosmetic change.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-04-11 15:52:42 +02:00
Louis Scalbert 92cddedffd zebra: fix pbr_iptable memory leak
We are obviously doing deleting on wrong object.

> Direct leak of 40 byte(s) in 1 object(s) allocated from:
>     #0 0x7fcf718b4a57 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
>     #1 0x7fcf7126f8dd in qcalloc lib/memory.c:105
>     #2 0x7fcf7124401a in list_new lib/linklist.c:49
>     #3 0x55771621d86d in pbr_iptable_alloc_intern zebra/zebra_pbr.c:1015
>     #4 0x7fcf71217d79 in hash_get lib/hash.c:147
>     #5 0x55771621dad3 in zebra_pbr_add_iptable zebra/zebra_pbr.c:1030
>     #6 0x55771614d00c in zread_iptable zebra/zapi_msg.c:4131
>     #7 0x55771614e586 in zserv_handle_commands zebra/zapi_msg.c:4424
>     #8 0x5577162dae2c in zserv_process_messages zebra/zserv.c:521
>     #9 0x7fcf7137798e in event_call lib/event.c:2011
>     #10 0x7fcf71242ff1 in frr_run lib/libfrr.c:1216
>     #11 0x5577160e4d6d in main zebra/main.c:540
>     #12 0x7fcf70c29d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
>
> Indirect leak of 24 byte(s) in 1 object(s) allocated from:
>     #0 0x7fcf718b4a57 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
>     #1 0x7fcf7126f8dd in qcalloc lib/memory.c:105
>     #2 0x7fcf71244129 in listnode_new lib/linklist.c:71
>     #3 0x7fcf71244238 in listnode_add lib/linklist.c:92
>     #4 0x55771621d938 in pbr_iptable_alloc_intern zebra/zebra_pbr.c:1019
>     #5 0x7fcf71217d79 in hash_get lib/hash.c:147
>     #6 0x55771621dad3 in zebra_pbr_add_iptable zebra/zebra_pbr.c:1030
>     #7 0x55771614d00c in zread_iptable zebra/zapi_msg.c:4131
>     #8 0x55771614e586 in zserv_handle_commands zebra/zapi_msg.c:4424
>     #9 0x5577162dae2c in zserv_process_messages zebra/zserv.c:521
>     #10 0x7fcf7137798e in event_call lib/event.c:2011
>     #11 0x7fcf71242ff1 in frr_run lib/libfrr.c:1216
>     #12 0x5577160e4d6d in main zebra/main.c:540
>     #13 0x7fcf70c29d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Fixes: f80ec7e3d6 ("zebra: handle iptable list of interfaces")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-04-11 15:52:30 +02:00
Louis Scalbert cd451ff4ef zebra: split up MTYPE_PBR_OBJ
Split up MTYPE_PBR_OBJ into dedicated MTYPE to clarify the memory
allocation and free.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-04-11 15:52:30 +02:00
Donald Sharp 6299a89371 zebra: Add ability to dump routes received from fpm_listener
The fpm_listener currently has no ability to store the list
of prefixes that it has received.  Modify the code to store
the prefixes in a typesafe RB Tree.  Additionally modify
the code such that when a SIGUSR1 is received to dump
the routes out.  If the operator specifies a -z <filename>
then write the routes to that file.  It will overwrite
the last version of the file written.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-04-10 20:01:39 -04:00
Donald Sharp ef580f0e80 zebra: modify fpm_listener to display data about nhgs
Currently the fpm_listener completely ignores NHG's.
Let's start dumping some data about the nexthop groups:

[2025-04-10 16:55:12.939235306] FPM message - Type: 1, Length 52
[2025-04-10 16:55:12.939254252] Nexthop Group ID: 9, Protocol: Zebra(11), Contains 1 nexthops, Family: 2, Scope: 0
[2025-04-10 16:55:12.939260564] FPM message - Type: 1, Length 52
[2025-04-10 16:55:12.939263990] Nexthop Group ID: 10, Protocol: Zebra(11), Contains 1 nexthops, Family: 2, Scope: 0
[2025-04-10 16:55:12.939268659] FPM message - Type: 1, Length 56
[2025-04-10 16:55:12.939271635] Nexthop Group ID: 8, Protocol: Zebra(11), Contains 2 nexthops, Family: 0, Scope: 0

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-04-10 17:14:38 -04:00
Donald Sharp 64a6a2e175 zebra: Fix shadow warning in irdp_packet.c
My compiler is complaining about irdp_sock
being a shadow variable.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-04-09 12:01:30 -04:00
Mark Stapp 7c98a27f3e zebra: clean up -Wshadow compiler warnings
Clean up variable-shadowing compiler warnings.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-04-08 14:41:27 -04:00
Christopher Dziomba 069a23da10
zebra: Add refcounts to evpn nexthop prefixes
With bgpd no longer sending withdraws for EVPN prefix routes
zebra needs to track the path/ref count of prefixes for an EVPN
nexthop. When a route is updated the count is first increased
with the new paths and then decreased with the paths of the
existing/"same" route entry.
However the same evpn route methods are used for EVPN MH as well,
where bgpd already tracks the references. It is expected that an
ADD operation for the respective A-D routes is handled as an
upsert, a DEL operation should really remove the respective A-D
reference on a next-hop. For this the old behaviour (no path/ref
counting in zebra) is preserved.

Signed-off-by: Christopher Dziomba <christopher.dziomba@telekom.de>
2025-04-01 20:32:50 +02:00
Russ White c312917988
Merge pull request #18450 from donaldsharp/bgp_packet_reads
Bgp packet reads conversion to a FIFO
2025-04-01 10:12:37 -04:00
Krishnasamy 751ae76648 zebra: show command to display metaq info
Display below info from metaq and sub queues
1. Current queue size
2. Max/Highwater size
3. Total number of events received fo so far

r1# sh zebra metaq
MetaQ Summary
Current Size    : 0
Max Size        : 9
Total           : 20
 |------------------------------------------------------------------|
 | SubQ                             | Current  | Max Size  | Total  |
 |----------------------------------+----------+-----------+--------|
 | NHG Objects                      | 0        | 0         | 0      |
 |----------------------------------+----------+-----------+--------|
 | EVPN/VxLan Objects               | 0        | 0         | 0      |
 |----------------------------------+----------+-----------+--------|
 | Early Route Processing           | 0        | 8         | 11     |
 |----------------------------------+----------+-----------+--------|
 | Early Label Handling             | 0        | 0         | 0      |
 |----------------------------------+----------+-----------+--------|
 | Connected Routes                 | 0        | 6         | 9      |
 |----------------------------------+----------+-----------+--------|
 | Kernel Routes                    | 0        | 0         | 0      |
 |----------------------------------+----------+-----------+--------|
 | Static Routes                    | 0        | 0         | 0      |
 |----------------------------------+----------+-----------+--------|
 | RIP/OSPF/ISIS/EIGRP/NHRP Routes  | 0        | 0         | 0      |
 |----------------------------------+----------+-----------+--------|
 | BGP Routes                       | 0        | 0         | 0      |
 |----------------------------------+----------+-----------+--------|
 | Other Routes                     | 0        | 0         | 0      |
 |----------------------------------+----------+-----------+--------|
 | Graceful Restart                 | 0        | 0         | 0      |
 |------------------------------------------------------------------|

Signed-off-by: Krishnasamy <krishnasamyr@nvidia.com>
2025-04-01 09:32:46 +00:00
Donald Sharp f82682a3f9 zebra: Clean up memory associated with affinity maps
Zebra is using affinity maps but not cleaning up memory on shutdown.
BAD!

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-03-30 17:54:34 -04:00
Donald Sharp 937a9fb3e9 zebra: Limit reading packets when MetaQ is full
Currently Zebra is just reading packets off the zapi
wire and stacking them up for processing in zebra
in the future.  When there is significant churn
in the network the size of zebra can grow without
bounds due to the MetaQ sizing constraints.  This
ends up showing by the number of nexthops in the
system.  Reducing the number of packets serviced
to limit the metaQ size to the packets to process
allieviates this problem.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-03-25 09:10:46 -04:00
Mark Stapp 556d3c445d
Merge pull request #18359 from soumyar-roy/soumya/streamsize
zebra: zebra crash for zapi stream
2025-03-21 11:30:16 -04:00
Russ White 37fd451997
Merge pull request #18409 from donaldsharp/typesafe_zclient
Typesafe zclient
2025-03-20 12:48:47 -04:00
Soumya Roy 860c1e4450 zebra: reduce memory usage by streams when redistributing routes
This commit undo 8c9b007a0c
stream lib has been modified to expand the stream if needed
Now for zapi route encode, we use expandable stream

Signed-off-by: Soumya Roy <souroy@nvidia.com>
2025-03-20 16:13:44 +00:00
Soumya Roy 6fe9092eb3 zebra: zebra crash for zapi stream
Issue:
If static route is created with a BGP route as nexthop, which
recursively resolves over 512 ECMP v6 nexthops, zapi nexthop encode
fails, as there is not enough memory allocated for stream. This causes
assert/core dump in zebra. Right now we allocate fixed memory
of ZEBRA_MAX_PACKET_SIZ size.

Fix:
1)Dynamically calculate required memory size for the stream
2)try to optimize memory usage

Testing:
No crash happens anymore with the fix
zebra: zebra crash for zapi stream

Issue:
If static route is created with a BGP route as nexthop, which
recursively resolves over 512 ECMP v6 nexthops, zapi nexthop encode
fails, as there is not enough memory allocated for stream. This causes
assert/core dump in zebra. Right now we allocate fixed memory
of ZEBRA_MAX_PACKET_SIZ size.

Fix:
1)Dynamically calculate required memory size for the stream
2)try to optimize memory usage

Testing:
No crash happens anymore with the fix
r1#
r1# sharp install routes 2100:cafe:: nexthop 2001:db8::1 1000
r1#

r2# conf
r2(config)# ipv6 route 2503:feca::100/128 2100:cafe::1
r2(config)# exit
r2#

Signed-off-by: Soumya Roy <souroy@nvidia.com>
2025-03-20 16:13:44 +00:00
Donald Sharp 9c273fad26 zebra: Add timestamp to output
It's interesting to know the time we received the route.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-03-19 13:47:01 -04:00
Donald Sharp 04d6adc94b zebra: Allow fpm_listener to reject all routes
Now usage of `-r -f` with fpm_listener now causes all
routes to be rejected.

r1# sharp install routes 10.0.0.0 nexthop 192.168.44.5 5
r1# show ip route
Codes: K - kernel route, C - connected, L - local, S - static,
       R - RIP, O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric, t - Table-Direct,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup
       t - trapped, o - offload failure

IPv4 unicast VRF default:
D>o 10.0.0.0/32 [150/0] via 192.168.44.5, r1-eth0, weight 1, 00:00:02
D>o 10.0.0.1/32 [150/0] via 192.168.44.5, r1-eth0, weight 1, 00:00:02
D>o 10.0.0.2/32 [150/0] via 192.168.44.5, r1-eth0, weight 1, 00:00:02
D>o 10.0.0.3/32 [150/0] via 192.168.44.5, r1-eth0, weight 1, 00:00:02
D>o 10.0.0.4/32 [150/0] via 192.168.44.5, r1-eth0, weight 1, 00:00:02
C>* 192.168.44.0/24 is directly connected, r1-eth0, weight 1, 00:00:37
L>* 192.168.44.1/32 is directly connected, r1-eth0, weight 1, 00:00:37
r1#

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-03-19 13:43:47 -04:00
Donald Sharp 4d6f5c7e27 zebra: Rework the stale client list to a typesafe list
The stale client list was just a linked list, let's use
the typesafe list.

Signed-off-by: Donald Sharp <donaldsharp72@gmail.com>
2025-03-19 13:43:00 -04:00
Donald Sharp 24d293277f zebra: Convert the zrouter.client_list to a typesafe list
This list should just be a typesafe list.

Signed-off-by: Donald Sharp <donaldsharp72@gmail.com>
2025-03-19 13:27:36 -04:00
Russ White d5b864ebee
Merge pull request #18374 from raja-rajasekar/rajasekarr/nhg_intf_flap_issue
zebra: Fix reinstalling nexthops in NHGs upon interface flaps
2025-03-19 08:10:15 -04:00
Rajasekar Raja de168795ab zebra: Fix reinstalling nexthops in NHGs upon interface flaps
Trigger:
Imagine a route utilizing an NHG with six nexthops (Intf swp1-swp6).
If interfaces swp1-swp4 flaps, the NHG remains the same but now only
references two nexthops (swp5-6) instead of all six. This behavior
occurs due to how NHGs with recursive nexthops are managed within Zebra.

In the scenario below, NHG 370 has all six nexthops installed in the
kernel. However, Zebra maintains a list of recursive NHGs that NHG 370
references i.e., Depends: (371), (372), (373) which are not directly
installed in the kernel.
- When an interface comes up, its nexthop and corresponding dependents
  are installed.
- These dependents (counterparts to 371-373) are non-recursive and
  are installed as well.
- However, when attempting to install the recursive ones in
  zebra_nhg_install_kernel(), they resolve to the already installed
  counterparts, resulting in a NO-OP.

Fixing this by iterating all dependents of the recursively resolved
NHGs and reinstalling them.

Trigger: Flap swp1 to swp4

Before Fix:
root@leaf-11:mgmt:/var/home/cumulus# ip route show | grep 6.0.0.5
6.0.0.5 nhid 370 proto bgp metric 20
ip -d next show
id 337 via 2000:1:0:1:0:f:0:9 dev swp6 scope link proto zebra
id 339 via 2000:1:0:1:0:e:0:9 dev swp5 scope link proto zebra
id 341 via 2000:1:0:1:0:8:0:8 dev swp4 scope link proto zebra
id 343 via 2000:1:0:1:0:7:0:8 dev swp3 scope link proto zebra
id 346 via 2000:1:0:1:0:1:0:7 dev swp2 scope link proto zebra
id 348 via 2000:1:0:1::7 dev swp1 scope link proto zebra
id 370 group 346/348/341/343/337/339 scope global proto zebra

After Trigger:
root@leaf-11:mgmt:/var/home/cumulus# ip route show | grep 6.0.0.5
6.0.0.5 nhid 370 proto bgp metric 20
root@leaf-11:mgmt:/var/home/cumulus# ip -d next show
id 337 via 2000:1:0:1:0:f:0:9 dev swp6 scope link proto zebra
id 339 via 2000:1:0:1:0:e:0:9 dev swp5 scope link proto zebra
id 370 group 337/339 scope global proto zebra

After Fix:
root@leaf-11:mgmt:/var/home/cumulus# ip route show | grep 6.0.0.5
6.0.0.5 nhid 432 proto bgp metric 20
ip -d next show
id 432 group 395/397/400/402/405/407 scope global proto zebra

After Trigger
root@leaf-11:mgmt:/var/home/cumulus# ip route show | grep 6.0.0.5
6.0.0.5 nhid 432 proto bgp metric 20
root@leaf-11:mgmt:/var/home/cumulus# ip -d next show
id 432 group 395/397/400/402/405/407 scope global proto zebra

Ticket :#

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-03-18 12:21:42 -07:00
Russ White 4b6e0ba1a1
Merge pull request #18349 from donaldsharp/more_yang_state
More yang state
2025-03-18 11:02:28 -04:00
Dmytro Shytyi e6d08a89c7
zebra: add rtadv information output in vtysh json
Add to "show interface json" output multiple rtadv parameters.

if_dump_vty() calls => hook_call(zebra_if_extra_info, vty, ifp);

if_dump_vty_json() now do the same call, with additional parameter:
hook_call(zebra_if_extra_info, vty, json_if, ifp);

Signed-off-by: Dmytro Shytyi <dmytro.shytyi@6wind.com>
2025-03-17 11:19:58 +01:00
Donatas Abraitis 35cc716363
Merge pull request #18394 from donaldsharp/fpm_listener_output
zebra: add ability to specify output file with fpm_listener
2025-03-15 18:32:19 +01:00