]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: add debug for duplicate NH in dataplane array conversion
authorStephen Worley <sworley@cumulusnetworks.com>
Tue, 28 Jan 2020 20:20:18 +0000 (15:20 -0500)
committerStephen Worley <sworley@cumulusnetworks.com>
Fri, 3 Apr 2020 19:12:15 +0000 (15:12 -0400)
When we find a nexthop ID thats a duplicate in the code that converts
NHG rb trees into a flat list of nexthop IDs for the dataplane,
output a debug message.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
(cherry picked from commit b1c3f7ef80fb626a15a1043b4c46f53c3fd34826)

zebra/zebra_nhg.c

index a5aaa828f46e8ea70158ab620bb232d9b809dcf3..cffbc9f061f78cd16ebc259c4215e981bc6a59ae 100644 (file)
@@ -1868,17 +1868,24 @@ static uint8_t zebra_nhg_nhe2grp_internal(struct nh_grp *grp,
                                continue;
                        }
 
-                       /* Check for duplicate IDs, kernel doesn't like that */
+                       /* Check for duplicate IDs, ignore if found. */
                        for (int j = 0; j < i; j++) {
                                if (depend->id == grp[j].id)
                                        duplicate = true;
                        }
 
-                       if (!duplicate) {
-                               grp[i].id = depend->id;
-                               grp[i].weight = depend->nhg->nexthop->weight;
-                               i++;
+                       if (duplicate) {
+                               if (IS_ZEBRA_DEBUG_RIB_DETAILED
+                                   || IS_ZEBRA_DEBUG_NHG)
+                                       zlog_debug(
+                                               "%s: Nexthop ID (%u) is duplicate, not appending to dataplane install group",
+                                               __func__, depend->id);
+                               continue;
                        }
+
+                       grp[i].id = depend->id;
+                       grp[i].weight = depend->nhg->nexthop->weight;
+                       i++;
                }
        }