summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
authorMark Stapp <mjs@voltanet.io>2021-03-24 20:01:50 +0100
committerMark Stapp <mjs@voltanet.io>2021-04-21 20:30:15 +0200
commitc56c16eb2c5c1cd6075c5a01335b5942514ef9d6 (patch)
tree8dc4f8105ce91d9c7510c2dae4f4a42aa310c564 /zebra
parentMerge pull request #8373 from mjstapp/fix_ospf_timeval_dump (diff)
downloadfrr-c56c16eb2c5c1cd6075c5a01335b5942514ef9d6.tar.xz
frr-c56c16eb2c5c1cd6075c5a01335b5942514ef9d6.zip
zebra: fix some issues in recursive backup nexthop code
Fix a couple of small things in the code that captures backup nexthops during recursive resolution. Signed-off-by: Mark Stapp <mjs@voltanet.io>
Diffstat (limited to 'zebra')
-rw-r--r--zebra/zebra_nhg.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c
index 7edf02289..4763d7741 100644
--- a/zebra/zebra_nhg.c
+++ b/zebra/zebra_nhg.c
@@ -1814,9 +1814,6 @@ static int resolve_backup_nexthops(const struct nexthop *nexthop,
assert(nexthop->backup_num <= NEXTHOP_MAX_BACKUPS);
- if (resolve_nhe->backup_info->nhe == NULL)
- resolve_nhe->backup_info->nhe = zebra_nhg_alloc();
-
/* Locate backups from the original nexthop's backup index and nhe */
for (i = 0; i < nexthop->backup_num; i++) {
idx = nexthop->backup_idx[i];
@@ -1832,6 +1829,8 @@ static int resolve_backup_nexthops(const struct nexthop *nexthop,
map->map[j].new_idx;
resolved->backup_num++;
+ SET_FLAG(resolved->flags, NEXTHOP_FLAG_HAS_BACKUP);
+
if (IS_ZEBRA_DEBUG_RIB_DETAILED)
zlog_debug("%s: found map idx orig %d, new %d",
__func__, map->map[j].orig_idx,
@@ -1856,6 +1855,9 @@ static int resolve_backup_nexthops(const struct nexthop *nexthop,
if (bnh == NULL)
continue;
+ if (resolve_nhe->backup_info == NULL)
+ resolve_nhe->backup_info = zebra_nhg_backup_alloc();
+
/* Update backup info in the resolving nexthop and its nhe */
newnh = nexthop_dup_no_recurse(bnh, NULL);
@@ -1871,6 +1873,7 @@ static int resolve_backup_nexthops(const struct nexthop *nexthop,
}
nh->next = newnh;
+ j++;
} else /* First one */
resolve_nhe->backup_info->nhe->nhg.nexthop = newnh;
@@ -1879,6 +1882,8 @@ static int resolve_backup_nexthops(const struct nexthop *nexthop,
resolved->backup_idx[resolved->backup_num] = j;
resolved->backup_num++;
+ SET_FLAG(resolved->flags, NEXTHOP_FLAG_HAS_BACKUP);
+
if (IS_ZEBRA_DEBUG_RIB_DETAILED)
zlog_debug("%s: added idx orig %d, new %d",
__func__, idx, j);