diff --git a/lib/zclient.c b/lib/zclient.c index d748bef335..42d5c33a1b 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -1035,6 +1035,7 @@ int zapi_nexthop_encode(struct stream *s, const struct zapi_nexthop *api_nh, */ if (api_nh->label_num > 0) { stream_putc(s, api_nh->label_num); + stream_putc(s, api_nh->label_type); stream_put(s, &api_nh->labels[0], api_nh->label_num * sizeof(mpls_label_t)); } @@ -1397,6 +1398,7 @@ int zapi_nexthop_decode(struct stream *s, struct zapi_nexthop *api_nh, /* MPLS labels for BGP-LU or Segment Routing */ if (CHECK_FLAG(api_nh->flags, ZAPI_NEXTHOP_FLAG_LABEL)) { STREAM_GETC(s, api_nh->label_num); + STREAM_GETC(s, api_nh->label_type); if (api_nh->label_num > MPLS_MAX_LABELS) { flog_err( EC_LIB_ZAPI_ENCODE, @@ -1948,6 +1950,7 @@ int zapi_nexthop_from_nexthop(struct zapi_nexthop *znh, znh->labels[i] = nh->nh_label->label[i]; znh->label_num = i; + znh->label_type = nh->nh_label_type; SET_FLAG(znh->flags, ZAPI_NEXTHOP_FLAG_LABEL); } diff --git a/lib/zclient.h b/lib/zclient.h index 8c4ce1b777..55957e4bee 100644 --- a/lib/zclient.h +++ b/lib/zclient.h @@ -427,6 +427,7 @@ struct zapi_nexthop { /* MPLS labels for BGP-LU or Segment Routing */ uint8_t label_num; + enum lsp_types_t label_type; mpls_label_t labels[MPLS_MAX_LABELS]; struct ethaddr rmac; diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index 3288373dbe..15b5790923 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -1785,8 +1785,9 @@ static bool zapi_read_nexthops(struct zserv *client, struct prefix *p, && api_nh->type != NEXTHOP_TYPE_BLACKHOLE && api_nh->label_num > 0) { - if (CHECK_FLAG(flags, ZEBRA_FLAG_EVPN_ROUTE)) - label_type = ZEBRA_LSP_EVPN; + /* If label type was passed, use it */ + if (api_nh->label_type) + label_type = api_nh->label_type; else label_type = lsp_type_from_re_type(client->proto);