]> git.proxmox.com Git - mirror_frr.git/commitdiff
lib,sharpd: support labelled nexthop-groups in sharpd
authorMark Stapp <mjs@voltanet.io>
Fri, 6 Dec 2019 18:44:15 +0000 (13:44 -0500)
committerMark Stapp <mjs@voltanet.io>
Fri, 6 Dec 2019 18:49:25 +0000 (13:49 -0500)
Update sharpd's zapi client code to support labelled nexthops if
they're present in a nexthop-group.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
lib/nexthop.c
sharpd/sharp_zebra.c

index f314fea69738060caa4250d9787466fdfd19ecb7..ce8034846fbb2c238cf28256a8df046441075c54 100644 (file)
@@ -376,6 +376,9 @@ void nexthop_add_labels(struct nexthop *nexthop, enum lsp_types_t type,
        struct mpls_label_stack *nh_label;
        int i;
 
+       if (num_labels == 0)
+               return;
+
        nexthop->nh_label_type = type;
        nh_label = XCALLOC(MTYPE_NH_LABEL,
                           sizeof(struct mpls_label_stack)
index cd577e9051e851ad9ef54c77825bc21d5e52cc86..797398c79134a32a8112db52997bbb3b35a7d166 100644 (file)
@@ -265,6 +265,17 @@ void route_add(struct prefix *p, vrf_id_t vrf_id,
                        api_nh->bh_type = nh->bh_type;
                        break;
                }
+
+               if (nh->nh_label && nh->nh_label->num_labels > 0) {
+                       int j;
+
+                       SET_FLAG(api_nh->flags, ZAPI_NEXTHOP_FLAG_LABEL);
+
+                       api_nh->label_num = nh->nh_label->num_labels;
+                       for (j = 0; j < nh->nh_label->num_labels; j++)
+                               api_nh->labels[j] = nh->nh_label->label[j];
+               }
+
                i++;
        }
        api.nexthop_num = i;