From 84915b0a15e32a51622f28b6bcafff58a4b02d6d Mon Sep 17 00:00:00 2001 From: vivek Date: Fri, 1 Dec 2017 17:36:37 -0800 Subject: *: Handle VRF configuration when VRF gets inactivated and activated A VRF is active only when the corresponding VRF device is present in the kernel. However, when the kernel VRF device is removed, the VRF container in FRR should go away only if there is no user configuration for it. Otherwise, when the VRF device is created again so that the VRF becomes active, FRR cannot take the correct actions. Example configuration for the VRF includes static routes and EVPN L3 VNI. Note that a VRF is currently considered to be "configured" as soon as the operator has issued the "vrf " command in FRR. Such a configured VRF is not deleted upon VRF device removal, it is only made inactive. A VRF that is "configured" can be deleted only upon operator action and only if the VRF has been deactivated i.e., the VRF device removed from the kernel. This is an existing restriction. To implement this change, the VRF disable and delete actions have been modified. Signed-off-by: Vivek Venkatraman Reviewed-by: Donald Sharp Reviewed-by: Mitesh Kanjariya Reviewed-by: Don Slice Ticket: CM-18553, CM-18918, CM-10139 Reviewed By: CCR-7022 Testing Done: 1. vrf and pim-vrf automation tests 2. Multiple VRF delete and readd (ifdown, ifup-with-depends) 3. FRR stop, start, restart 4. Networking restart 5. Configuration delete and readd Some of the above tests run in different sequences (manually). --- zebra/zebra_mpls.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'zebra/zebra_mpls.c') diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c index 61051ba87e..22c81b5784 100644 --- a/zebra/zebra_mpls.c +++ b/zebra/zebra_mpls.c @@ -2875,6 +2875,16 @@ int zebra_mpls_write_label_block_config(struct vty *vty, struct zebra_vrf *zvrf) return 1; } +/* + * Called when VRF becomes inactive, cleans up information but keeps + * the table itself. + * NOTE: Currently supported only for default VRF. + */ +void zebra_mpls_cleanup_tables(struct zebra_vrf *zvrf) +{ + hash_iterate(zvrf->lsp_table, lsp_uninstall_from_kernel, NULL); +} + /* * Called upon process exiting, need to delete LSP forwarding * entries from the kernel. -- cgit v1.2.3