From: Donald Sharp Date: Thu, 16 May 2019 00:54:34 +0000 (-0400) Subject: bgpd: Switch data structure passing to route_vty_out_detail X-Git-Tag: base_7.2~331^2~2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=f08b5ca0d919462cf92ff71da51d88af509e3fdd;p=matthieu%2Ffrr.git 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 --- diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c index 4296604c4a..9e09d17893 100644 --- a/bgpd/bgp_evpn_vty.c +++ b/bgpd/bgp_evpn_vty.c @@ -681,7 +681,7 @@ static void show_vni_routes(struct bgp *bgp, struct bgpevpn *vpn, int type, json_path = json_object_new_array(); if (detail) - route_vty_out_detail(vty, bgp, &rn->p, pi, + route_vty_out_detail(vty, bgp, rn, pi, AFI_L2VPN, SAFI_EVPN, json_path); else @@ -2089,7 +2089,7 @@ static void evpn_show_route_vni_multicast(struct vty *vty, struct bgp *bgp, if (json) 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); if (json) @@ -2159,7 +2159,7 @@ static void evpn_show_route_vni_macip(struct vty *vty, struct bgp *bgp, if (json) 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); if (json) @@ -2266,7 +2266,7 @@ static void evpn_show_route_rd_macip(struct vty *vty, struct bgp *bgp, if (json) 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); if (json) @@ -2371,7 +2371,7 @@ static void evpn_show_route_rd(struct vty *vty, struct bgp *bgp, if (json) 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); if (json) @@ -2521,7 +2521,7 @@ static void evpn_show_all_routes(struct vty *vty, struct bgp *bgp, int type, if (detail) { route_vty_out_detail( - vty, bgp, &rn->p, pi, AFI_L2VPN, + vty, bgp, rn, pi, AFI_L2VPN, SAFI_EVPN, json_path); } else route_vty_out(vty, &rn->p, pi, 0, diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 82a395d8e6..8191782047 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -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, - struct bgp_path_info *path, afi_t afi, safi_t safi, - json_object *json_paths) +void route_vty_out_detail(struct vty *vty, struct bgp *bgp, + struct bgp_node *bn, struct bgp_path_info *path, + afi_t afi, safi_t safi, json_object *json_paths) { char buf[INET6_ADDRSTRLEN]; 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) { 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); tag_buf[0] = '\0'; 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 */ /* Display the nexthop */ - if ((p->family == AF_INET || p->family == AF_ETHERNET - || p->family == AF_EVPN) + if ((bn->p.family == AF_INET || bn->p.family == AF_ETHERNET + || bn->p.family == AF_EVPN) && (safi == SAFI_MPLS_VPN || safi == SAFI_ENCAP || safi == SAFI_EVPN || !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 (safi == SAFI_EVPN - || (p->family == AF_INET + || (bn->p.family == AF_INET && !BGP_ATTR_NEXTHOP_AFI_IP6(attr))) { if (json_paths) json_object_string_add( @@ -9429,7 +9430,7 @@ static int bgp_show_route_in_table(struct vty *vty, struct bgp *bgp, BGP_PATH_MULTIPATH) || CHECK_FLAG(pi->flags, BGP_PATH_SELECTED)))) - route_vty_out_detail(vty, bgp, &rm->p, + route_vty_out_detail(vty, bgp, rm, pi, AFI_IP, safi, json_paths); } @@ -9473,7 +9474,7 @@ static int bgp_show_route_in_table(struct vty *vty, struct bgp *bgp, pi->flags, BGP_PATH_SELECTED)))) route_vty_out_detail( - vty, bgp, &rn->p, pi, + vty, bgp, rn, pi, afi, safi, json_paths); } } diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h index 7bbc14b46f..0d16ffc90c 100644 --- a/bgpd/bgp_route.h +++ b/bgpd/bgp_route.h @@ -604,7 +604,8 @@ extern void route_vty_out_detail_header(struct vty *vty, struct bgp *bgp, struct prefix_rd *prd, afi_t afi, safi_t safi, json_object *json); 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, json_object *json_paths); extern int bgp_show_table_rd(struct vty *vty, struct bgp *bgp, safi_t safi,