From: Ameya Dharkar Date: Mon, 11 Jan 2021 03:49:11 +0000 (-0800) Subject: bgpd: EVPN route type-5 gateway IP show command X-Git-Tag: base_8.1~399^2~9 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=8304dabfab9063fe5720e8e714476ed2e9127540;p=matthieu%2Ffrr.git bgpd: EVPN route type-5 gateway IP show command Display gateway IP attribute in show command "show bgp l2vpn evpn route type prefix [json]" dev# sh bgp l2vpn evpn 100.0.0.21 BGP routing table entry for 10.100.0.2:1000:[5]:[0]:[32]:[100.0.0.21] Paths: (1 available, best #1) Advertised to non peer-group peers: 10.0.1.1 Route [5]:[0]:[32]:[100.0.0.21] VNI 1000 Gateway IP 50.0.2.21 203 10.100.0.2 from 0.0.0.0 (10.100.0.2) Origin IGP, metric 0, valid, sourced, local, best (First path received) Extended Community: ET:8 RT:102:1000 Rmac:72:48:54:da:7f:13 Last update: Mon Jun 29 12:29:05 2020 Signed-off-by: Ameya Dharkar --- diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index c539bccb62..4ec8ac305a 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -9647,6 +9647,11 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn, json_nexthop_global = json_object_new_object(); } + if (safi == SAFI_EVPN) { + if (!json_paths) + vty_out(vty, " Route %pRN", bn); + } + if (path->extra) { char tag_buf[30]; @@ -9658,12 +9663,8 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn, } if (safi == SAFI_EVPN) { if (!json_paths) { - vty_out(vty, " Route %pFX", - (struct prefix_evpn *) - bgp_dest_get_prefix(bn)); if (tag_buf[0] != '\0') vty_out(vty, " VNI %s", tag_buf); - vty_out(vty, "\n"); } else { if (tag_buf[0]) json_object_string_add(json_path, "VNI", @@ -9710,6 +9711,27 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn, } } + if (safi == SAFI_EVPN + && attr->evpn_overlay.type == OVERLAY_INDEX_GATEWAY_IP) { + char gwip_buf[INET6_ADDRSTRLEN]; + + if (is_evpn_prefix_ipaddr_v4((struct prefix_evpn *)&bn->p)) + inet_ntop(AF_INET, &attr->evpn_overlay.gw_ip.ipv4, + gwip_buf, sizeof(gwip_buf)); + else + inet_ntop(AF_INET6, &attr->evpn_overlay.gw_ip.ipv6, + gwip_buf, sizeof(gwip_buf)); + + if (json_paths) + json_object_string_add(json_path, "gatewayIP", + gwip_buf); + else + vty_out(vty, " Gateway IP %s", gwip_buf); + } + + if (safi == SAFI_EVPN) + vty_out(vty, "\n"); + /* Line1 display AS-path, Aggregator */ if (attr->aspath) { if (json_paths) {