diff options
author | Ameya Dharkar <adharkar@vmware.com> | 2021-01-11 03:32:34 +0100 |
---|---|---|
committer | Ameya Dharkar <adharkar@vmware.com> | 2021-06-08 02:58:22 +0200 |
commit | 6c995628c1d175d255c2a02f108813090da4c4e2 (patch) | |
tree | 9df04ed7924f1ea0436bdd0a698bdf37b8f8dc9d /bgpd/bgp_debug.c | |
parent | bgpd: CLI to advertise gateway IP overlay index (diff) | |
download | frr-6c995628c1d175d255c2a02f108813090da4c4e2.tar.xz frr-6c995628c1d175d255c2a02f108813090da4c4e2.zip |
bgpd: Generate and advertise gateway IP overlay index with EVPN RT-5
Gateway IP overlay index is generated for EVPN RT-5 when following CLI is
configured.
router bgp 100 vrf vrf-blue
address-family l2vpn evpn
advertise ipv4 unicast gateway-ip
advertise ipv6 unicast gateway-ip
BGP nexthop of the VRF IP/IPv6 route is set as the gateway IP of the
corresponding EVPN RT-5
Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
Diffstat (limited to 'bgpd/bgp_debug.c')
-rw-r--r-- | bgpd/bgp_debug.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c index 8f286e66d..856afb05f 100644 --- a/bgpd/bgp_debug.c +++ b/bgpd/bgp_debug.c @@ -2680,10 +2680,14 @@ const char *bgp_debug_rdpfxpath2str(afi_t afi, safi_t safi, union prefixconstptr pu, mpls_label_t *label, uint32_t num_labels, int addpath_valid, uint32_t addpath_id, + struct bgp_route_evpn *overlay_index, char *str, int size) { char rd_buf[RD_ADDRSTRLEN]; char tag_buf[30]; + char overlay_index_buf[INET6_ADDRSTRLEN + 14]; + const struct prefix_evpn *evp; + /* ' with addpath ID ' 17 * max strlen of uint32 + 10 * +/- (just in case) + 1 @@ -2701,6 +2705,23 @@ const char *bgp_debug_rdpfxpath2str(afi_t afi, safi_t safi, snprintf(pathid_buf, sizeof(pathid_buf), " with addpath ID %u", addpath_id); + overlay_index_buf[0] = '\0'; + if (overlay_index && overlay_index->type == OVERLAY_INDEX_GATEWAY_IP) { + char obuf[INET6_ADDRSTRLEN]; + + obuf[0] = '\0'; + evp = pu.evp; + if (is_evpn_prefix_ipaddr_v4(evp)) + inet_ntop(AF_INET, &overlay_index->gw_ip, obuf, + sizeof(obuf)); + else if (is_evpn_prefix_ipaddr_v6(evp)) + inet_ntop(AF_INET6, &overlay_index->gw_ip, obuf, + sizeof(obuf)); + + snprintf(overlay_index_buf, sizeof(overlay_index_buf), + " gateway IP %s", obuf); + } + tag_buf[0] = '\0'; if (bgp_labeled_safi(safi) && num_labels) { @@ -2720,9 +2741,10 @@ const char *bgp_debug_rdpfxpath2str(afi_t afi, safi_t safi, } if (prd) - snprintfrr(str, size, "RD %s %pFX%s%s %s %s", + snprintfrr(str, size, "RD %s %pFX%s%s%s %s %s", prefix_rd2str(prd, rd_buf, sizeof(rd_buf)), pu.p, - tag_buf, pathid_buf, afi2str(afi), safi2str(safi)); + overlay_index_buf, tag_buf, pathid_buf, afi2str(afi), + safi2str(safi)); else if (safi == SAFI_FLOWSPEC) { char return_string[BGP_FLOWSPEC_NLRI_STRING_MAX]; const struct prefix_fs *fs = pu.fs; |