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_ns.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'zebra/zebra_ns.c') diff --git a/zebra/zebra_ns.c b/zebra/zebra_ns.c index b3b9c6d18a..c48a6f7bd8 100644 --- a/zebra/zebra_ns.c +++ b/zebra/zebra_ns.c @@ -41,6 +41,7 @@ struct zebra_ns *zebra_ns_lookup(ns_id_t ns_id) return dzns; } +/* Do global enable actions - open sockets, read kernel config etc. */ int zebra_ns_enable(ns_id_t ns_id, void **info) { struct zebra_ns *zns = (struct zebra_ns *)(*info); @@ -49,8 +50,6 @@ int zebra_ns_enable(ns_id_t ns_id, void **info) rtadv_init(zns); #endif - zns->if_table = route_table_init(); - zebra_vxlan_ns_init(zns); kernel_init(zns); interface_list(zns); route_read(zns); @@ -79,8 +78,14 @@ int zebra_ns_init(void) ns_init(); + /* Do any needed per-NS data structure allocation. */ + dzns->if_table = route_table_init(); + zebra_vxlan_ns_init(dzns); + + /* Register zebra VRF callbacks, create and activate default VRF. */ zebra_vrf_init(); + /* Default NS is activated */ zebra_ns_enable(NS_DEFAULT, (void **)&dzns); return 0; -- cgit v1.2.3