bgpd: Switch data structure passing to route_vty_out_detail

Instead of just passing in the prefix, pass in the particular
bgp_node we are using.

This is setup for a future commit to use this data.
The long term goal is to collect data about why
a particular bgp_path_info was selected as best and
to display that reason.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2019-05-15 20:54:34 -04:00
parent cf277e9e79
commit f08b5ca0d9
3 changed files with 18 additions and 16 deletions

View File

@ -681,7 +681,7 @@ static void show_vni_routes(struct bgp *bgp, struct bgpevpn *vpn, int type,
json_path = json_object_new_array(); json_path = json_object_new_array();
if (detail) if (detail)
route_vty_out_detail(vty, bgp, &rn->p, pi, route_vty_out_detail(vty, bgp, rn, pi,
AFI_L2VPN, SAFI_EVPN, AFI_L2VPN, SAFI_EVPN,
json_path); json_path);
else else
@ -2089,7 +2089,7 @@ static void evpn_show_route_vni_multicast(struct vty *vty, struct bgp *bgp,
if (json) if (json)
json_path = json_object_new_array(); json_path = json_object_new_array();
route_vty_out_detail(vty, bgp, &rn->p, pi, afi, safi, route_vty_out_detail(vty, bgp, rn, pi, afi, safi,
json_path); json_path);
if (json) if (json)
@ -2159,7 +2159,7 @@ static void evpn_show_route_vni_macip(struct vty *vty, struct bgp *bgp,
if (json) if (json)
json_path = json_object_new_array(); json_path = json_object_new_array();
route_vty_out_detail(vty, bgp, &rn->p, pi, afi, safi, route_vty_out_detail(vty, bgp, rn, pi, afi, safi,
json_path); json_path);
if (json) if (json)
@ -2266,7 +2266,7 @@ static void evpn_show_route_rd_macip(struct vty *vty, struct bgp *bgp,
if (json) if (json)
json_path = json_object_new_array(); json_path = json_object_new_array();
route_vty_out_detail(vty, bgp, &rn->p, pi, afi, safi, route_vty_out_detail(vty, bgp, rn, pi, afi, safi,
json_path); json_path);
if (json) if (json)
@ -2371,7 +2371,7 @@ static void evpn_show_route_rd(struct vty *vty, struct bgp *bgp,
if (json) if (json)
json_path = json_object_new_array(); json_path = json_object_new_array();
route_vty_out_detail(vty, bgp, &rn->p, pi, afi, safi, route_vty_out_detail(vty, bgp, rn, pi, afi, safi,
json_path); json_path);
if (json) if (json)
@ -2521,7 +2521,7 @@ static void evpn_show_all_routes(struct vty *vty, struct bgp *bgp, int type,
if (detail) { if (detail) {
route_vty_out_detail( route_vty_out_detail(
vty, bgp, &rn->p, pi, AFI_L2VPN, vty, bgp, rn, pi, AFI_L2VPN,
SAFI_EVPN, json_path); SAFI_EVPN, json_path);
} else } else
route_vty_out(vty, &rn->p, pi, 0, route_vty_out(vty, &rn->p, pi, 0,

View File

@ -7822,9 +7822,9 @@ static void route_vty_out_tx_ids(struct vty *vty,
} }
} }
void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p, void route_vty_out_detail(struct vty *vty, struct bgp *bgp,
struct bgp_path_info *path, afi_t afi, safi_t safi, struct bgp_node *bn, struct bgp_path_info *path,
json_object *json_paths) afi_t afi, safi_t safi, json_object *json_paths)
{ {
char buf[INET6_ADDRSTRLEN]; char buf[INET6_ADDRSTRLEN];
char buf1[BUFSIZ]; char buf1[BUFSIZ];
@ -7864,7 +7864,8 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
if (!json_paths && safi == SAFI_EVPN) { if (!json_paths && safi == SAFI_EVPN) {
char tag_buf[30]; char tag_buf[30];
bgp_evpn_route2str((struct prefix_evpn *)p, buf2, sizeof(buf2)); bgp_evpn_route2str((struct prefix_evpn *)&bn->p,
buf2, sizeof(buf2));
vty_out(vty, " Route %s", buf2); vty_out(vty, " Route %s", buf2);
tag_buf[0] = '\0'; tag_buf[0] = '\0';
if (path->extra && path->extra->num_labels) { if (path->extra && path->extra->num_labels) {
@ -7979,8 +7980,8 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
/* Line2 display Next-hop, Neighbor, Router-id */ /* Line2 display Next-hop, Neighbor, Router-id */
/* Display the nexthop */ /* Display the nexthop */
if ((p->family == AF_INET || p->family == AF_ETHERNET if ((bn->p.family == AF_INET || bn->p.family == AF_ETHERNET
|| p->family == AF_EVPN) || bn->p.family == AF_EVPN)
&& (safi == SAFI_MPLS_VPN || safi == SAFI_ENCAP && (safi == SAFI_MPLS_VPN || safi == SAFI_ENCAP
|| safi == SAFI_EVPN || safi == SAFI_EVPN
|| !BGP_ATTR_NEXTHOP_AFI_IP6(attr))) { || !BGP_ATTR_NEXTHOP_AFI_IP6(attr))) {
@ -8062,7 +8063,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
if (path->peer == bgp->peer_self) { if (path->peer == bgp->peer_self) {
if (safi == SAFI_EVPN if (safi == SAFI_EVPN
|| (p->family == AF_INET || (bn->p.family == AF_INET
&& !BGP_ATTR_NEXTHOP_AFI_IP6(attr))) { && !BGP_ATTR_NEXTHOP_AFI_IP6(attr))) {
if (json_paths) if (json_paths)
json_object_string_add( json_object_string_add(
@ -9429,7 +9430,7 @@ static int bgp_show_route_in_table(struct vty *vty, struct bgp *bgp,
BGP_PATH_MULTIPATH) BGP_PATH_MULTIPATH)
|| CHECK_FLAG(pi->flags, || CHECK_FLAG(pi->flags,
BGP_PATH_SELECTED)))) BGP_PATH_SELECTED))))
route_vty_out_detail(vty, bgp, &rm->p, route_vty_out_detail(vty, bgp, rm,
pi, AFI_IP, safi, pi, AFI_IP, safi,
json_paths); json_paths);
} }
@ -9473,7 +9474,7 @@ static int bgp_show_route_in_table(struct vty *vty, struct bgp *bgp,
pi->flags, pi->flags,
BGP_PATH_SELECTED)))) BGP_PATH_SELECTED))))
route_vty_out_detail( route_vty_out_detail(
vty, bgp, &rn->p, pi, vty, bgp, rn, pi,
afi, safi, json_paths); afi, safi, json_paths);
} }
} }

View File

@ -604,7 +604,8 @@ extern void route_vty_out_detail_header(struct vty *vty, struct bgp *bgp,
struct prefix_rd *prd, afi_t afi, struct prefix_rd *prd, afi_t afi,
safi_t safi, json_object *json); safi_t safi, json_object *json);
extern void route_vty_out_detail(struct vty *vty, struct bgp *bgp, extern void route_vty_out_detail(struct vty *vty, struct bgp *bgp,
struct prefix *p, struct bgp_path_info *path, struct bgp_node *bn,
struct bgp_path_info *path,
afi_t afi, safi_t safi, afi_t afi, safi_t safi,
json_object *json_paths); json_object *json_paths);
extern int bgp_show_table_rd(struct vty *vty, struct bgp *bgp, safi_t safi, extern int bgp_show_table_rd(struct vty *vty, struct bgp *bgp, safi_t safi,