From: Dinesh Dutt <5016467+ddutt@users.noreply.github.com> Date: Mon, 12 Aug 2019 13:20:18 +0000 (+0000) Subject: bgpd: Display the imported route information for EVPN routes X-Git-Tag: base_7.2~58^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=d7325ee773bd415b7dc28e0e7dbc4cda30fc5533;p=matthieu%2Ffrr.git bgpd: Display the imported route information for EVPN routes For IPv4/v6 unicast routes that have been imported from EVPN Prefix routes, display the information about where the route has been imported from allowing for easy tracing of how a FIB/RIB entry got populated. Signed-off-by: Dinesh G Dutt <5016467+ddutt@users.noreply.github.com> --- diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index a372568373..183debddba 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -8165,20 +8165,25 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, json_nexthop_global = json_object_new_object(); } - if (!json_paths && safi == SAFI_EVPN) { + if (!json_paths && path->extra) { char tag_buf[30]; - bgp_evpn_route2str((struct prefix_evpn *)&bn->p, - buf2, sizeof(buf2)); - vty_out(vty, " Route %s", buf2); + buf2[0] = '\0'; tag_buf[0] = '\0'; if (path->extra && path->extra->num_labels) { bgp_evpn_label2str(path->extra->label, path->extra->num_labels, tag_buf, sizeof(tag_buf)); - vty_out(vty, " VNI %s", tag_buf); } - vty_out(vty, "\n"); + if (safi == SAFI_EVPN) { + bgp_evpn_route2str((struct prefix_evpn *)&bn->p, + buf2, sizeof(buf2)); + vty_out(vty, " Route %s", buf2); + if (tag_buf[0] != '\0') + vty_out(vty, " VNI %s", tag_buf); + vty_out(vty, "\n"); + } + if (path->extra && path->extra->parent) { struct bgp_path_info *parent_ri; struct bgp_node *rn, *prn; @@ -8187,11 +8192,14 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, rn = parent_ri->net; if (rn && rn->prn) { prn = rn->prn; - vty_out(vty, " Imported from %s:%s\n", - prefix_rd2str( - (struct prefix_rd *)&prn->p, - buf1, sizeof(buf1)), - buf2); + prefix_rd2str((struct prefix_rd *)&prn->p, + buf1, sizeof(buf1)); + if (is_pi_family_evpn(parent_ri)) { + bgp_evpn_route2str((struct prefix_evpn *)&rn->p, + buf2, sizeof(buf2)); + vty_out(vty, " Imported from %s:%s, VNI %s\n", buf1, buf2, tag_buf); + } else + vty_out(vty, " Imported from %s:%s\n", buf1, buf2); } } }