lib: Handle configured VRFs at termination

When shutting down, ensure that all VRFs including "configured" ones are
cleaned up properly.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-19069
Reviewed By: CCR-7011
Testing Done: Manual verification of failed scenario
This commit is contained in:
vivek 2017-12-04 13:10:09 -08:00 committed by mitesh
parent 2f69f6d368
commit 65c3a7c4e5

View File

@ -419,10 +419,16 @@ void vrf_terminate(void)
zlog_debug("%s: Shutting down vrf subsystem",
__PRETTY_FUNCTION__);
while ((vrf = RB_ROOT(vrf_id_head, &vrfs_by_id)) != NULL)
while ((vrf = RB_ROOT(vrf_id_head, &vrfs_by_id)) != NULL) {
/* Clear configured flag and invoke delete. */
UNSET_FLAG(vrf->status, VRF_CONFIGURED);
vrf_delete(vrf);
while ((vrf = RB_ROOT(vrf_name_head, &vrfs_by_name)) != NULL)
}
while ((vrf = RB_ROOT(vrf_name_head, &vrfs_by_name)) != NULL) {
/* Clear configured flag and invoke delete. */
UNSET_FLAG(vrf->status, VRF_CONFIGURED);
vrf_delete(vrf);
}
}
/* Create a socket for the VRF. */