]> git.proxmox.com Git - mirror_frr.git/blobdiff - isisd/isis_zebra.c
isisd, tests: fix bug when sending TI-LFA repair paths to zebra
[mirror_frr.git] / isisd / isis_zebra.c
index e33b8c628d0d5e4ce8d15d4474cfd15adc51fd9a..1b4b0c8f2fe8ef1d7d31e607b30e92a474fc48cd 100644 (file)
@@ -207,35 +207,30 @@ static int isis_zebra_add_nexthops(struct isis *isis, struct list *nexthops,
                api_nh->ifindex = nexthop->ifindex;
 
                /* Add MPLS label(s). */
-               switch (type) {
-               case ISIS_NEXTHOP_MAIN:
-                       if (nexthop->sr.present) {
-                               api_nh->label_num = 1;
-                               api_nh->labels[0] = nexthop->sr.label;
-                       } else if (mpls_lsp)
+               if (nexthop->label_stack) {
+                       api_nh->label_num = nexthop->label_stack->num_labels;
+                       memcpy(api_nh->labels, nexthop->label_stack->label,
+                              sizeof(mpls_label_t) * api_nh->label_num);
+               } else if (nexthop->sr.present) {
+                       api_nh->label_num = 1;
+                       api_nh->labels[0] = nexthop->sr.label;
+               } else if (mpls_lsp) {
+                       switch (type) {
+                       case ISIS_NEXTHOP_MAIN:
                                /*
                                 * Do not use non-SR enabled nexthops to prevent
                                 * broken LSPs from being formed.
                                 */
                                continue;
-                       break;
-               case ISIS_NEXTHOP_BACKUP:
-                       if (nexthop->label_stack) {
-                               api_nh->label_num =
-                                       nexthop->label_stack->num_labels;
-                               memcpy(api_nh->labels,
-                                      nexthop->label_stack->label,
-                                      sizeof(mpls_label_t)
-                                              * api_nh->label_num);
-                       } else if (mpls_lsp) {
+                       case ISIS_NEXTHOP_BACKUP:
                                /*
                                 * This is necessary because zebra requires
                                 * the nexthops of MPLS LSPs to be labeled.
                                 */
                                api_nh->label_num = 1;
                                api_nh->labels[0] = MPLS_LABEL_IMPLICIT_NULL;
+                               break;
                        }
-                       break;
                }
 
                /* Backup nexthop handling. */