diff options
| author | Mark Stapp <mjs@voltanet.io> | 2020-06-03 17:01:19 -0400 |
|---|---|---|
| committer | Mark Stapp <mjs@voltanet.io> | 2020-07-07 13:25:23 -0400 |
| commit | 5e29e1a10f141be5b96aa778a155045a973f18f3 (patch) | |
| tree | c97ecc78e12cee42ad407ea2d66c10ad72bd6bf8 | |
| parent | cc1b97466800165cc2df506b34414c757a7c646d (diff) | |
zebra: include backup lsp nhlfes in 'active' check
Check backup nhlfes/nexthops for 'active' status when checking
an LSP. Also tweak the show command output for backup nhlfes
slightly.
Signed-off-by: Mark Stapp <mjs@voltanet.io>
| -rw-r--r-- | zebra/zebra_mpls.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c index f203405cc9..9f9ec04314 100644 --- a/zebra/zebra_mpls.c +++ b/zebra/zebra_mpls.c @@ -804,8 +804,7 @@ static void lsp_select_best_nhlfe(zebra_lsp_t *lsp) /* * First compute the best path, after checking nexthop status. We are - * only - * concerned with non-deleted NHLFEs. + * only concerned with non-deleted NHLFEs. */ frr_each_safe(nhlfe_list, &lsp->nhlfe_list, nhlfe) { /* Clear selection flags. */ @@ -823,6 +822,14 @@ static void lsp_select_best_nhlfe(zebra_lsp_t *lsp) if (!lsp->best_nhlfe) return; + /* + * Check the active status of backup nhlfes also + */ + frr_each_safe(nhlfe_list, &lsp->backup_nhlfe_list, nhlfe) { + if (!CHECK_FLAG(nhlfe->flags, NHLFE_FLAG_DELETED)) + (void)nhlfe_nexthop_active(nhlfe); + } + /* Mark best NHLFE as selected. */ SET_FLAG(lsp->best_nhlfe->flags, NHLFE_FLAG_SELECTED); @@ -917,9 +924,9 @@ static wq_item_status lsp_process(struct work_queue *wq, void *data) if (IS_ZEBRA_DEBUG_MPLS) { if (oldbest) - nhlfe2str(oldbest, buf, BUFSIZ); + nhlfe2str(oldbest, buf, sizeof(buf)); if (newbest) - nhlfe2str(newbest, buf2, BUFSIZ); + nhlfe2str(newbest, buf2, sizeof(buf2)); zlog_debug( "Process LSP in-label %u oldbest %s newbest %s " "flags 0x%x ecmp# %d", @@ -1574,6 +1581,9 @@ static void nhlfe_print(zebra_nhlfe_t *nhlfe, struct vty *vty) break; } vty_out(vty, "%s", + CHECK_FLAG(nhlfe->flags, NHLFE_FLAG_IS_BACKUP) ? " (backup)" + : ""); + vty_out(vty, "%s", CHECK_FLAG(nhlfe->flags, NHLFE_FLAG_INSTALLED) ? " (installed)" : ""); vty_out(vty, "\n"); @@ -1600,6 +1610,7 @@ static void lsp_print(struct vty *vty, zebra_lsp_t *lsp) /* Find backup in backup list */ i = 0; + backup = NULL; frr_each(nhlfe_list, &lsp->backup_nhlfe_list, backup) { if (i == nhlfe->nexthop->backup_idx) break; |
