]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Move resolve/add depend install into api
authorStephen Worley <sworley@cumulusnetworks.com>
Thu, 25 Jul 2019 15:45:19 +0000 (11:45 -0400)
committerStephen Worley <sworley@cumulusnetworks.com>
Fri, 25 Oct 2019 15:13:41 +0000 (11:13 -0400)
Move the resolving and installing of a single nhg_hash_entry
into the install function itself, rather than letting zebra_rib
handle it.

Further, ensure depends are installed/queued before installing
a group. The ordering should be find here since only one thread
will call this API.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
zebra/zebra_nhg.c
zebra/zebra_rib.c

index a28f183895f9d263c5cabe6cb5f43b49a51faa0d..5179533e750cb049a6310d4615d1a609f4a89488 100644 (file)
@@ -1475,6 +1475,16 @@ uint8_t zebra_nhg_nhe2grp(struct nh_grp *grp, struct nhg_hash_entry *nhe)
 
 void zebra_nhg_install_kernel(struct nhg_hash_entry *nhe)
 {
+       struct nhg_connected *rb_node_dep = NULL;
+
+       /* Resolve it first */
+       nhe = zebra_nhg_resolve(nhe);
+
+       /* Make sure all depends are installed/queued */
+       frr_each (nhg_connected_tree, &nhe->nhg_depends, rb_node_dep) {
+               zebra_nhg_install_kernel(rb_node_dep->nhe);
+       }
+
        if (!CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_INSTALLED)
            && !CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_QUEUED)) {
                nhe->is_kernel_nh = false;
index 67b4afb3a5106300da03297ad312e8297f71d325..6827be70724ece9b1bdfdb70392c71b1dd42f49d 100644 (file)
@@ -519,7 +519,6 @@ void rib_install_kernel(struct route_node *rn, struct route_entry *re,
        struct zebra_vrf *zvrf = vrf_info_lookup(re->vrf_id);
        const struct prefix *p, *src_p;
        enum zebra_dplane_result ret;
-       struct nhg_hash_entry *nhe;
 
        rib_dest_t *dest = rib_dest_from_rnode(rn);
 
@@ -549,9 +548,7 @@ void rib_install_kernel(struct route_node *rn, struct route_entry *re,
        /*
         * Install the resolved nexthop object first.
         */
-       nhe = zebra_nhg_resolve(zebra_nhg_lookup_id(re->nhe_id));
-       if (!nhe->is_kernel_nh)
-               zebra_nhg_install_kernel(nhe);
+       zebra_nhg_install_kernel(zebra_nhg_lookup_id(re->nhe_id));
 
        /*
         * If this is a replace to a new RE let the originator of the RE