]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Add function to duplicate nhg dependencies
authorStephen Worley <sworley@cumulusnetworks.com>
Tue, 26 Mar 2019 23:28:23 +0000 (19:28 -0400)
committerStephen Worley <sworley@cumulusnetworks.com>
Fri, 25 Oct 2019 15:13:38 +0000 (11:13 -0400)
Add a function to duplicate a nhg dependency linked
list. We will use this for duplicating the dependency
list rather than the linked list dup function in lib/linkedlist.

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

index 522bf6a9a2538410800ba8c3c5f1a5dbf9f59d6a..43be8e126f69c0cd6dbbe4441b7f30f06e099065 100644 (file)
@@ -96,6 +96,28 @@ struct list *nhg_depend_new_list()
        return nhg_depends;
 }
 
+/**
+ * nhg_depend_dup_list() - Duplicate the dependency linked list
+ *
+ * @from:      List to duplicate
+ *
+ * Return:     New list
+ */
+struct list *nhg_depend_dup_list(struct list *from)
+{
+       struct list *to = NULL;
+       struct listnode *ln = NULL;
+       struct nhg_depend *n_dp = NULL;
+
+       to = nhg_depend_new_list();
+
+       for (ALL_LIST_ELEMENTS_RO(from, ln, n_dp)) {
+               nhg_depend_add(to, n_dp->nhe);
+       }
+
+       return to;
+}
+
 /**
  * zebra_nhg_lookup_id() - Lookup the nexthop group id in the id table
  *
index 634a416e1bef62b50515c01440cddc1bbf8ddba8..559fadf061be817afc5900633a43a7db0c9d35eb 100644 (file)
@@ -90,6 +90,7 @@ extern struct nhg_depend *nhg_depend_new(void);
 extern void nhg_depend_free(struct nhg_depend *depends);
 
 extern struct list *nhg_depend_new_list(void);
+extern struct list *nhg_depend_dup_list(struct list *from);
 
 extern struct nhg_hash_entry *zebra_nhg_lookup_id(uint32_t id);
 extern int zebra_nhg_insert_id(struct nhg_hash_entry *nhe);