]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Switch data structure passing to route_vty_out_detail
authorDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 16 May 2019 00:54:34 +0000 (20:54 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 16 May 2019 01:17:52 +0000 (21:17 -0400)
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>
bgpd/bgp_evpn_vty.c
bgpd/bgp_route.c
bgpd/bgp_route.h

index 4296604c4a4a9c4f53ff9db3f2da0c68c5ccd8ec..9e09d1789347d12c701e847755e85e3b3e24c365 100644 (file)
@@ -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,
index 82a395d8e6d20221626b6f588442605616ded855..81917820473595e971c9b620983abce9155d946d 100644 (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,
-                         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);
                                }
                        }
index 7bbc14b46f2b11444d2a7ce32600ea02f24f40d9..0d16ffc90c35b875633777d8e34ffa12db89d274 100644 (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,
                                        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,