summaryrefslogtreecommitdiff
path: root/zebra/zebra_rib.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2019-02-06 14:21:36 -0500
committerDonald Sharp <sharpd@cumulusnetworks.com>2019-03-27 16:19:28 -0400
commit434434f70404a3b491117442462b554e83764339 (patch)
tree321fc66b66b89606ed986ebe6b63be0679dfe252 /zebra/zebra_rib.c
parenta304e258be3cc6ea85ccac121025f881637f969f (diff)
zebra: Abstract the rib_dest_t creation
Abstract the creation of the rib_dest_t so that we can call it from multiple places. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'zebra/zebra_rib.c')
-rw-r--r--zebra/zebra_rib.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index ad07331152..5d98d61645 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -2314,6 +2314,18 @@ static void rib_queue_init(void)
return;
}
+rib_dest_t *zebra_rib_create_dest(struct route_node *rn)
+{
+ rib_dest_t *dest;
+
+ dest = XCALLOC(MTYPE_RIB_DEST, sizeof(rib_dest_t));
+ route_lock_node(rn); /* rn route table reference */
+ rn->info = dest;
+ dest->rnode = rn;
+
+ return dest;
+}
+
/* RIB updates are processed via a queue of pointers to route_nodes.
*
* The queue length is bounded by the maximal size of the routing table,
@@ -2366,10 +2378,7 @@ static void rib_link(struct route_node *rn, struct route_entry *re, int process)
if (IS_ZEBRA_DEBUG_RIB_DETAILED)
rnode_debug(rn, re->vrf_id, "rn %p adding dest", rn);
- dest = XCALLOC(MTYPE_RIB_DEST, sizeof(rib_dest_t));
- route_lock_node(rn); /* rn route table reference */
- rn->info = dest;
- dest->rnode = rn;
+ dest = zebra_rib_create_dest(rn);
}
head = dest->routes;