The vrf_add_update function does not need to exist.
Move it's constituent parts into the appropriate
vrf_create/vrf_enable functionality as well as
move the zebra_vrf_add_update() function call
into zebra_vrf_enable()
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
int
vrf_enable (struct vrf *vrf)
{
-//Pending: see if VRF lib had a reason to leave it for default only
-// /* Till now, only the default VRF can be enabled. */
-// if (vrf->vrf_id == VRF_DEFAULT)
-// {
if (debug_vrf)
zlog_debug ("VRF %u is enabled.", vrf->vrf_id);
- if (vrf_master.vrf_enable_hook)
- (*vrf_master.vrf_enable_hook) (vrf->vrf_id, vrf->name, &vrf->info);
+ if (!CHECK_FLAG (vrf->status, VRF_ACTIVE))
+ SET_FLAG (vrf->status, VRF_ACTIVE);
- return 1;
-// }
+ if (vrf_master.vrf_enable_hook)
+ (*vrf_master.vrf_enable_hook) (vrf->vrf_id, vrf->name, &vrf->info);
-// return 0;
+ return 1;
}
/*
rib_update (ifp->vrf_id, RIB_UPDATE_IF_CHANGE);
}
-
-/* Handle VRF addition */
-void
-vrf_add_update (struct vrf *vrfp)
-{
- zebra_vrf_add_update (vrf_info_lookup (vrfp->vrf_id));
-
- if (! CHECK_FLAG (vrfp->status, VRF_ACTIVE))
- {
- SET_FLAG (vrfp->status, VRF_ACTIVE);
-
- //Pending: Check if the equivalent of if_addr_wakeup (ifp) is needed here.
-
- if (IS_ZEBRA_DEBUG_KERNEL)
- zlog_debug ("VRF %s id %u becomes active.",
- vrfp->name, vrfp->vrf_id);
- }
- else
- {
- if (IS_ZEBRA_DEBUG_KERNEL)
- zlog_debug ("VRF %s id %u is added.",
- vrfp->name, vrfp->vrf_id);
- }
-}
-
static void
ipv6_ll_address_to_mac (struct in6_addr *address, u_char *mac)
{
#include "zebra/rtadv.h"
#include "zebra/zebra_fpm.h"
#include "zebra/zebra_ptm.h"
+#include "zebra/redistribute.h"
#define ZEBRA_PTM_SUPPORT
assert (zvrf);
+ zebra_vrf_add_update (zvrf);
+
return 0;
}
zlog_debug ("RTM_NEWLINK for VRF %s(%u) table %u",
name, ifi->ifi_index, nl_table_id);
+ /*
+ * vrf_get is implied creation if it does not exist
+ */
vrf = vrf_get((vrf_id_t)ifi->ifi_index, name); // It would create vrf
if (!vrf)
{
return;
}
- /*Pending: See if you want to optimize this code.. vrf, zvrf all have name */
- zvrf = vrf->info;
+ /*
+ * This is the only place that we get the actual kernel table_id
+ * being used. We need it to set the table_id of the routes
+ * we are passing to the kernel.... And to throw some totally
+ * awesome parties. that too.
+ */
+ zvrf = (struct zebra_vrf *)vrf->info;
zvrf->table_id = nl_table_id;
-
- vrf_add_update(vrf);
}
else //h->nlmsg_type == RTM_DELLINK
{