diff options
| author | Louis Scalbert <louis.scalbert@6wind.com> | 2024-09-23 17:23:51 +0200 |
|---|---|---|
| committer | Louis Scalbert <louis.scalbert@6wind.com> | 2025-03-10 09:54:18 +0100 |
| commit | c6afe42455307f04e789c228df22a48ddc43e3b8 (patch) | |
| tree | 6f33592d7769c95d2bc42a41ed27effb04e36c64 /zebra | |
| parent | 97c159e88278dfe10d4dc1015e5fd6c3eaf30a07 (diff) | |
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 <louis.scalbert@6wind.com>
Diffstat (limited to 'zebra')
| -rw-r--r-- | zebra/zebra_vrf.c | 12 |
1 files changed, 9 insertions, 3 deletions
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); |
