]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: check LSP flags when deleting an LSP 6656/head
authorMark Stapp <mjs@voltanet.io>
Tue, 30 Jun 2020 16:47:46 +0000 (12:47 -0400)
committerMark Stapp <mjs@voltanet.io>
Sun, 5 Jul 2020 17:31:39 +0000 (13:31 -0400)
Check the LSP INSTALLED flag in delete apis, to ensure we
enqueue a delete operation for the lfib. Some apis were only
checking the nexthop/nhlfe INSTALLED flags, and those could be
unset if there's an in-flight dataplane update.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
zebra/zebra_mpls.c

index 0a834734402638c32a8a829fdba276a10a56f084..8ee860168991e8a69df9f061c18b8209f90e8ec9 100644 (file)
@@ -1425,6 +1425,9 @@ static int mpls_lsp_uninstall_all(struct hash *lsp_table, zebra_lsp_t *lsp,
        int schedule_lsp = 0;
        char buf[BUFSIZ];
 
+       if (CHECK_FLAG(lsp->flags, LSP_FLAG_INSTALLED))
+               schedule_lsp = 1;
+
        /* Mark NHLFEs for delete or directly delete, as appropriate. */
        frr_each_safe(nhlfe_list, &lsp->nhlfe_list, nhlfe) {
                /* Skip non-static NHLFEs */
@@ -1470,6 +1473,10 @@ static int mpls_lsp_uninstall_all(struct hash *lsp_table, zebra_lsp_t *lsp,
 
        /* Queue LSP for processing, if needed, else delete. */
        if (schedule_lsp) {
+               if (IS_ZEBRA_DEBUG_MPLS) {
+                       zlog_debug("Schedule LSP in-label %u flags 0x%x",
+                                  lsp->ile.in_label, lsp->flags);
+               }
                if (lsp_processq_add(lsp))
                        return -1;
        } else {
@@ -3368,6 +3375,7 @@ int mpls_lsp_uninstall(struct zebra_vrf *zvrf, enum lsp_types_t type,
        zebra_lsp_t *lsp;
        zebra_nhlfe_t *nhlfe;
        char buf[BUFSIZ];
+       bool schedule_lsp = false;
 
        /* Lookup table. */
        lsp_table = zvrf->lsp_table;
@@ -3389,10 +3397,18 @@ int mpls_lsp_uninstall(struct zebra_vrf *zvrf, enum lsp_types_t type,
                           in_label, type, buf, nhlfe->flags);
        }
 
+       if (CHECK_FLAG(lsp->flags, LSP_FLAG_INSTALLED) ||
+           CHECK_FLAG(nhlfe->flags, NHLFE_FLAG_INSTALLED))
+               schedule_lsp = true;
+
        /* Mark NHLFE for delete or directly delete, as appropriate. */
-       if (CHECK_FLAG(nhlfe->flags, NHLFE_FLAG_INSTALLED)) {
-               UNSET_FLAG(nhlfe->flags, NHLFE_FLAG_CHANGED);
+       if (schedule_lsp) {
                SET_FLAG(nhlfe->flags, NHLFE_FLAG_DELETED);
+               UNSET_FLAG(nhlfe->flags, NHLFE_FLAG_CHANGED);
+
+               if (IS_ZEBRA_DEBUG_MPLS)
+                       zlog_debug("Schedule LSP in-label %u flags 0x%x",
+                                  lsp->ile.in_label, lsp->flags);
                if (lsp_processq_add(lsp))
                        return -1;
        } else {
@@ -3400,7 +3416,6 @@ int mpls_lsp_uninstall(struct zebra_vrf *zvrf, enum lsp_types_t type,
 
                /* Free LSP entry if no other NHLFEs and not scheduled. */
                lsp_check_free(lsp_table, &lsp);
-
        }
        return 0;
 }