summaryrefslogtreecommitdiff
path: root/zebra/zebra_rib.c
diff options
context:
space:
mode:
authorStephen Worley <sworley@cumulusnetworks.com>2019-03-29 10:56:52 -0400
committerStephen Worley <sworley@cumulusnetworks.com>2019-10-25 11:13:39 -0400
commit20822f9d2e450cebfefbb14cc70a189a52df063c (patch)
tree11cc9842b26e852f55a323994e5439a6a73c3a75 /zebra/zebra_rib.c
parent148a0103c6176b5bb3f3dff531ed06dda754f3c7 (diff)
zebra: Add equivalence function for nhg_depends
Add a helper function to allow us to check if two nhg_hash_entry's dependency lists are equal. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
Diffstat (limited to 'zebra/zebra_rib.c')
-rw-r--r--zebra/zebra_rib.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index a5b939baa9..558dbd33e0 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -2638,6 +2638,7 @@ int rib_add_multipath(afi_t afi, safi_t safi, struct prefix *p,
struct route_node *rn;
struct route_entry *same = NULL;
struct nhg_hash_entry *nhe = NULL;
+ struct list *nhg_depends = NULL;
int ret = 0;
if (!re)
@@ -2648,7 +2649,7 @@ int rib_add_multipath(afi_t afi, safi_t safi, struct prefix *p,
/* Lookup table. */
table = zebra_vrf_table_with_table_id(afi, safi, re->vrf_id, re->table);
if (!table) {
- zebra_nhg_free_group_depends(re->ng, NULL);
+ zebra_nhg_free_group_depends(re->ng, nhg_depends);
XFREE(MTYPE_RE, re);
return 0;
}
@@ -2658,11 +2659,29 @@ int rib_add_multipath(afi_t afi, safi_t safi, struct prefix *p,
if (src_p)
apply_mask_ipv6(src_p);
- nhe = zebra_nhg_find(re->ng, re->vrf_id, afi, re->nhe_id, NULL, 0);
+ /* If its a group, create a dependency list */
+ if (re->ng && re->ng->nexthop->next) {
+ struct nexthop *nh = NULL;
+ struct nexthop lookup = {0};
+ struct nhg_hash_entry *depend = NULL;
+
+ nhg_depends = nhg_depend_new_list();
+
+ for (ALL_NEXTHOPS_PTR(re->ng, nh)) {
+ lookup = *nh;
+ /* Clear it, since its a group */
+ lookup.next = NULL;
+ depend = zebra_nhg_find_nexthop(&lookup, afi);
+ nhg_depend_add(nhg_depends, depend);
+ }
+ }
+
+ nhe = zebra_nhg_find(re->ng, re->vrf_id, afi, re->nhe_id, nhg_depends,
+ false);
if (nhe) {
// TODO: Add interface pointer
- zebra_nhg_free_group_depends(re->ng, NULL);
+ zebra_nhg_free_group_depends(re->ng, nhg_depends);
re->ng = nhe->nhg;
re->nhe_id = nhe->id;
nhe->refcnt++;