]> git.proxmox.com Git - mirror_frr.git/commitdiff
lib: Handle configured VRFs at termination
authorvivek <vivek@cumulusnetworks.com>
Mon, 4 Dec 2017 21:10:09 +0000 (13:10 -0800)
committermitesh <mitesh@cumulusnetworks.com>
Wed, 24 Jan 2018 00:24:39 +0000 (16:24 -0800)
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

lib/vrf.c

index bc081796c55cac3ca0df58ac6fd022b9588ea914..23eaa042ec1991575870e3da7c0010c5eae74177 100644 (file)
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -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. */