]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_zebra.c
bgpd: add support for l3vpn per-nexthop label
[mirror_frr.git] / bgpd / bgp_zebra.c
index da598993d145480e4520bf5e4da041af82e01dcc..e8455741e37d81a9952befcbf4417ab711224d84 100644 (file)
@@ -3890,3 +3890,26 @@ int bgp_zebra_srv6_manager_release_locator_chunk(const char *name)
 {
        return srv6_manager_release_locator_chunk(zclient, name);
 }
+
+void bgp_zebra_send_nexthop_label(int cmd, mpls_label_t label,
+                                 enum lsp_types_t ltype, struct prefix *p)
+{
+       struct zapi_labels zl = {};
+       struct zapi_nexthop *znh;
+
+       zl.type = ltype;
+       zl.local_label = label;
+       zl.nexthop_num = 1;
+       znh = &zl.nexthops[0];
+       if (p->family == AF_INET)
+               IPV4_ADDR_COPY(&znh->gate.ipv4, &p->u.prefix4);
+       else
+               IPV6_ADDR_COPY(&znh->gate.ipv6, &p->u.prefix6);
+       znh->type =
+               (p->family == AF_INET) ? NEXTHOP_TYPE_IPV4 : NEXTHOP_TYPE_IPV6;
+       znh->ifindex = 0;
+       znh->label_num = 0;
+
+       /* vrf_id is DEFAULT_VRF */
+       zebra_send_mpls_labels(zclient, cmd, &zl);
+}