Skip to content

Commit

Permalink
zebra: don't add ID to kernel nh_grp if not installed/queued
Browse files Browse the repository at this point in the history
When we transform the nexthop group rb trees into a flat
array of IDs to send into the dataplane code (zebra_nhg_nhe2grp),
don't put an ID in there that has not been in installed or is
not currently queued to be installed into the dataplane.

Otherwise, if some of the nexthops fail to install, we will
still try to create a group with them and then the entire group
will fail.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
(cherry picked from commit 1866b3a)
  • Loading branch information
sworleys committed Apr 3, 2020
1 parent 31be021 commit ee2833a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions zebra/zebra_nhg.c
Expand Up @@ -1854,6 +1854,20 @@ static uint8_t zebra_nhg_nhe2grp_internal(struct nh_grp *grp,
/* This is a group within a group */
i = zebra_nhg_nhe2grp_internal(grp, i, depend, max_num);
} else {
/* If the nexthop not installed/queued for install don't
* put in the ID array.
*/
if (!(CHECK_FLAG(depend->flags, NEXTHOP_GROUP_INSTALLED)
|| CHECK_FLAG(depend->flags,
NEXTHOP_GROUP_QUEUED))) {
if (IS_ZEBRA_DEBUG_RIB_DETAILED
|| IS_ZEBRA_DEBUG_NHG)
zlog_debug(
"%s: Nexthop ID (%u) not installed or queued for install, not appending to dataplane install group",
__func__, depend->id);
continue;
}

/* Check for duplicate IDs, kernel doesn't like that */
for (int j = 0; j < i; j++) {
if (depend->id == grp[j].id)
Expand Down

0 comments on commit ee2833a

Please sign in to comment.