]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: Recursively decrement refcnt on nhe's
authorStephen Worley <sworley@cumulusnetworks.com>
Fri, 29 Mar 2019 22:16:27 +0000 (18:16 -0400)
committerStephen Worley <sworley@cumulusnetworks.com>
Fri, 25 Oct 2019 15:13:39 +0000 (11:13 -0400)
Recursively decrement the refcnt on nhg_hash_entry's of
groups.

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

index a296671068a1692b5ba1ec1d54dc22741d709c92..978870359dd2760c00cbda8efe86624a289623f2 100644 (file)
@@ -517,6 +517,15 @@ void zebra_nhg_release(struct nhg_hash_entry *nhe)
  */
 void zebra_nhg_decrement_ref(struct nhg_hash_entry *nhe)
 {
+       if (nhe->nhg_depends) {
+               struct listnode *ln = NULL;
+               struct nhg_depend *n_dp = NULL;
+
+               for (ALL_LIST_ELEMENTS_RO(nhe->nhg_depends, ln, n_dp)) {
+                       zebra_nhg_decrement_ref(n_dp->nhe);
+               }
+       }
+
        nhe->refcnt--;
 
        if (!nhe->is_kernel_nh && nhe->refcnt <= 0) {