]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: Abstract the rib_dest_t creation
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 6 Feb 2019 19:21:36 +0000 (14:21 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 27 Mar 2019 20:19:28 +0000 (16:19 -0400)
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>
zebra/rib.h
zebra/zebra_rib.c

index ced6692b9b1bfa5773d0dcc504abf5ca5b58daf8..2e0a73aa8b4e24874f195db846f076bb7226bbd6 100644 (file)
@@ -430,6 +430,11 @@ static inline struct zebra_vrf *rib_dest_vrf(rib_dest_t *dest)
        return rib_table_info(rib_dest_table(dest))->zvrf;
 }
 
+/*
+ * Create the rib_dest_t and attach it to the specified node
+ */
+extern rib_dest_t *zebra_rib_create_dest(struct route_node *rn);
+
 /*
  * rib_tables_iter_init
  */
index ad0733115268b404740d6dfab83854c53d162a83..5d98d616456ea97b5f7637d81c33b48936b87531 100644 (file)
@@ -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;