diff options
author | Ryoga Saito <ryoga.saito@linecorp.com> | 2022-02-25 14:44:07 +0100 |
---|---|---|
committer | Ryoga Saito <ryoga.saito@linecorp.com> | 2022-02-25 16:34:28 +0100 |
commit | ea7cd161b2122a352736cc278213d70d29b88243 (patch) | |
tree | c555602b24fb3b3bf6c1eccb7b61a9b1da2da5fd /bgpd/bgp_zebra.c | |
parent | bgpd: announce locators instead of transposed SIDs (diff) | |
download | frr-ea7cd161b2122a352736cc278213d70d29b88243.tar.xz frr-ea7cd161b2122a352736cc278213d70d29b88243.zip |
bgpd: change the treatment for SRv6 routes
This patch adds transpostion_offset and transposition_len to bgp_sid_info,
and transposes SID only at bgp_zebra_announce.
Signed-off-by: Ryoga Saito <ryoga.saito@linecorp.com>
Diffstat (limited to '')
-rw-r--r-- | bgpd/bgp_zebra.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index c295b0660..5a060d46f 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -1260,6 +1260,7 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p, struct bgp_path_info *mpinfo_cp = &local_info; route_tag_t tag; mpls_label_t label; + struct bgp_sid_info *sid_info; int nh_othervrf = 0; bool is_evpn; bool nh_updated = false; @@ -1476,9 +1477,22 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p, if (mpinfo->extra && !sid_zero(&mpinfo->extra->sid[0].sid) && !CHECK_FLAG(api.flags, ZEBRA_FLAG_EVPN_ROUTE)) { - memcpy(&api_nh->seg6_segs, &mpinfo->extra->sid[0].sid, + sid_info = &mpinfo->extra->sid[0]; + + memcpy(&api_nh->seg6_segs, &sid_info->sid, sizeof(api_nh->seg6_segs)); + if (sid_info->transposition_len != 0) { + if (!bgp_is_valid_label( + &mpinfo->extra->label[0])) + continue; + + label = label_pton(&mpinfo->extra->label[0]); + transpose_sid(&api_nh->seg6_segs, label, + sid_info->transposition_offset, + sid_info->transposition_len); + } + SET_FLAG(api_nh->flags, ZAPI_NEXTHOP_FLAG_SEG6); } |