From cc8f05dfdc6dd8bcf6c6e716b444e12172214a16 Mon Sep 17 00:00:00 2001 From: Ryoga Saito Date: Tue, 31 Aug 2021 06:56:00 +0000 Subject: [PATCH] bgpd: add transpose operation if advertisement with SID structure Sub-Sub-TLV, we need to transpose SID, so added transpose operation into bgp_update. Signed-off-by: Ryoga Saito --- bgpd/bgp_route.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index f97a791dae..7e5521ad2d 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -4044,6 +4044,20 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id, sid_copy(&extra->sid[0], &attr->srv6_l3vpn->sid); extra->num_sids = 1; + + /* + * draft-ietf-bess-srv6-services-07 + * The part of SRv6 SID may be encoded as MPLS + * Label for the efficient packing. + */ + if (attr->srv6_l3vpn->transposition_len != 0) + transpose_sid( + &extra->sid[0], + decode_label(label), + attr->srv6_l3vpn + ->transposition_offset, + attr->srv6_l3vpn + ->transposition_len); } } else if (attr->srv6_vpn) { extra = bgp_path_info_extra_get(pi); @@ -4231,6 +4245,17 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id, if (attr->srv6_l3vpn) { sid_copy(&extra->sid[0], &attr->srv6_l3vpn->sid); extra->num_sids = 1; + + /* + * draft-ietf-bess-srv6-services-07 + * The part of SRv6 SID may be encoded as MPLS Label for + * the efficient packing. + */ + if (attr->srv6_l3vpn->transposition_len != 0) + transpose_sid( + &extra->sid[0], decode_label(label), + attr->srv6_l3vpn->transposition_offset, + attr->srv6_l3vpn->transposition_len); } else if (attr->srv6_vpn) { sid_copy(&extra->sid[0], &attr->srv6_vpn->sid); extra->num_sids = 1;