]> git.proxmox.com Git - mirror_frr.git/commit - zebra/zebra_nhg.c
zebra: Allow multiple connected routes to be choosen for kernel routes
authorDonald Sharp <sharpd@nvidia.com>
Tue, 29 Mar 2022 14:55:34 +0000 (10:55 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Fri, 8 Apr 2022 12:15:20 +0000 (08:15 -0400)
commit48dc8610281ce0fd54f8a6bae51817f657dd9dc1
tree64cfa1c0230683a0280f1f22cba6b443ccb13186
parentb4bdcf45d5010b29d0da579d563df8c277268131
zebra: Allow multiple connected routes to be choosen for kernel routes

This bug should only really affect kernel routes.  To reproduce:

a) Have multiple connected routes that point to the same prefix
swp8  up      default         169.254.0.250/30
swp9  up      default         169.254.0.250/30

b) Have a kernel route that uses one of those connected routes
7.6.2.8 via 169.254.0.249 dev swp8 proto static
(But have it choose a non-selected connected nexthop)

c) Introduce an event that causes the rib table to be reprocessed,
say a unrelated interface going up / down

  This causes the route to be lost with this message:
2022/03/28 21:21:53 ZEBRA: [YXCJP-0WZWV] netlink_nexthop_msg_encode: ID (3454): 169.254.0.249, via swp8(1383) vrf default(0)
2022/03/28 21:21:53 ZEBRA: [YF2E6-J60JH] nexthop_active: 169.254.0.249, via swp8 given ifindex does not match nexthops ifindex found found: directly connected, swp9

Effectively the nexthop that zebra is choosing would not be the one
that the kernel route has choosen and FRR removes the route:
022/03/28 21:21:53 ZEBRA: [NM15X-X83N9] rib_process: (0:254):7.6.2.8/32: rn 0x56042e632e90, removing re 0x56042e6316e0
2022/03/28 21:21:53 ZEBRA: [Y53JX-CBC5H] rib_unlink: (0:254):7.6.2.8/32: rn 0x56042e632e90, re 0x56042e6316e0
2022/03/28 21:21:53 ZEBRA: [KT8QQ-45WQ0] rib_gc_dest: (0:?):7.6.2.8/32: removing dest from table

What is happening?

Zebra is not looking at all connected routes and if any of them
would have the appropriate ifindex and just blindly rejecting
the route.

So when nexthop resolution happens and it matches a connected
route and the dest->selected nexthop ifindex does not match, let's sort
through the rest of them and see if any of them match and if so
let's keep the route.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
zebra/zebra_nhg.c