zebra: A group isn't recursive if one depend is

We were setting a group to be recursive if its first depend
was. This is not the case; individual depends of the group
might be recursive but the group itself is not.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
This commit is contained in:
Stephen Worley 2019-07-25 13:18:27 -04:00
parent f429bd1b24
commit 904ba1c8ee

View File

@ -720,6 +720,7 @@ zebra_nhg_rib_find(uint32_t id, struct nexthop_group *nhg, afi_t rt_afi)
{ {
struct nhg_hash_entry *nhe = NULL; struct nhg_hash_entry *nhe = NULL;
struct nhg_connected_tree_head nhg_depends = {}; struct nhg_connected_tree_head nhg_depends = {};
bool recursive = false;
/* Defualt the nhe to the afi and vrf of the route */ /* Defualt the nhe to the afi and vrf of the route */
afi_t nhg_afi = rt_afi; afi_t nhg_afi = rt_afi;
@ -747,12 +748,13 @@ zebra_nhg_rib_find(uint32_t id, struct nexthop_group *nhg, afi_t rt_afi)
nhg_connected_tree_init(&nhg_depends); nhg_connected_tree_init(&nhg_depends);
handle_recursive_depend(&nhg_depends, nhg->nexthop->resolved, handle_recursive_depend(&nhg_depends, nhg->nexthop->resolved,
rt_afi); rt_afi);
recursive = true;
} }
if (!zebra_nhg_find(&nhe, id, nhg, &nhg_depends, nhg_vrf_id, nhg_afi, if (!zebra_nhg_find(&nhe, id, nhg, &nhg_depends, nhg_vrf_id, nhg_afi,
false)) false))
depends_decrement_free(&nhg_depends); depends_decrement_free(&nhg_depends);
else if (CHECK_FLAG(nhg->nexthop->flags, NEXTHOP_FLAG_RECURSIVE)) else if (recursive)
SET_FLAG(nhe->flags, NEXTHOP_GROUP_RECURSIVE); SET_FLAG(nhe->flags, NEXTHOP_GROUP_RECURSIVE);
return nhe; return nhe;