From: Stephen Worley Date: Thu, 21 Nov 2019 20:27:12 +0000 (-0500) Subject: zebra: Use curr_active to check multipath_num X-Git-Tag: base_7.3~142^2~1 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=08de78b876070eab4a358d262e23095fe973437a;p=mirror%2Ffrr.git zebra: Use curr_active to check multipath_num We were re-counting the entire group's active number on every iteration of this nexthop_active_update() loop. This is not great from a performance perspective but also it was failing to properly mark things according to the specified multipath_num. Since a nexthop is set as active before this check, if its == to the set ecmp, it gets marked inactive even though if its under the max ecmp wanted! ex) set ecmp to 1. `/usr/lib/frr/zebra -e 1` All kernel routes will be marked inactive even with just one nexthop! K 1.1.1.1/32 [0/0] is directly connected, dummy1 inactive, 00:00:10 K 1.1.1.2/32 [0/0] is directly connected, dummy2 inactive, 00:00:10 K 1.1.1.3/32 [0/0] is directly connected, dummy3 inactive, 00:00:10 K 1.1.1.4/32 [0/0] is directly connected, dummy4 inactive, 00:00:10 K 1.1.1.5/32 [0/0] is directly connected, dummy5 inactive, 00:00:10 K 1.1.1.6/32 [0/0] is directly connected, dummy6 inactive, 00:00:10 K 1.1.1.7/32 [0/0] is directly connected, dummy7 inactive, 00:00:10 K 1.1.1.8/32 [0/0] is directly connected, dummy8 inactive, 00:00:10 K 1.1.1.9/32 [0/0] is directly connected, dummy9 inactive, 00:00:10 Signed-off-by: Stephen Worley --- diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index 2d7521d8be..019c228918 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -1675,9 +1675,7 @@ int nexthop_active_update(struct route_node *rn, struct route_entry *re) new_active = nexthop_active_check(rn, re, nexthop); - if (new_active - && nexthop_group_active_nexthop_num(&new_grp) - >= zrouter.multipath_num) { + if (new_active && curr_active >= zrouter.multipath_num) { UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE); new_active = 0; }