]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib, zebra: Rearrange vrf_delete_update
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 13 Apr 2016 12:20:33 +0000 (08:20 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 15 Apr 2016 00:56:12 +0000 (20:56 -0400)
vrf_delete_update really belongs in vrf.c broken up
into it's appropriate places.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
lib/vrf.c
zebra/interface.c
zebra/interface.h
zebra/main.c
zebra/rt_netlink.c

index f2eb551f8277e4f1569b9998082324ccdad4471b..eab720fe1d19b19a1be78a4f6c5ce2eb42aaa3b0 100644 (file)
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -255,6 +255,7 @@ vrf_enable (struct vrf *vrf)
 static void
 vrf_disable (struct vrf *vrf)
 {
+  UNSET_FLAG (vrf->status, VRF_ACTIVE);
   if (vrf_is_enabled (vrf))
     {
       if (debug_vrf)
@@ -266,6 +267,7 @@ vrf_disable (struct vrf *vrf)
       if (vrf_master.vrf_disable_hook)
         (*vrf_master.vrf_disable_hook) (vrf->vrf_id, vrf->name, &vrf->info);
     }
+
 }
 
 
index b47d03929f90b92f33e0e211566b8cef0f770ceb..cd5f1d9f0de09cc13359ec1372622df6a28d8edc 100644 (file)
@@ -739,28 +739,6 @@ vrf_add_update (struct vrf *vrfp)
     }
 }
 
-/* Handle an interface delete event */
-void 
-vrf_delete_update (struct vrf *vrfp)
-{
-  /* Mark VRF as inactive */
-  UNSET_FLAG (vrfp->status, VRF_ACTIVE);
-  
-  if (IS_ZEBRA_DEBUG_KERNEL)
-    zlog_debug ("VRF %s id %u is now inactive.",
-                vrfp->name, vrfp->vrf_id);
-
-  zebra_vrf_delete_update (vrf_info_lookup (vrfp->vrf_id));
-
-  /* Pending: Update ifindex after distributing the delete message.  This is in
-     case any client needs to have the old value of ifindex available
-     while processing the deletion.  Each client daemon is responsible
-     for setting vrf-id to IFINDEX_INTERNAL after processing the
-     interface deletion message. */
-  vrfp->vrf_id = VRF_UNKNOWN;
-}
-
-
 static void
 ipv6_ll_address_to_mac (struct in6_addr *address, u_char *mac)
 {
index 8e8387eaf4e458f2ecae94627978e47b21ce8a58..9beabb62f8bdb78c57bbff25751ceba6741ada3b 100644 (file)
@@ -233,7 +233,6 @@ extern int if_subnet_delete (struct interface *, struct connected *);
 extern int ipv6_address_configured (struct interface *ifp);
 extern void if_handle_vrf_change (struct interface *ifp, vrf_id_t vrf_id);
 
-extern void vrf_delete_update (struct vrf *vrfp);
 extern void vrf_add_update (struct vrf *vrfp);
 
 #ifdef HAVE_PROC_NET_DEV
index ea3aee659c94408a63b2fbe60f467f41640b6168..eb46aad6ca0d886a9fad181f995953358e8d9bd8 100644 (file)
@@ -297,6 +297,14 @@ zebra_ns_disable (ns_id_t ns_id, void **info)
 static int
 zebra_vrf_disable (vrf_id_t vrf_id, const char *name, void **info)
 {
+  struct zebra_vrf *zvrf = (struct zebra_vrf *)(*info);
+
+  if (IS_ZEBRA_DEBUG_KERNEL)
+    zlog_debug ("VRF %s id %u is now disabled.",
+                zvrf->name, zvrf->vrf_id);
+
+  zebra_vrf_delete_update (zvrf);
+
   return 0;
 }
 
index 5686d8e528272529add76cf5b9bf7b94dca2c915..41db582df4785560a8a39aa124bc6f2b0a5805e0 100644 (file)
@@ -584,9 +584,11 @@ netlink_vrf_change (struct nlmsghdr *h, struct rtattr *tb, const char *name)
       vrf = vrf_lookup ((vrf_id_t)ifi->ifi_index);
 
       if (!vrf)
-        zlog_warn ("%s: vrf not found", __func__);
+        {
+         zlog_warn ("%s: vrf not found", __func__);
+         return;
+       }
 
-      vrf_delete_update (vrf);
       vrf_delete (vrf);
     }
 }