mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-05 08:23:56 +00:00
zebra: Resolved nh change, inc refcnt by rt refcnt
When the resolved nexthop changes, we should increment the new resolved NHE by the refcnt for the unresolved NHE being used by the routes and decrement the old one by the same amount. Before, we were simple incrementing by one, causing incorrect refcnts to occur. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
This commit is contained in:
parent
1e9aad82ba
commit
9834bb52ae
@ -1364,13 +1364,12 @@ int nexthop_active_update(struct route_node *rn, struct route_entry *re)
|
||||
/* Add new resolved */
|
||||
zebra_nhg_depends_add(nhe, new_resolved);
|
||||
zebra_nhg_dependents_add(new_resolved, nhe);
|
||||
/*
|
||||
* In case the new == old, we increment
|
||||
* first and then decrement
|
||||
*/
|
||||
zebra_nhg_increment_ref(new_resolved);
|
||||
if (old_resolved)
|
||||
zebra_nhg_decrement_ref(old_resolved);
|
||||
|
||||
if (old_resolved && new_resolved->id != old_resolved->id) {
|
||||
new_resolved->refcnt+=nhe->refcnt;
|
||||
old_resolved->refcnt-=nhe->refcnt;
|
||||
} else if (!old_resolved)
|
||||
zebra_nhg_increment_ref(new_resolved);
|
||||
|
||||
SET_FLAG(nhe->flags, NEXTHOP_GROUP_RECURSIVE);
|
||||
} else
|
||||
|
Loading…
Reference in New Issue
Block a user