]> git.proxmox.com Git - mirror_frr.git/blobdiff - zebra/zebra_mpls.c
Merge pull request #8639 from idryzhov/isis-new-bfd-lib
[mirror_frr.git] / zebra / zebra_mpls.c
index a87951353922da26a92d8810206caa0237c1a4dd..850ca1763682fc9cfd23f3f877e9857260572b82 100644 (file)
@@ -44,7 +44,6 @@
 #include "zebra/zebra_router.h"
 #include "zebra/redistribute.h"
 #include "zebra/debug.h"
-#include "zebra/zebra_memory.h"
 #include "zebra/zebra_vrf.h"
 #include "zebra/zebra_mpls.h"
 #include "zebra/zebra_srte.h"
@@ -873,6 +872,22 @@ static void lsp_schedule(struct hash_bucket *bucket, void *ctxt)
        zebra_lsp_t *lsp;
 
        lsp = (zebra_lsp_t *)bucket->data;
+
+       /* In the common flow, this is used when external events occur. For
+        * LSPs with backup nhlfes, we'll assume that the forwarding
+        * plane will use the backups to handle these events, until the
+        * owning protocol can react.
+        */
+       if (ctxt == NULL) {
+               /* Skip LSPs with backups */
+               if (nhlfe_list_first(&lsp->backup_nhlfe_list) != NULL) {
+                       if (IS_ZEBRA_DEBUG_MPLS_DETAIL)
+                               zlog_debug("%s: skip LSP in-label %u",
+                                          __func__, lsp->ile.in_label);
+                       return;
+               }
+       }
+
        (void)lsp_processq_add(lsp);
 }
 
@@ -2003,6 +2018,7 @@ void zebra_mpls_process_dplane_notify(struct zebra_dplane_ctx *ctx)
        int start_count = 0, end_count = 0; /* Installed counts */
        bool changed_p = false;
        bool is_debug = (IS_ZEBRA_DEBUG_DPLANE | IS_ZEBRA_DEBUG_MPLS);
+       enum zebra_sr_policy_update_label_mode update_mode;
 
        if (is_debug)
                zlog_debug("LSP dplane notif, in-label %u",
@@ -2076,10 +2092,21 @@ void zebra_mpls_process_dplane_notify(struct zebra_dplane_ctx *ctx)
        if (end_count > 0) {
                SET_FLAG(lsp->flags, LSP_FLAG_INSTALLED);
 
+               /* SR-TE update too */
+               if (start_count == 0)
+                       update_mode = ZEBRA_SR_POLICY_LABEL_CREATED;
+               else
+                       update_mode = ZEBRA_SR_POLICY_LABEL_UPDATED;
+               zebra_sr_policy_label_update(lsp->ile.in_label, update_mode);
+
                if (changed_p)
                        dplane_lsp_notif_update(lsp, DPLANE_OP_LSP_UPDATE, ctx);
 
        } else {
+               /* SR-TE update too */
+               zebra_sr_policy_label_update(lsp->ile.in_label,
+                                            ZEBRA_SR_POLICY_LABEL_REMOVED);
+
                UNSET_FLAG(lsp->flags, LSP_FLAG_INSTALLED);
                clear_nhlfe_installed(lsp);
        }
@@ -3925,11 +3952,18 @@ void zebra_mpls_close_tables(struct zebra_vrf *zvrf)
  */
 void zebra_mpls_init_tables(struct zebra_vrf *zvrf)
 {
+       char buffer[80];
+
        if (!zvrf)
                return;
-       zvrf->slsp_table =
-               hash_create(label_hash, label_cmp, "ZEBRA SLSP table");
-       zvrf->lsp_table = hash_create(label_hash, label_cmp, "ZEBRA LSP table");
+
+       snprintf(buffer, sizeof(buffer), "ZEBRA SLSP table: %s",
+                zvrf->vrf->name);
+       zvrf->slsp_table = hash_create_size(8, label_hash, label_cmp, buffer);
+
+       snprintf(buffer, sizeof(buffer), "ZEBRA LSP table: %s",
+                zvrf->vrf->name);
+       zvrf->lsp_table = hash_create_size(8, label_hash, label_cmp, buffer);
        zvrf->fec_table[AFI_IP] = route_table_init();
        zvrf->fec_table[AFI_IP6] = route_table_init();
        zvrf->mpls_flags = 0;