From: Mark Stapp Date: Tue, 30 Jun 2020 16:47:46 +0000 (-0400) Subject: zebra: check LSP flags when deleting an LSP X-Git-Tag: base_7.5~218^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=refs%2Fpull%2F6656%2Fhead;p=mirror%2Ffrr.git zebra: check LSP flags when deleting an LSP 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 --- diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c index 0a83473440..8ee8601689 100644 --- a/zebra/zebra_mpls.c +++ b/zebra/zebra_mpls.c @@ -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; }