]> git.puffer.fish Git - matthieu/frr.git/commit
zebra: Fix reinstalling nexthops in NHGs upon interface flaps
authorRajasekar Raja <rajasekarr@nvidia.com>
Tue, 11 Mar 2025 19:15:32 +0000 (12:15 -0700)
committerRajasekar Raja <rajasekarr@nvidia.com>
Tue, 18 Mar 2025 19:21:42 +0000 (12:21 -0700)
commitde168795ab5d75151f1b410fcdad88e2c28ef40e
tree638a7bbeb51b56962ccb2d74cf61c609f5773420
parentb66145b8ca1ee8c222ceb79afa89bced21273537
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>
tests/topotests/all_protocol_startup/test_all_protocol_startup.py
zebra/zebra_nhg.c