From: Stephen Worley Date: Tue, 28 Jan 2020 20:20:18 +0000 (-0500) Subject: zebra: add debug for duplicate NH in dataplane array conversion X-Git-Tag: frr-7.3.1~11^2~6 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=e976083a73c2fae2b114479102fb1db2a6ceeaaf;p=matthieu%2Ffrr.git zebra: add debug for duplicate NH in dataplane array conversion 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 (cherry picked from commit b1c3f7ef80fb626a15a1043b4c46f53c3fd34826) --- diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index a5aaa828f4..cffbc9f061 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -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++; } }