Skip to content

Commit

Permalink
zebra: keep table route entries at vrf disabling
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
  • Loading branch information
louis-6wind committed Oct 9, 2024
1 parent 6305530 commit 6193674
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions zebra/zebra_vrf.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,18 @@ static void zebra_vrf_disable_update_vrfid(struct zebra_vrf *zvrf, afi_t afi,
/* 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.
*/
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);
Expand Down

0 comments on commit 6193674

Please sign in to comment.