From: Donald Sharp Date: Wed, 13 Apr 2016 12:20:33 +0000 (-0400) Subject: lib, zebra: Rearrange vrf_delete_update X-Git-Tag: frr-2.0-rc1~972 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=e74f14fc793475ed3dd3ad4b87f8648313b42b1b;p=mirror%2Ffrr.git lib, zebra: Rearrange vrf_delete_update vrf_delete_update really belongs in vrf.c broken up into it's appropriate places. Signed-off-by: Donald Sharp Reviewed-by: Don Slice Reviewed-by: Vivek Venkatraman --- diff --git a/lib/vrf.c b/lib/vrf.c index f2eb551f82..eab720fe1d 100644 --- 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); } + } diff --git a/zebra/interface.c b/zebra/interface.c index b47d03929f..cd5f1d9f0d 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -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) { diff --git a/zebra/interface.h b/zebra/interface.h index 8e8387eaf4..9beabb62f8 100644 --- a/zebra/interface.h +++ b/zebra/interface.h @@ -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 diff --git a/zebra/main.c b/zebra/main.c index ea3aee659c..eb46aad6ca 100644 --- a/zebra/main.c +++ b/zebra/main.c @@ -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; } diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 5686d8e528..41db582df4 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -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); } }