]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: add transpose operation
authorRyoga Saito <contact@proelbtn.com>
Tue, 31 Aug 2021 06:56:00 +0000 (06:56 +0000)
committerRyoga Saito <contact@proelbtn.com>
Fri, 3 Sep 2021 01:19:49 +0000 (01:19 +0000)
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 <contact@proelbtn.com>
bgpd/bgp_route.c

index f97a791dae07c3146202ac37cda40311db0c94c5..7e5521ad2d78b4192189452c9beafec0073f26f5 100644 (file)
@@ -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;