diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2019-02-15 11:39:12 -0500 |
|---|---|---|
| committer | Stephen Worley <sworley@cumulusnetworks.com> | 2019-10-25 11:13:36 -0400 |
| commit | 9a0d4dd39be7cbed048e45b5a27ceb81608d76f6 (patch) | |
| tree | 6f99e0b22fb96b36e6c84876cd863336410b0d0b /zebra/zebra_nhg.c | |
| parent | eecacedc3b9526b59ef690bce41f41158a137c9f (diff) | |
zebra: Remove nexthop_active_num from route entry
The nexthop_active_num data structure is a property of the
nexthop group. Move the keeping of this data to that.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'zebra/zebra_nhg.c')
| -rw-r--r-- | zebra/zebra_nhg.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index 407e29f8c3..569bc6e5ec 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -644,9 +644,8 @@ static unsigned nexthop_active_check(struct route_node *rn, /* * Iterate over all nexthops of the given RIB entry and refresh their - * ACTIVE flag. re->nexthop_active_num is updated accordingly. If any - * nexthop is found to toggle the ACTIVE flag, the whole re structure - * is flagged with ROUTE_ENTRY_CHANGED. + * ACTIVE flag. If any nexthop is found to toggle the ACTIVE flag, + * the whole re structure is flagged with ROUTE_ENTRY_CHANGED. * * Return value is the new number of active nexthops. */ @@ -656,8 +655,8 @@ int nexthop_active_update(struct route_node *rn, struct route_entry *re) union g_addr prev_src; unsigned int prev_active, new_active; ifindex_t prev_index; + uint8_t curr_active = 0; - re->nexthop_active_num = 0; UNSET_FLAG(re->status, ROUTE_ENTRY_CHANGED); for (nexthop = re->ng->nexthop; nexthop; nexthop = nexthop->next) { @@ -674,12 +673,15 @@ int nexthop_active_update(struct route_node *rn, struct route_entry *re) */ new_active = nexthop_active_check(rn, re, nexthop); if (new_active - && re->nexthop_active_num >= zrouter.multipath_num) { + && nexthop_group_active_nexthop_num(re->ng) + >= zrouter.multipath_num) { UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE); new_active = 0; } + if (new_active) - re->nexthop_active_num++; + curr_active++; + /* Don't allow src setting on IPv6 addr for now */ if (prev_active != new_active || prev_index != nexthop->ifindex || ((nexthop->type >= NEXTHOP_TYPE_IFINDEX @@ -694,5 +696,5 @@ int nexthop_active_update(struct route_node *rn, struct route_entry *re) SET_FLAG(re->status, ROUTE_ENTRY_CHANGED); } - return re->nexthop_active_num; + return curr_active; } |
