]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_route.c
Merge pull request #5717 from pguibert6WIND/flowspec_issue_redistribute
[mirror_frr.git] / bgpd / bgp_route.c
index d3a5774570b79695b4914ebd4ab0ae5d3696cede..66aa0da745767e61f693751474783650d0d94c79 100644 (file)
@@ -38,6 +38,7 @@
 #include "workqueue.h"
 #include "queue.h"
 #include "memory.h"
+#include "srv6.h"
 #include "lib/json.h"
 #include "lib_errors.h"
 #include "zclient.h"
@@ -3645,6 +3646,22 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
                                bgp_set_valid_label(&extra->label[0]);
                }
 
+               /* Update SRv6 SID */
+               if (attr->srv6_l3vpn) {
+                       extra = bgp_path_info_extra_get(pi);
+                       if (sid_diff(&extra->sid[0], &attr->srv6_l3vpn->sid)) {
+                               sid_copy(&extra->sid[0],
+                                        &attr->srv6_l3vpn->sid);
+                               extra->num_sids = 1;
+                       }
+               } else if (attr->srv6_vpn) {
+                       extra = bgp_path_info_extra_get(pi);
+                       if (sid_diff(&extra->sid[0], &attr->srv6_vpn->sid)) {
+                               sid_copy(&extra->sid[0], &attr->srv6_vpn->sid);
+                               extra->num_sids = 1;
+                       }
+               }
+
 #if ENABLE_BGP_VNC
                if ((afi == AFI_IP || afi == AFI_IP6)
                    && (safi == SAFI_UNICAST)) {
@@ -3824,6 +3841,18 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
                        bgp_set_valid_label(&extra->label[0]);
        }
 
+       /* Update SRv6 SID */
+       if (safi == SAFI_MPLS_VPN) {
+               extra = bgp_path_info_extra_get(new);
+               if (attr->srv6_l3vpn) {
+                       sid_copy(&extra->sid[0], &attr->srv6_l3vpn->sid);
+                       extra->num_sids = 1;
+               } else if (attr->srv6_vpn) {
+                       sid_copy(&extra->sid[0], &attr->srv6_vpn->sid);
+                       extra->num_sids = 1;
+               }
+       }
+
        /* Update Overlay Index */
        if (afi == AFI_L2VPN) {
                overlay_index_update(new->attr,
@@ -9208,6 +9237,15 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp,
                        vty_out(vty, "      Remote label: %d\n", label);
        }
 
+       /* Remote SID */
+       if (path->extra && path->extra->num_sids > 0 && safi != SAFI_EVPN) {
+               inet_ntop(AF_INET6, &path->extra->sid, buf, sizeof(buf));
+               if (json_paths)
+                       json_object_string_add(json_path, "remoteSid", buf);
+               else
+                       vty_out(vty, "      Remote SID: %s\n", buf);
+       }
+
        /* Label Index */
        if (attr->label_index != BGP_INVALID_LABEL_INDEX) {
                if (json_paths)