From c6afe42455307f04e789c228df22a48ddc43e3b8 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Mon, 23 Sep 2024 17:23:51 +0200 Subject: lib, tests, zebra: keep table routes at vrf disabling At VRF disabling, keep the route entries that was associated to its table ID but not to the VRF itself. Kernel flushes these entries so we need to reinstall them. To do so, add a flag to mean that a route entry is owned by a table ID and not by a VRF. If the VRF associated to the table ID is deleted, the route entry must not be deleted. Update to tests with new flag. 2057 is in hexa 0x809, meaning that the new flag has been to some prefix. Signed-off-by: Louis Scalbert --- zebra/zebra_vrf.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'zebra') diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c index faafcf7892..d652c57388 100644 --- a/zebra/zebra_vrf.c +++ b/zebra/zebra_vrf.c @@ -191,13 +191,19 @@ static void zebra_vrf_disable_update_vrfid(struct zebra_vrf *zvrf, afi_t afi, sa /* Assign the kernel route entries to the default VRF, * even though they are not actually owned by it. * - * Remove route nodes that have been created by FRR daemons. - * They are not needed if the VRF is disabled. + * Remove route nodes that were created by FRR daemons, + * unless they are associated with the table rather than the VRF. + * Routes associated with the VRF are not needed once the VRF is + * disabled. */ rn_delete = true; RNODE_FOREACH_RE_SAFE (rn, re, nre) { - if (re->type == ZEBRA_ROUTE_KERNEL) { + if (re->type == ZEBRA_ROUTE_KERNEL || + CHECK_FLAG(re->flags, ZEBRA_FLAG_TABLEID)) { nexthop_vrf_update(rn, re, VRF_DEFAULT); + if (CHECK_FLAG(re->flags, ZEBRA_FLAG_TABLEID)) + /* reinstall routes */ + rib_install_kernel(rn, re, NULL); rn_delete = false; } else rib_unlink(rn, re); -- cgit v1.2.3