From 054af19a41827394bccff0eb1c235355c654c1e0 Mon Sep 17 00:00:00 2001 From: Mark Stapp Date: Fri, 6 Dec 2019 13:44:15 -0500 Subject: [PATCH] lib,sharpd: support labelled nexthop-groups in sharpd Update sharpd's zapi client code to support labelled nexthops if they're present in a nexthop-group. Signed-off-by: Mark Stapp --- lib/nexthop.c | 3 +++ sharpd/sharp_zebra.c | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/lib/nexthop.c b/lib/nexthop.c index f314fea69..ce8034846 100644 --- a/lib/nexthop.c +++ b/lib/nexthop.c @@ -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) diff --git a/sharpd/sharp_zebra.c b/sharpd/sharp_zebra.c index cd577e905..797398c79 100644 --- a/sharpd/sharp_zebra.c +++ b/sharpd/sharp_zebra.c @@ -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; -- 2.39.5