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>
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
*
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);