]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: include backup lsp nhlfes in 'active' check
authorMark Stapp <mjs@voltanet.io>
Wed, 3 Jun 2020 21:01:19 +0000 (17:01 -0400)
committerMark Stapp <mjs@voltanet.io>
Tue, 7 Jul 2020 17:25:23 +0000 (13:25 -0400)
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>
zebra/zebra_mpls.c

index f203405cc9c192dda23fba81bf087e9ba3539d38..9f9ec04314206795d9e2efaeac6ab3bf146be47e 100644 (file)
@@ -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",
@@ -1573,6 +1580,9 @@ static void nhlfe_print(zebra_nhlfe_t *nhlfe, struct vty *vty)
        default:
                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)"
                                                               : "");
@@ -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;