summaryrefslogtreecommitdiff
path: root/zebra/rt_netlink.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2016-04-13 10:06:36 -0400
committerDonald Sharp <sharpd@cumulusnetworks.com>2016-04-14 20:56:43 -0400
commite2b1be648db7e7906aa5e4e04b23ef88cbeff04a (patch)
tree14faf25a68b8848173c59a8b340d75a4e427537b /zebra/rt_netlink.c
parente74f14fc793475ed3dd3ad4b87f8648313b42b1b (diff)
lib, zebra: Rework vrf_add_update
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>
Diffstat (limited to 'zebra/rt_netlink.c')
-rw-r--r--zebra/rt_netlink.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index 41db582df4..499881877e 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -556,6 +556,9 @@ netlink_vrf_change (struct nlmsghdr *h, struct rtattr *tb, const char *name)
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)
{
@@ -570,11 +573,14 @@ netlink_vrf_change (struct nlmsghdr *h, struct rtattr *tb, const char *name)
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
{