]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: don't add ID to kernel nh_grp if not installed/queued
authorStephen Worley <sworley@cumulusnetworks.com>
Tue, 28 Jan 2020 19:33:10 +0000 (14:33 -0500)
committerStephen Worley <sworley@cumulusnetworks.com>
Fri, 3 Apr 2020 19:00:38 +0000 (15:00 -0400)
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 1866b3afc259c565f42a9aab262ede27c142eea4)

zebra/zebra_nhg.c

index 1cdd2fe66b06d95117cac70e931114a54577b5e3..a5aaa828f46e8ea70158ab620bb232d9b809dcf3 100644 (file)
@@ -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)