diff options
| author | Stephen Worley <sworley@cumulusnetworks.com> | 2019-03-08 10:16:52 -0500 |
|---|---|---|
| committer | Stephen Worley <sworley@cumulusnetworks.com> | 2019-10-25 11:13:37 -0400 |
| commit | 8e7663796904f12ab31320d8d5a056da158483fe (patch) | |
| tree | aa577bbaaf05a53ff5154e88de61b4e6088db53e /zebra/zebra_rib.c | |
| parent | 5f3c9e520c71993ca65a9aaafd9db715eda0b2e5 (diff) | |
zebra: Route entries use nexthop entry ID's instead of pointers
Switched the route entries to use ID's instead of pointers.
Perform lookups with the ID and then check if its null.
Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
Diffstat (limited to 'zebra/zebra_rib.c')
| -rw-r--r-- | zebra/zebra_rib.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 3b3bf921bc..5f942a7ecf 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -2396,7 +2396,7 @@ static void rib_addnode(struct route_node *rn, void rib_unlink(struct route_node *rn, struct route_entry *re) { rib_dest_t *dest; - rib_table_info_t *info; + struct nhg_hash_entry *nhe = NULL; assert(rn && re); @@ -2411,7 +2411,9 @@ void rib_unlink(struct route_node *rn, struct route_entry *re) if (dest->selected_fib == re) dest->selected_fib = NULL; - zebra_nhg_decrement_ref(re->nhe); + nhe = zebra_nhg_lookup_id(re->nhe_id); + if (nhe) + zebra_nhg_decrement_ref(nhe); // TODO: We need to hold on nh's until refcnt is 0 right? nexthops_free(re->ng->nexthop); @@ -2638,6 +2640,7 @@ int rib_add_multipath(afi_t afi, safi_t safi, struct prefix *p, struct route_table *table; struct route_node *rn; struct route_entry *same = NULL; + struct nhg_hash_entry *nhe = NULL; int ret = 0; if (!re) @@ -2659,8 +2662,11 @@ int rib_add_multipath(afi_t afi, safi_t safi, struct prefix *p, if (src_p) apply_mask_ipv6(src_p); - re->nhe = zebra_nhg_find(re->ng, re->vrf_id, 0); - re->nhe->refcnt++; + nhe = zebra_nhg_find(re->ng, re->vrf_id, 0); + + re->nhe_id = nhe->id; + nhe->refcnt++; + /* Set default distance by route type. */ if (re->distance == 0) re->distance = route_distance(re->type); |
